This is a CDK 2 project in Go. I used it in one brown-bag session to introduce CDK to an engineering organisation.
Using CDK with Go - a recent brown bag talk and some thoughts
cdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation templatego test
run unit tests
- requires node.js
- install CDK globally:
npm i -g cdk
or usenpx cdk ...
- we use CDK 2:
cdk --version
mkdir project-name && cd project-name
- init CDK project in Go:
npx cdk init --language go
- evaluate
cdk.json
- default deployment:
npx cdk deploy
- refine CloudFormation stack properties: name, tags
- define s3 bucket
- refine s3 bucket properties: encryption, bucket policy
- define lambda function
- define S3 event source to invoke lambda function
- define DynamoDB table
- grant lambda function permissions to access S3 bucket and DynamoDB table