Create an ECS Microservices stack with built-in CI/CD for your Infrastructure and Code.
With every code push your Infrastructure will be updated.
With every code push a new version of your Service will be built, tested, and deployed (optional).
There are two environments sandbox
and prod
. This makes it easy to test Infrastructure and Code changes before pushing to prod.
- sandbox ->
development
Git branch - prod ->
master
Git branch
Sandbox builds are pushed live automatically.
Production builds are pushed manually by updating the Infrastructure.
Build notifications and Deployment notifications are sent either as an email, a sms message, and/or a Slack message.
- Fork and clone this repo.
- Fork and clone the service1-stack-cicd
- Install CIM (CloudFormation Utility)
- Install the kms stack.
- Create an EC2 keypair.
- Install the bootstrap.stack.yml stack.
In order to protect your configuration secrets like your GitHub token we need to create a KMS key first.
You can use the CloudFormation script in kms or just create it via the console.
Use the console to create an EC2 keypair for all your EC2 instances.
Create the bootstrap.stack.yml stack.
First update _cim.yml with your GitHub information and your EC2 keypair.
Also take a look at the vpc parameters. You might need to change the AvailabilityZones.
This stack will build 2 pipelines:
- Prod (master branch)
- Sandbox (develop branch)
Each pipeline will execute the following steps every time you commit changes to this repo:
- Create/Update the stacks/notifications/notifications.stack.json stack.
- Create/Update the stacks/vpc/vpc.stack.json stack.
- Create/Update the stacks/ecs.stack.yml stack.
- Create/Update the stacks/service1.stack.yml stack.
- Create/Update the stacks/service2.stack.yml stack.
The stacks/service1.stack.yml stack creates a pipeline that updates the infrastructure and code found in this repo: service1-stack-cicd.
You will want to create your own service implementations. You can create one or more services. You can use this project as a template: service1-stack-cicd.