Objectives
- Create a Lambda function
- Create an API Gateway endpoint
- Access the API Gateway endpoint
- Monitor the API Gateway endpoint with CloudWatch
Lab Details
- Create a Lambda function named
FAQ. You can use the default Node.js runtime and default execution role. - Use the code from faq.js as your source code for the function definition.
- Test the function by clicking Test and configuring a new test. Delete the keys and values and leave an empty object
{}. Create and run the test to verify your Lambda function works.Take a screenshot of the test results.
- To allow access to your Lambda function from outside AWS, create an API Gateway endpoint. Click Add trigger within Lambda and configure it as follows, then click Add:
- Select a trigger: API Gateway
- API: Create a new API
- Choose a template: REST API
- Security: Open
- API name: FAQ-API
- Deployment stage: matcDemo
Take a screenshot of the trigger configuration.
- Access your FAQ-API within a browser to verify it works. You will need the API Gateway endpoint URL from API Gateway.
Take a screenshot of the API Gateway results in a browser. Include the browser URL as well as the data results.
- Back in Lambda, select your FAQ function and click the Monitoring tab. Verify activity within the CloudWatch logs matches your use of the services.
Take a screenshot of your CloudWatch log data.
- After completing the lab (submit the requested screenshots) and getting credit in the Grade Center, delete the Lambda function and API Gateway resources to avoid being billed.
What did I learn?
- Creating Lambda functions
- Allow a Lambda function to be accessible outside of AWS using API Gateway
- Monitor usage of a Lambda function