This CloudFormation template deploys an AWS Lambda function, Amazon DynamoDB table, Amazon CloudWatch Logs log group, and all IAM roles with the minimum necessary permissions.
The Lambda function itself inserts a random 10-character alphabetic string into the DynamoDB table whenever it's invoked. The function also makes use of the logging library to display relevant output.
This project is intended to act as a boilerplate to reduce the development effort of deploying a Python Lambda function with CloudFormation. It also exposes Lambda environment variables through CloudFormation parameters. Please fork this repo and customize the Lambda function and other services to meet your needs.
- An AWS account
- Access to the AWS console or AWS CLI. I recommend using AWS CloudShell for easy CLI access.
You can deploy the template base-cfn-lambda.yml using the console, or use the AWS CLI, as detailed here.
-
Check the 'Outputs' section of the CloudFormation console to get the CLI command that will invoke the Lambda function.
-
If you're using CloudShell, the terminal and command from the CloudFormation console will look like below.
- You can view more details about the command output by running
jq . lambda-output.txt, as shown below.
-
After the Lambda was invoked, navigate to DynamoDB using the console and check the DynamoDB table to verify that the new random value added.
-
Under the 'Resources' section of the CloudFormation console, navigate to the newly-created CloudWatch Logs log group to see the output from the Lambda function.
- When you're done experimenting with this, delete the CloudFormation stack by using the console. Navigate to CloudFormation > Stacks > Choose the stack you deployed > Select Delete
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.

