Home

Awesome

Demo of deploying ECS application using CDK

This repository shows how an asset-based ECS application written in CDK can be deployed, both directly from your developer desktop for testing as well as automatically using a pipeline in production.

Demo written against CDK 0.31.0.

Explanation

The application contains 4 stacks:

Pipeline

The pipeline looks like this:

┌──────────────┐               
│    SOURCE    │               
│              │               
│    GitHub    │               
└──────────────┘               
        │                      
        ├──────────────┐       
        │              │       
        ▽              ▽       
┌──────────────┬──────────────┐
│    BUILD     │    BUILD     │
│              │              │
│ DockerBuild  │   CdkBuild   │
└──────────────┴──────────────┘
        │              │       
        ├──────────────┘       
        │                      
        ▽                      
┌──────────────┐               
│    DEPLOY    │               
│              │               
│  CFN_Deploy  │               
└──────────────┘               

To deploy manually (using asset, for development purposes)

npm run build
npx cdk deploy HttpServiceStack

To deploy using CI/CD

Fork this repository to your own repository, update the repository name in lib/code-pipeline-stack.ts, and deploy the pipeline so:

npm run build
npx cdk deploy CodePipelineStack

NOTE: It would probably be better to parameterize the pipeline source, but this example is simplified somewhat for understandability.