Creating a Lambda Function Using the AWS Console

45 minutes
  • 3 Learning Objectives

About this Hands-on Lab

In this hands-on lab scenario, you’ll write a Node.js Lambda function that checks a URL (like and returns the status code that signifies if the website is up and running or down. During this lab, you’ll have the opportunity to explore the Lambda console, function code, execution roles, test events, and execution results. AWS Lambda allows you to write concise functions and only worry about your code. Since Lambda is serverless, AWS manages the underlying infrastructure for you.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Author Node.js Lambda Function in AWS Console
  1. Navigate to Lambda.
  2. Click Create function.
  3. Select Author from scratch.
  4. Name your function.
  5. Select Node.js as the runtime.
  6. Select Create a new role with basic Lambda permissions.
  7. Click Create function.
  8. In a new browser tab, navigate to the lab GitHub repository link provided on the lab page.
  9. Copy the index.js code, and replace the Lambda function code with it.
  10. Deploy your function.
Test Function Using a Test Event
  1. Click the Test button on the Lambda function dashboard.
  2. For the Event name, enter "mytestEvent".
  3. Leave the default values, and click Create.
  4. Click the Test button.
  5. Review the output response.
View Lambda’s CloudWatch Logs
  1. Click on the Monitoring tab.
  2. Click View logs in CloudWatch.
  3. Click on the most recent log stream in the Log streams section.
  4. Notice the billed duration.

Additional Resources

Log in to the live AWS environment using the provided credentials. Make sure you are in us-east-1 when you work in this environment.

Note: You do not need to rewrite all of the code used in the lesson — it is available for download.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?