aws-lambda-dynamodb
| Reference Documentation: | https://docs.aws.amazon.com/solutions/latest/constructs/ |
| Language | Package |
|---|---|
|
|
|
|
|
|
|
|
|
Overview
This AWS Solutions Construct implements the AWS Lambda function and Amazon DynamoDB table with the least privileged permissions.
Here is a minimal deployable pattern definition:
Pattern Construct Props
| Name | Type | Description |
|---|---|---|
|
existingLambdaObj? |
Existing instance of Lambda Function object, providing both this and
|
|
|
lambdaFunctionProps? |
User provided props to override the default props for the Lambda function. |
|
|
dynamoTableProps? |
Optional user provided props to override the default props for DynamoDB Table |
|
|
existingTableObj? |
Existing instance of DynamoDB table object, providing both this and
|
|
|
tablePermissions? |
|
Optional table permissions to grant to the
Lambda function. One of the following may be specified: |
|
tableEnvironmentVariableName? |
|
Optional Name for the Lambda function environment variable set to the name of the DynamoDB table. Default: DDB_TABLE_NAME |
|
existingVpc? |
An optional, existing VPC into which this pattern should be deployed.
When deployed in a VPC, the Lambda function will use ENIs in the VPC to
access network resources and a Gateway Endpoint will be created in the
VPC for Amazon DynamoDB. If an existing VPC is provided, the |
|
|
vpcProps? |
Optional user-provided properties to override the default properties
for the new VPC. |
|
|
deployVpc? |
|
Whether to create a new VPC based on |
Pattern Properties
| Name | Type | Description |
|---|---|---|
|
lambdaFunction |
Returns an instance of lambda.Function created by the construct |
|
|
dynamoTable |
Returns an instance of dynamodb.Table created by the construct |
|
|
vpc? |
Returns an interface on the VPC used by the pattern (if any). This may be a VPC created by the pattern or the VPC supplied to the pattern constructor. |
Default settings
Out of the box implementation of the Construct without any override will set the following defaults:
AWS Lambda Function
-
Configure limited privilege access IAM role for Lambda function
-
Enable reusing connections with Keep-Alive for NodeJs Lambda function
-
Enable X-Ray Tracing
-
Set Environment Variables
-
(default) DDB_TABLE_NAME
-
AWS_NODEJS_CONNECTION_REUSE_ENABLED (for Node 10.x and higher functions)
-
Amazon DynamoDB Table
-
Set the billing mode for DynamoDB Table to On-Demand (Pay per request)
-
Enable server-side encryption for DynamoDB Table using AWS managed KMS Key
-
Creates a partition key called "id" for DynamoDB Table
-
Retain the Table when deleting the CloudFormation stack
-
Enable continuous backups and point-in-time recovery
Architecture
Example Lambda Function Implementation
While Solutions Constructs does not publish code for the Lambda function to call DynamoDB, here is a DynamoDB example for CreateTableCommand, PutCommand, GetCommand, DeleteCommand, UpdateCommand, and more: 'example'
Github
Go to the Github repo