Creating a Lambda Function with the AWS Management Console

30 minutes
  • 3 Learning Objectives

About this Hands-on Lab

In this lab scenario, Alfredo’s Pizza is a global fast-food chain selling delicious pizza. Their website serves thousands of customers each day and processes over 6 million in payments each week. While Alfredo is doing well, he’s not seeing the customers he had hoped for, and relying on expensive always-on servers ends up with resources sitting idle, wasting money. Alfredo wants to migrate his application to a serverless architecture with the hope of saving on operating costs. We’ll help him by showing him how easy Lambda functions can be. In this hands-on lab, you’ll author a Lambda function using the Python programming language in the AWS console. We will also review logs generated by CloudWatch.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Author Lambda Function in Python

In this video we will author a Lambda function in Python. The source code for the Lambda function can be found here.

  1. Navigate to the Lambda portion of the AWS Console.
  2. Select Create your Lambda Function from scratch.
  3. Select the latest Python verson as your runtime.
  4. Copy the code from the example code provided.
  5. Save and deploy your function after adding the sample code.
Create a Test Event and Execute Lambda

In this video we will create a test event for testing your function. The test event for the Lambda function can be found here.

  1. Select the drop-down next to Test at the top of the Lambda console.
  2. From the drop-down, select Configure test events.
  3. Copy and paste the test event from the example JSON provided.
  4. Select Create.
  5. Click on the Test button and verify your function succeeds.
Verify that CloudWatch has Captured Function Logs

In this video, we are going to walk through the process to view the CloudWatch logs for the Lambda function.

  1. Click the Monitor tab.
  2. Click View logs in CloudWatch.
  3. Select the most recent log stream.
  4. View the outputs in the log.

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.

  • The Python source code for the Lambda function can be found here.
  • The test event for the Lambda function can be found here.

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?