This project is a small Infrastructure as Code (IaC) example built with the AWS Cloud Development Kit (CDK) using Go.
It defines and deploys a DynamoDB table using AWS CDK constructs, demonstrating how cloud resources can be created programmatically instead of manually in the AWS console.
- Defines an AWS CDK stack in Go
- Creates a DynamoDB table
- Uses on-demand (pay-per-request) billing
- Synthesizes the CloudFormation template via CDK
The project focuses only on table creation to keep the example simple and easy to understand.
This project was built to practice:
- Infrastructure as Code (IaC) concepts
- Using AWS CDK with Go
- Defining AWS resources programmatically
- Creating DynamoDB tables with best-practice defaults
It demonstrates how application developers can manage cloud infrastructure alongside application code.
cdk-dynamodb-table
├── main/
│ └── main.go # CDK app entry point
├── cdktable.go # Stack definition and DynamoDB table
├── cdktable_test.go # Basic CDK test
├── cdk.json # CDK configuration
├── cdk.context.json # CDK context data
├── cdk.out/ # Synthesized CloudFormation output
├── stacks.csv # Stack name reference
├── go.mod
└── go.sum
The stack creates a DynamoDB table with the following settings:
- Table name:
barjokes-cdk - Partition key:
NAME(string) - Billing mode: Pay-per-request (on-demand)
This configuration avoids capacity planning and is suitable for variable or unpredictable workloads.
- The CDK app is initialized in
main.go - A stack is defined in
cdktable.go - The DynamoDB table is created using CDK constructs
cdk synthgenerates a CloudFormation templatecdk deploycan be used to deploy the stack to AWS
- Go installed
- AWS CDK installed
- AWS credentials configured locally
Synthesize the CloudFormation template:
cdk synthDeploy the stack:
cdk deploy- The AWS environment (account and region) can be configured in
main.go - This project focuses on infrastructure definition, not application logic
- The example is intentionally minimal for learning purposes
This project is intentionally small.
It is meant to demonstrate:
- Infrastructure as Code using AWS CDK
- DynamoDB table creation
- Go-based cloud infrastructure definitions
It is not intended to be a full production infrastructure setup.