AWS CDK infrastructure for Cal.com application database.
This project provisions the following AWS resources:
- VPC with public, private, and isolated subnets across 2 availability zones
- RDS PostgreSQL 15.4 database instance (t3.micro)
- AWS Secrets Manager secret for database credentials
- Security Groups for database access control
- Node.js 18+ and npm
- AWS CLI configured with credentials
- AWS CDK CLI installed (
npm install -g aws-cdk)
- Install dependencies:
npm install- Bootstrap CDK (first time only):
npx cdk bootstrapDeploy the infrastructure:
npx cdk deployThe deployment will output:
- Database endpoint address
- Database port
- Database name
- Secret ARN and name for credentials
- VPC ID
After deployment, retrieve the database credentials:
aws secretsmanager get-secret-value \
--secret-id calcom-db-credentials \
--query SecretString \
--output text | jq -r '.'Or use the helper script:
npm run get-credentialsConnect to the database using the credentials from Secrets Manager:
# Get credentials
SECRET=$(aws secretsmanager get-secret-value --secret-id calcom-db-credentials --query SecretString --output text)
USERNAME=$(echo $SECRET | jq -r '.username')
PASSWORD=$(echo $SECRET | jq -r '.password')
ENDPOINT=$(aws cloudformation describe-stacks --stack-name CalComInfrastructureStack --query 'Stacks[0].Outputs[?OutputKey==`DBEndpoint`].OutputValue' --output text)
# Connection string
echo "postgresql://$USERNAME:$PASSWORD@$ENDPOINT:5432/calcom"- Engine: PostgreSQL 15.4
- Instance Type: t3.micro
- Storage: 20GB GP3 (auto-scaling up to 100GB)
- Backup Retention: 7 days
- Multi-AZ: Disabled (for cost optimization)
- Public Access: Disabled (private subnet only)
- Database is deployed in isolated subnets
- Access restricted to VPC CIDR block
- Credentials stored in AWS Secrets Manager
- Automatic credential rotation supported
npm run build- Compile TypeScript to JavaScriptnpm run watch- Watch for changes and compilenpm run test- Run Jest unit testsnpx cdk deploy- Deploy stack to AWSnpx cdk diff- Compare deployed stack with current statenpx cdk synth- Emit synthesized CloudFormation templatenpx cdk destroy- Remove all resources from AWS
The infrastructure uses cost-optimized settings:
- t3.micro instance (eligible for free tier)
- Single NAT Gateway
- Single AZ deployment
- GP3 storage
Estimated monthly cost: ~$15-25 USD (excluding free tier)
To remove all resources:
npx cdk destroyNote: Database snapshots will be retained due to SNAPSHOT removal policy.