(AWS Infrastructure – Cloud Development Kit)
- Manage AWS resources with CDK and TypeScript (or) Manages your entire AWS infrastructure using CDK in TypeScript.
- Ideal for defining VPCs, EC2, IAM roles, S3, Cognito—all in code.
- Purpose: scalable, reusable, strongly typed infrastructure-as-code.
- Node.js v18 or later
- npm v9 or later
- AWS CLI installed
- AWS credentials configured
- Git installed
Clone the repo
git clone https://github.com/maheshmuttintidev/aws-infra-cdk.git
cd aws-infra-cdk
Install dependencies
npm install
Create a .env
file in project root
CDK_DEFAULT_ACCOUNT=123456789012
CDK_DEFAULT_REGION=us-east-1
DOMAIN_NAME=your-real-domain.com
EC2_KEY_NAME=my-key-pair
COGNITO_CUSTOM_DOMAIN=auth.your-real-domain.com
CERTIFICATE_ARN=arn:aws:acm:us-east-1:123456789012:certificate/abc123
ALARM_TOPIC_ARN=arn:aws:sns:us-east-1:123456789012:my-alarm-topic
BUCKET_NAME=my-data-bucket
LOG_BUCKET_NAME=my-log-bucket
Set CDK context in cdk.json
if needed
{
"app": "npx ts-node --prefer-tsconfig lib/aws-infra-cdk-stack.ts",
"context": {
"@aws-cdk/core:enableStackNameDuplicates": true,
"aws-cdk:enableDiffNoFail": true
},
"watch": {
"include": ["lib/**/*.ts", "test/**/*.ts"],
"exclude": ["node_modules", "cdk.out"]
},
"test": "jest",
"requireApproval": "never"
}
Compile TypeScript
npm run build
Lint code
npm run lint
Auto fix and remove unused imports
npm run lint:fix
Format code
npm run format
Run unit tests
npm test
Prepare your AWS environment
npm run cdk:bootstrap
Preview changes
npm run cdk:diff
Deploy stack
npm run cdk:deploy
Remove stack
cdk destroy
npm run build
npm run watch
npm run lint
npm run lint:fix
npm run format
npm test
npm run cdk:bootstrap
npm run cdk:deploy
npm run cdk:diff
npm run init:infra
bin/
entry pointlib/
CDK stack and constructstest/
unit tests.github/workflows
CI config
- Fork the repo
- Create feature branch
- Run tests and lint
- Open pull request