Notice: Trying to get property 'post_excerpt' of non-object in /home/n3svtp4r09fz/technet.vn/wp-content/themes/darknews/single.php on line 43
Lab Details
- This lab walks you through the steps to create an integration between Lambda and API Gateway
- You will practice using Amazon API Gateway.
- Duration: 45 minutes.
- AWS Region: US East (N. Virginia) us-east-1.
Introduction
Amazon API Gateway
- Amazon API Gateway is a fully managed service that makes it easy for developers to create, publish, maintain, monitor, and secure APIs at any scale.
- APIs act as the front door for applications to access data, business logic, or functionality from your backend services.
- API Gateway handles all the tasks involved in accepting and processing up to hundreds of thousands of concurrent API calls, including traffic management, CORS support, authorization and access control, throttling, monitoring, and API version management.
- Using API Gateway, you can create RESTful APIs and WebSocket APIs that enable real-time two-way communication applications. API Gateway supports containerized and serverless workloads, as well as web applications.
- AWS Lambda lets you run code without provisioning or managing servers. You pay only for the compute time you consume.
- With Lambda, you can run code for virtually any type of application or backend service – all with zero administration. Just upload your code and Lambda takes care of everything required to run and scale your code with high availability. You can set up your code to automatically trigger from other AWS services or call it directly from any web or mobile app.
Tasks
- Log into the AWS Management Console.
- Create a Lambda Function.
- Create a new API.
- Create a Resource.
- Create a Method.
Architecture Diagram

Lab Steps
Task 1: Launching Lab Environment
- Launch lab environment by clicking on
. This will create an AWS environment with the resources required for this lab.
- Once your lab environment is created successfully,
will be active. Click on
, this will open your AWS Console Account for this lab in a new tab. If you are asked to logout in AWS Management Console page, click on the here link and then click on
again.
- If you have logged into other aws accounts in the same browser, after clicking on the
, you will be redirected to a page asking you to logout from the other aws account.
Note : If you have completed one lab, make sure to sign out of the AWS account before starting a new lab. If you face any issues, please go through FAQs and Troubleshooting for Labs. |
Task 2: Create a Lambda Function
- Navigate to the
menu at the top, then click on
under the
section.
- Click on the button.
- Choose
.
- Function name : WhizlabsAPI
- Runtime : Select Python 3.8
- Role : In the permissions section, Choose
under change default execution role.
- Enter the Role name as WhizlabsAPI, Choose policy template as Basic Lambda @ Edge Permission(For CloudFront Trigger)
- Click on
- Choose
- Once the Lambda Function is created successfully, it will look like the screenshot below:

Task 3: Create an API
- Navigate to the
menu at the top, then click on
in the
section.
- Click on
. If it gets started and is not visible, then click on
in REST API and select Protocol as REST.
- Choose to create a new API as
. Under settings, choose the API name WhizlabAPI. Leave other options as default and click on

Task 4: Creating a Resource
- Once the API is created, select the API and click on
- Select
in actions.
- Resource Name: Enter whizlabsapi
- Enter the resource name and click on

Task 5: Creating a Method
- Once you create a resource, click on Actions, and select
. Select Get in the drop-down list.
- Select the Integration Type as
- Enter the Lambda Function as WhizlabsAPI and choose the us-east-1 region. click on
- Note: If any pop-ups appear, ignore them.

- Once the method has been created, your screen will look similar to the screenshot below:

Task 6: Deploy the API
- Once the resource and the method have been created successfully, you can deploy the API.
- Click on
and select
under API actions.
- Select the Deployment Stage in the drop-down as New Stage.
- Enter Stage Name: TestingAPI and Stage description as a Testing environment for my WhizlabsAPI.
- Click on

- Once the API has been deployed, navigate to Stages. You will be able to see the following:

- Copy and Paste the Invoke URL (followed by the resource name) in the new tab to make a GET request.
- now add /whizlabsapi at the end of deploy URL.
- You will receive the GET request from the API. Here’s an example:

Task 7: Validation Test
- Once the lab steps are completed, please click on the
button on the right side panel.
- This will validate the resources in the AWS account and shows you whether you have completed this lab successfully or not.
- Sample output :

Completion and Conclusion
- You have successfully created a Lambda function.
- You have successfully created the API.
- You have successfully created the API Resource and Method.
- You have successfully tested the API.