Amazon Web Services
AWS-08 intermediate
Build a serverless REST API: API Gateway + Lambda + DynamoDB
Build the most common serverless backend in the industry: a Products API with an HTTP API front door, a Lambda function using the AWS SDK v3, and a DynamoDB table – and fix a real AccessDenied error with least-privilege IAM.
What you'll do
- Create a DynamoDB table with a partition key
- Write a Lambda handler for multiple API routes
- Diagnose and fix an IAM AccessDeniedException
- Create an HTTP API with path parameters
- Call the API with curl and verify data in DynamoDB
Lab tasks
-
1
Create the DynamoDB table
Products -
2
Create the function
products-api - 3 Write the API handler with the AWS SDK and deploy
- 4 Test a POST – and observe AccessDeniedException
- 5 Grant the role access to the table
- 6 Re-run the test – the product is created
-
7
Create the HTTP API
products-http-api - 8 Create a product with curl
- 9 Fetch it by id using the path parameter
- 10 Verify the items in DynamoDB