Giter Club home page Giter Club logo

cdk-ecs-demo's Introduction

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:

  • ClusterStack: a stack with a VPC and an ECS cluster, needs to be manually deployed (that is not a best practice, but it is the current state of this example).
  • HttpServiceStack: a development instance of the stack defining the ECS service. This stack uses an AssetImage, meaning it will build and push the ECS image in the repository when deployed.
  • ProdHttpServiceStack: a production instance of the stack defining the ECS service. This stack takes the Docker image as a pipeline input, to be supplied at deployment time.
  • CodePipelineStack: a stack defining an ECR repository and a CodePipeline which will build both the CDK app and the Docker image, then finally deploy the combination through CloudFormation.

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.

cdk-ecs-demo's People

Contributors

rix0rrr avatar skinny85 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.