- Navigate to DynamoDB dashboard
- Click
Create table - Table name:
Lambda-DynamoDB - Partition key:
id(String) - Table settings: Leave default
- Click
Create table
- Navigate to Lambda dashboard
- Click
Create function - Author from scratch
- Function name:
Lambda-DynamoDB-LambdaAPI - Runtime: Node.js 20.x
- Change default execution role
- Create a new role from AWS policy templates
- Role name:
Lambda-DynamoDB-LambdaAPI - Policy templates:
Simple microservices permissions
- Click
Create function
- Navigate to Lambda dashboard
- Click
Create function - Author from scratch
- Function name:
Lambda-DynamoDB-LambdaAuthorizer - Runtime: Node.js 20.x
- Click
Create function
- Navigate to the API Gateway Dashboard
- Click
Create API - Choose
HTTP API - Add integration
- Choose
Lambda - Find and select the new lambda function
- API name:
Lambda-DynamoDB-APIGateway
- Choose
- Configure routes
- GET /items -> Lambda-DynamoDB-LambdaAPI (integration)
- POST /items -> Lambda-DynamoDB-LambdaAPI (integration)
- GET /items/{id} -> Lambda-DynamoDB-LambdaAPI (integration)
- PUT /items/{id} -> Lambda-DynamoDB-LambdaAPI (integration)
- DELETE /items/{id} -> Lambda-DynamoDB-LambdaAPI (integration)
- Define stages
- Leave stage name = "$default"
- Leave "Auto-deploy" checked
- Click Create
- Navigate to
Authorization - Open the tab named
Manage authorizers - Click
Create - Choose
Lambda - Name:
Lambda-DynamoDB-LambdaAuthorizer - Lambda function:
Lambda-DynamoDB-LambdaAuthorizer - Click
Create - Open the tab named
Attach authorizers to routes - Click each route, select the authorizer we just created and click
Attach authorizer
- Open
https://github.com/robertwelch/Lambda-DynamoDB - Click
Fork
- API_GATEWAY_URL
- AWS_ACCESS_KEY_ID
- AWS_REGION
- AWS_SECRET_ACCESS_KEY
- DYNAMODB_TABLE_NAME
- LAMBDA_API_NAME
- LAMBDA_AUTHORIZER_KEY
- LAMBDA_AUTHORIZER_NAME
- Navigate to your github repo actions
- Click the job named
Build and deploy to Lambda - Click
Run workflow - Make sure branch is set to
mainand clickRun workflow - This workflow will test locally using the AWS security credentials you provided in the secrets
- Copy api/env_example to api/.env
- Add the same environment variables as your GitHub repository secrets plus the LOCAL_PORT number.