Invoking the Lambda Function with AWS API Gateway and saving the processed request into the DynamoDB table.
When the API received an incoming request, it will validate if the required fields are present, create the key, and then insert the request data into DynamoDB Table.
Method: POST
Endpoint: https://{api-id}.execute.api.{region}.amazonaws.com/prod/
Request Body:
{
"name": "Galão",
"description": "Originating in Portugal, this hot coffee drink is closely related to the latte and cappuccino.",
"ingredients": ["Espresso", "Foamed milk"]
}- Core components of Amazon DynamoDB
- Tutorial: Using Lambda with API Gateway
- Using Sort Keys to Organize Data in Amazon DynamoDB
- Tutorial: Build a CRUD API with Lambda and DynamoDB
- Best practices for designing and using partition keys effectively
The cdk.json file tells the CDK Toolkit how to execute your app.
npm installinstall projects dependenciesnpm run buildcompile typescript to jsnpm run watchwatch for changes and compilenpm run testperform the jest unit testscdk deploydeploy this stack to your default AWS account/regioncdk diffcompare deployed stack with current statecdk synthemits the synthesized CloudFormation templatecdk bootstrapdeployment of AWS CloudFormation template to a specific AWS environment (account and region)cdk destroydestroy this stack from your default AWS account/region
- Install all the dependencies, bootstrap your project, and synthesized CloudFormation template.
# Without passing "profile" parameter
dev@dev:~:aws-cdk-samples/api-gateway/api-gateway-lambda-dynamodb$ make init
# With "profile" parameter
dev@dev:~:aws-cdk-samples/api-gateway/api-gateway-lambda-dynamodb$ make init profile=[profile_name]- Deploy the project.
# Without passing "profile" parameter
dev@dev:~:aws-cdk-samples/api-gateway/api-gateway-lambda-dynamodb$ make deploy
# With "profile" parameter
dev@dev:~:aws-cdk-samples/api-gateway/api-gateway-lambda-dynamodb$ make deploy profile=[profile_name]