The AWS CloudFormation (CloudFormation) template GoCdkStack.template.json contains definitions that you can use to create the following resources:
- An Amazon Simple Storage Service (Amazon S3) bucket
- An Amazon DynamoDB (DynamoDB) table
- An Amazon Simple Notification Service (Amazon SNS) topic
- An Amazon Simple Queue Service (Amazon SQS) queue
In addition, the template creates AWS Lambda (Lambda) functions, in Go, to detect the following events:
- An object uploaded to the Amazon S3 bucket
- An item added to the DynamoDB table
- A message sent to the Amazon SNS topic
- A message sent to the Amazon SQS queue
You can use the AWS Command Line Interface (AWS CLI) to run the CloudFormation template and create the resources. You can get the AWS CLI from here.
To create these resources from this template:
-
Copy the template to your computer.
-
Run the following AWS CLI command to create the resources, where STACK-NAME is the name of the CloudFormation stack to create. It displays the names of the resources when it finishes:
aws cloudformation create-stack --stack-name STACK-NAME --template-body file://GoCdkStack.template.json
If you forget any of the names of the resources, you can use the AWS CLI to get information about the resources created by the resulting CloudFormation template by running the following command, where STACK-NAME is the name of the CloudFormation stack to get information from:
aws cloudformation describe-stacks --stack-name STACK-NAME --query Stacks[0].Outputs --output text
The template was created using the AWS Cloud Development Kit (AWS CDK) project in go_example_lambda. If you want to customize the template, use that AWS CDK project. See the README.md file in that directory for details.
The go_example_lambda project contains Windows batch and Bash script files that you can use to test the Lambda functions. See the README.md file in that project for details.