- Lab
- A Cloud Guru
Building a Serverless Application Using Step Functions, API Gateway, Lambda, and S3 in AWS
In this AWS hands-on lab, we will create a fully working serverless reminder application using S3, Lambda, API Gateway, Step Functions, Simple Email Service, and Simple Notification Service. While the lab does use Python and JavaScript, you don't need to be able to code to understand and implement the solution. By the end of the lab, you will feel more comfortable architecting and implementing serverless solutions within AWS. Let's get started!
Path Info
Table of Contents
-
Challenge
Validate email with Simple Email Service (SES)
Within the Simple Email Service (SES) console create a new identity and validate a personal email account for use with the service.
Note If you can, use a gmail account.
-
Challenge
Configure Email Reminder Lambda Function
Download the zip file containing the lab files from.
Using the contents of the
email_reminder.py
file, create a lambda function called email. Using Python version 3.x during configuration.Configure the function to use the LambdaRuntimeRole as the execution role.
On line 3 of the code insert your verified email address into the placeholder text.
-
Challenge
Create Step Function State Machine
Create a Step Function state machine called MyStateMachine(random characters)
Use the code provided in step-function-template.json from the lab bundle to create the Step Function.
Link the Lambda email function and the Step Function together by inserting the Lambda email function arn into the Step Function code placeholder on line 23.
Change the execution role to use the provided RoleForStepFunction
-
Challenge
Configure api_handler Lambda Function
Using the contents of the
api_handler.py
file, create a lambda function called api_handler. Using Python version 3.x during configuration.Configure the function to use the LambdaRuntimeRole as the execution role.
On line 6 of the lambda_function.py code insert the State Machine arn into the placeholder text.
-
Challenge
Create Rest API
In the API Gateway Console create a Rest API
Use the following settings.
- API name: reminders
- Leave Description blank.
- Endpoint Type: Regional
Create Resource called reminders Ensure CORS is enabled Create a method for the reminders resource with the type POST
Use the following settings.
- Integration type: Lambda Function
- Enable Lambda Proxy integration by clicking the toggle.
- Lambda Region: us-east-1
- Lambda Function: Start typing, and then select, api_handler.
When deploying the API create a new stage called prod
-
Challenge
Create Static Website Running on S3 and Test
Update line 5 of formlogic.js from the static website folder in the lab bundle with the Rest API invoke url endpoint you created in the previous objective.
Ensure the endpoint includes /reminders at the end.
Create a new S3 bucket using these settings.
- Bucket Type General Purpose
- Bucket Name Globally Unique Name
- ACL's enabled
- Allow Public Access
Upload the contents from the static website folder to the S3 bucket changing the permissions to Grant public-read access
Enable Static website hosting, setting the following values.
- Index document index.html
- Error document error.html
Open the static website and fill in the form to test.
What's a lab?
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.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.