This project is an attempt to completely implement an AWS Fargate cluster from nothing in us-east-1
region
(except the prerequisites noted below).
There are some prerequisites:
- An installation of
bash
and theAWS CLI
. - A registered domain served by AWS Route53 and the associated Hosted Zone ID
- The ARN of an existing AWS Certificate Manager certificate
- A AWS S3 bucket for artifacts
- This repo pushed into a CodeCommit repo called
example
Note: you will need to tweak the following INI files for your own situation before running build-example.sh
:
vpc/config.ini
- configuration for the VPC that will be constuctediam/deploy/config.ini
- configuration for the IAM deploy roleiam/project/config.ini
- configuration for the IAM cluster run roledeployment/code_pipeline/config.ini
- configuration of the CodePipelinedeployment/config/prod.ini
- configuration for the CodePipeline
In the root of the project you will find a build-example.sh
file. When you execute this file
it will ask for the Hosted Zone ID and ACM certificate ARN and place them into SSM. Then
it will do all the needed bits to create deploy the AWS Fargate cluster using CodePipeline
In broad strokes the build-example.sh
file will:
- Ask for the ARN of the ACM certificate and the Route53 zone ID
- Create and activate a python virtual environment in
/tmp
- Install some python tools into the virtual environment, notably Stackility.
- Use Stackility / CloudFormation to create a new VPC.
- Use Stackility / CloudFormation to create a deployment IAM role
- Use Stackility / CloudFormation to create an AWS CodePipeline for the changes to the cluster.
The stack for the CodePipeline will deploy the example.
├── clean.sh # Clean the cruft for a fresh build
├── build-example.sh # Build the example after tweaking the INI files
├── smash-example.sh # Remove all the resources created by build-example.sh
├── deployment
│ ├── build.sh # CodePipeline worker
│ ├── buildspec.yml # CodePipeline description file
│ ├── code_pipeline
│ │ ├── config.ini # CloudFormation parameters for a CodePipeline
│ │ └── template.yml # CloudFormation template for a CodePipeline
│ ├── template.yml # CloudFormation template for Fargate cluster
│ ├── config
│ │ └── prod.ini # CloudFormation parameters for Fargate cluster
│ ├── requirements.txt # List of required Python modules/tools
│ └── verify_unique_version.py # Python script to verify a new vertion
├── docker-image
│ ├── app
│ │ └── example.ini # uWsgi config file for the example application
│ ├── Dockerfile # Definition file for the example Docker image
│ ├── nginx.conf # nginx config file for the example application
│ └── run_example_app.sh # [CMD] script for the Docker image
├── example
│ ├── __init__.py
│ └── service
│ ├── example.py # The Flask application to be deployed in Fargate
│ └── __init__.py
├── iam
│ ├── deploy
│ │ ├── config.ini # CloudFormation parameters for deploy IAM role
│ │ └── template.yml # CloudFormation template for deploy IAM role
│ └── project
│ ├── config.ini # CloudFormation parameters for Fargate app IAM role
│ └── template.yml # CloudFormation template for Fargate app IAM role
├── README.md
├── setup.cfg # Example Python wheel configuration
├── setup.py # Example Python wheel setup module
└── vpc
├── config.ini # CloudFormation parameters for a VPC to hold the app
└── template.yml # CloudFormation template for a VPC to hold the app
v1.0.17