Step 3.1: Create an API Using Amazon API Gateway
Follow the steps in this section to create a new Lambda function and an API Gateway endpoint to trigger it:
Sign in to the AWS Management Console and open the AWS Lambda console.
Choose Create Lambda function.
On the Select blueprint page, choose the microservice-http-endpoint blueprint. You can use the Filter to find it.
The Configure triggers page will be populated with an API Gateway trigger. The default API name that will be created is
LambdaMicroservice(You can change this name via the API Name field if you wish).
When you complete the wizard and create your function, Lambda automatically creates a proxy resource named
MyLambdaMicroservice(your function name) under the API name you selected. For more information about proxy resources, see Configure Proxy Integration for a Proxy Resource. A proxy resource has an
AWS_PROXYintegration type and a catch-all method
AWS_PROXYintegration type applies a default mapping template to pass through the entire request to the Lambda function and transforms the output from the Lambda function to HTTP responses. The
ANYmethod defines the same integration setup for all the supported methods, including
After reviewing your trigger, choose Next.
On the Configure function page, do the following:
Review the preconfigured Lambda function configuration information, including:
index.handler. The format is:
Enter the function name
In Role, enter a role name for the new role that will be created.
The microservice-http-endpoint blueprint pre-populates the Simple Microservice permission policy template in the Policy templates field, to be added to your new role upon creation. This automatically adds the requisite permissions attached to that policy to your new role. For more information, see Policy Templates.
Choose Create function.