https://github.com/msfidelis/ecs-pipeline
:cloud: :whale: :zap: :rocket: Create environment and deployment pipelines to ECS Fargate with CodePipeline, CodeBuild and Github using Terraform
https://github.com/msfidelis/ecs-pipeline
aws codebuild codepipeline devops docker ecr ecs ecs-cluster fargate terraform
Last synced: 2 months ago
JSON representation
:cloud: :whale: :zap: :rocket: Create environment and deployment pipelines to ECS Fargate with CodePipeline, CodeBuild and Github using Terraform
- Host: GitHub
- URL: https://github.com/msfidelis/ecs-pipeline
- Owner: msfidelis
- License: mit
- Created: 2018-04-06T13:59:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-06T14:56:19.000Z (about 5 years ago)
- Last Synced: 2025-04-14T19:43:42.867Z (6 months ago)
- Topics: aws, codebuild, codepipeline, devops, docker, ecr, ecs, ecs-cluster, fargate, terraform
- Language: HCL
- Homepage:
- Size: 16.9 MB
- Stars: 117
- Watchers: 7
- Forks: 46
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ECS Simple Pipeline - Easy way to deploy Containers on AWS
Create environment and deployment pipelines using ECS, ECR, CodePipeline and Git with Terraform## Check this repo if you need to ship more services to production - [ECS Microservices Orchestration](https://github.com/msfidelis/ecs-microservices-orchestration)
## Architecture

## Deploy Pipeline

# How to Deploy
## Edit your preferences
Edit `variables.tf` file to customize application preferences like Github account, repo and owner, Load Balancer ports and cluster preferences.
```hcl
# Customize the Cluster Name
variable "cluster_name" {
description = "ECS Cluster Name"
default = "web-app"
}# Customize your ECR Registry Name
variable "app_repository_name" {
description = "ECR Repository Name"
default = "web-app"
}###### APPLICATION OPTIONS ######
variable "container_name" {
description = "Container app name"
default = "micro-api"
}
```Edit the Github preferences in the same file to specify infos like repo, owner or organization, branches e etc.
```hcl
# Github Repository Owner
variable "git_repository_owner" {
description = "Github Repository Owner"
default = "msfidelis"
}# Github Repository Project Name
variable "git_repository_name" {
description = "Project name on Github"
default = "micro-api"
}# Default Branch
variable "git_repository_branch" {
description = "Github Project Branch"
default = "master"
}
```## Edit Auto Scaling Metrics
```hcl
# Number of containers
variable "desired_tasks" {
description = "Number of containers desired to run app task"
default = 2
}variable "min_tasks" {
description = "Minimum"
default = 2
}variable "max_tasks" {
description = "Maximum"
default = 4
}variable "cpu_to_scale_up" {
description = "CPU % to Scale Up the number of containers"
default = 80
}variable "cpu_to_scale_down" {
description = "CPU % to Scale Down the number of containers"
default = 30
}
```## Edit your Build steps
This demo build, dockerize and deploy a simple Node.JS application. Customize your build steps on `modules/pipeline/templates/buildspec.yml` file.
## How to Deploy
### 1) Github Access Token
* Create your Github Access Token to Command Line. [This link have all information about this](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
* Export Github Token as an environment variable.
```bash
export GITHUB_TOKEN=YOUR_TOKEN
```### 2) Terraform
* Initialize Terraform
```bash
terraform init
```* Plan our modifications
```bash
terraform plan
```* Apply the changes on AWS
```bash
terraform apply
```#### References
* [Easy deploy your Docker applications to AWS using ECS and Fargate](https://thecode.pub/easy-deploy-your-docker-applications-to-aws-using-ecs-and-fargate-a988a1cc842f)
* [ECS Terraform - By alex](https://github.com/alex/ecs-terraform)
* [Terraform-ECS by arminc](https://github.com/arminc/terraform-ecs)