Creating a Simple AWS Lambda Function

Get Started
30 minutes
  • 3 Learning Objectives

About this Hands-on Lab

This Learning Activity provides hands-on experience with creating and customizing Python3-based Lambda functions from within the console.

The primary focus will be on the following features within AWS Lambda:

1. Lambda Console
2. Function Code
3. Execution Roles
4. Test Events
5. Execution Results

AWS Lambda allows you to create functions and you only have to worry about managing your code. AWS handles the underlying infrastructure for you.

This *HelloWorld* function will allow you to see just how easy it is to get started.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a Lambda Function within the AWS Lambda Console
  1. Navigate to the Lambda portion of the AWS Console.
  2. Select Create your Lambda Function from scratch.
  3. Select Python3.6 as your runtime.
  4. Copy the code from the example code provided. https://raw.githubusercontent.com/linuxacademy/content-lambda-deep-dive/master/section_2/live_act_1/lambda_function.py
  5. Deploy your function after adding the sample code.
Create a Test Event and Manually Invoke the Function Using the Test Event
  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. Select the Hello World event template.
  4. Erase the code in there and copy and paste the provided JSON code, then select Create.
  5. Click on the Test button and verify your function succeeds.
Verify that CloudWatch has Captured Function Logs
  1. Navigate to the CloudWatch portion of the AWS Console.
  2. Select Logs from the selection on the left.
  3. Select the log group with your function name in it.
  4. Select the log stream within the log group.
  5. Verify the output is present and correct.

Additional Resources

Please go to the AWS Console using the link provided after lab creation is complete.

Login using the credentials provided to you. You should have been given a user name of cloud_user and a randomly generated password.

Please make sure you are in the us-east-1 region before beginning.

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

Lesson Code: https://raw.githubusercontent.com/linuxacademy/content-lambda-deep-dive/master/section_2/live_act_1/lambda_function.py

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.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!
Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?