scottcidilabs-deploy
v1.0.1
Published
Deployment module for Cidilabs infrastructure
Downloads
1,030
Readme
ScottiCidiLabs Deploy
A powerful AWS CDK deployment tool with resource management capabilities. This tool simplifies the deployment process by handling AWS resource lookups, secret management, and environment configuration.
Installation
npm install scottcidilabs-deploy
Features
- Automatic AWS resource discovery and configuration
- Secrets management with AWS Secrets Manager
- Environment-specific deployments
- Git branch management
- CDK context handling
- Support for multiple AWS services:
- Application Load Balancer
- ACM Certificates
- EFS File Systems
- RDS Snapshots
- CodeStar Connections
- SNS Topics
- Route53 Hosted Zones
- EC2 AMIs
Usage
Basic usage with command line arguments:
scottcidilabs-deploy --projectName myProject --region us-east-1 --profile myProfile --env-type dev
Using a config file:
scottcidilabs-deploy --config ./my-config.json --profile myProfile --env-type dev
Options: --projectName Project name --region AWS region (default: "us-east-1") --loadBalancerArn Load balancer ARN --acmCertificateArn ACM certificate ARN --efsId EFS ID --efsAccessPointId EFS access point ID --env-type Environment type (required) --config Path to config.json file (default: "config.json") --profile AWS profile (default: "Sandbox") --directory Directory to run the deployment in --command CDK command to run (synth or deploy) (default: "synth") --rds-snapshot-arn RDS snapshot ARN to restore from --gitlab-connection-arn GitLab CodeStar connection ARN
Configuration File (config.json)
Here's a comprehensive example of a configuration file:
{
"projectName": "MyAwesomeProject",
"region": "us-east-1",
"required": [
"loadBalancerArn",
"acmCertArn",
"efsId",
"efsAccessPointId",
"gitlabConnection",
"rdsSnapshotArn",
"snsTopicArn",
"privateHostedZoneName",
"abbyyAmiId"
],
"environments": {
"dev": {
"branch": "develop",
"domain": "dev.example.com",
"readygoDomain": "dev-test.example.com"
},
"staging": {
"branch": "staging",
"domain": "staging.example.com",
"readygoDomain": "staging-test.example.com"
},
"prod": {
"branch": "main",
"domain": "example.com",
"readygoDomain": "test.example.com"
}
},
"secrets": [
{
"name": "my-app/database",
"keys": [
"EXAMPLE_KEY",
"EXAMPLE_KEY_2",
"EXAMPLE_KEY_3"
]
},
{
"name": "my-app/api",
"keys": [
"EXAMPLE_KEY_4",
"EXAMPLE_KEY_5",
"EXAMPLE_KEY_6"
]
}
]
}
Example Deployment Scenarios
1. Basic Development Deployment
scottcidilabs-deploy --projectName myApp --env-type dev --profile myAwsProfile
2. Production Deployment with Config File
scottcidilabs-deploy --config ./config.json --env-type prod --profile production --command deploy
3. Staging Environment with Custom Directory
scottcidilabs-deploy --config ./config.json --env-type staging --profile staging --directory ./cdk
Resource Management
The tool automatically handles:
- Load balancer discovery and listener configuration
- SSL certificate management
- EFS file system and access point setup
- Secret creation and validation
- RDS snapshot selection
- GitLab connection setup
- SNS topic configuration
- Route53 private hosted zone management
- AMI selection
Git Integration
The tool includes Git integration for:
- Automatic branch checkout based on environment
- CDK context management with automatic branch creation
- Context changes version control
Error Handling
The tool provides comprehensive error handling and validation:
- AWS resource validation
- Secret existence and validation
- Environment variable verification
- CDK context validation
Environment Variables
All discovered resources and configurations are automatically set as environment variables for use in your CDK app:
- PROJECT_NAME
- REGION
- ENVIRONMENT_TYPE
- BRANCH_NAME
- DOMAIN_NAME
- LOAD_BALANCER_ARN
- ACM_CERT_ARN
- EFS_ID
- ACCESS_POINT_ID
- GITLAB_CONNECTION_ARN
- RDS_SNAPSHOT_ARN
- SNS_TOPIC_ARN
- PRIVATE_HOSTED_ZONE_NAME
- ABBYY_AMI_ID
License
MIT