All Projects → openfresh → Ecs Formation

openfresh / Ecs Formation

Licence: mit
Tool to build Docker cluster composition for Amazon EC2 Container Service(ECS)

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Ecs Formation

Aws Scalable Big Blue Button Example
Demonstration of how to deploy a scalable video conference solution based on Big Blue Button
Stars: ✭ 29 (-74.56%)
Mutual labels:  aws, ecs, ec2, autoscaling
Ecs Refarch Continuous Deployment
ECS Reference Architecture for creating a flexible and scalable deployment pipeline to Amazon ECS using AWS CodePipeline
Stars: ✭ 776 (+580.7%)
Mutual labels:  aws, ecs, ec2, devops
Cipi
An Open Source Control Panel for your Cloud! Deploy and manage LEMP apps in one click!
Stars: ✭ 376 (+229.82%)
Mutual labels:  aws, devops, deployment
Aws Deployment Framework
The AWS Deployment Framework (ADF) is an extensive and flexible framework to manage and deploy resources across multiple AWS accounts and regions based on AWS Organizations.
Stars: ✭ 374 (+228.07%)
Mutual labels:  aws, devops, deployment
Awstaghelper
AWS bulk tagging tool
Stars: ✭ 98 (-14.04%)
Mutual labels:  aws, ec2, devops
Ecs Pipeline
☁️ 🐳 ⚡️ 🚀 Create environment and deployment pipelines to ECS Fargate with CodePipeline, CodeBuild and Github using Terraform
Stars: ✭ 85 (-25.44%)
Mutual labels:  aws, ecs, devops
Cdk Constructs
A collection of higher-level aws cdk constructs: slack-approval-workflow, #slack & msteams notifications, chatops, blue-green-container-deployment, codecommit-backup, OWASP dependency-check, contentful-webhook, github-webhook, stripe-webhook, static-website, pull-request-check, pull-request-approval-rule, codepipeline-merge-action, codepipeline-check-parameter-action...
Stars: ✭ 282 (+147.37%)
Mutual labels:  aws, ecs, devops
Aws Workflows On Github
Workflows for automation of AWS services setup from Github CI/CD
Stars: ✭ 95 (-16.67%)
Mutual labels:  aws, ecs, ec2
Awsssmchaosrunner
Amazon's light-weight library for chaos engineering on AWS. It can be used for EC2, ECS (with EC2 launch type) and Fargate.
Stars: ✭ 214 (+87.72%)
Mutual labels:  aws, ecs, ec2
Touchdown
Cloud service orchestration framework for python
Stars: ✭ 10 (-91.23%)
Mutual labels:  aws, devops, deployment
Aegea
Amazon Web Services Operator Interface
Stars: ✭ 51 (-55.26%)
Mutual labels:  aws, ecs, ec2
Awesome Aws
A curated list of awesome Amazon Web Services (AWS) libraries, open source repos, guides, blogs, and other resources. Featuring the Fiery Meter of AWSome.
Stars: ✭ 9,895 (+8579.82%)
Mutual labels:  aws, ecs, ec2
ecs-autoscale
A framework that runs on AWS Lambda for autoscaling ECS clusters and services
Stars: ✭ 69 (-39.47%)
Mutual labels:  ec2, ecs, autoscaling
Adapt
ReactJS for your infrastructure. Create and deploy full-stack apps to any infrastructure using the power of React.
Stars: ✭ 317 (+178.07%)
Mutual labels:  aws, devops, deployment
Ecspresso
ecspresso is a deployment tool for Amazon ECS
Stars: ✭ 242 (+112.28%)
Mutual labels:  aws, ecs, deployment
Ecs Deploy
Powerful CLI tool to simplify Amazon ECS deployments, rollbacks & scaling
Stars: ✭ 541 (+374.56%)
Mutual labels:  aws, ecs, deployment
Autospotting
Saves up to 90% of AWS EC2 costs by automating the use of spot instances on existing AutoScaling groups. Installs in minutes using CloudFormation or Terraform. Convenient to deploy at scale using StackSets. Uses tagging to avoid launch configuration changes. Automated spot termination handling. Reliable fallback to on-demand instances.
Stars: ✭ 2,014 (+1666.67%)
Mutual labels:  aws, ec2, autoscaling
Aws Ec2 Assign Elastic Ip
Automatically assign Elastic IPs to AWS EC2 Auto Scaling Group instances
Stars: ✭ 172 (+50.88%)
Mutual labels:  aws, ec2, autoscaling
Terraform Ecs Autoscale Alb
ECS cluster with instance and service autoscaling configured and running behind an ALB with path based routing set up
Stars: ✭ 60 (-47.37%)
Mutual labels:  aws, ecs, autoscaling
Terraform Aws Alb
Terraform module to provision a standard ALB for HTTP/HTTP traffic
Stars: ✭ 53 (-53.51%)
Mutual labels:  aws, ecs, ec2

ecs-formation

Circle CI Language issues License: MIT

ecs-formation is a tool for defining several Docker continers and clusters on Amazon EC2 Container Service(ECS).

Features

  • Define services on ECS cluster, and Task Definitions.
  • Supports YAML definition like docker-compose. Be able to run ecs-formation if copy docker-compose.yml(formerly fig.yml).
  • Manage ECS Services and Task Definitions by AWS API.
  • Support ELB(Classic Load Balancer) and ALB(Application Load Balancer)
  • Service Auto Scaling
  • Task Placement Policy

Usage

Setup

Installation

ecs-formation is written by Go. Please run go get.

$ go get github.com/openfresh/ecs-formation

Define environment variables

ecs-formation use cobra. It supports yaml configuration.

Prepare ~/.ecs-formation.yaml for project configuration.

project_dir: ~/your_project_dir/
aws_region: us-east-1

ecs-formation requires environment variables to run, as follows.

  • AWS_ACCESS_KEY: AWS access key
  • AWS_SECRET_ACCESS_KEY: AWS secret access key
  • AWS_REGION: Target AWS region name

Make working directory

Make working directory for ecs-formation. This working directory should be managed by Git.

$ mkdir -p path-to-path/test-ecs-formation
$ mkdir -p path-to-path/test-ecs-formation/task
$ mkdir -p path-to-path/test-ecs-formation/service
$ mkdir -p path-to-path/test-ecs-formation/bluegreen

Manage Task Definition and Services

Make ECS Cluster

You need to create ECS cluster in advance. And also, ECS instance must be join in ECS cluster.

Define Task Definitions

Make Task Definitions file in task directory. This file name is used as ECS Task Definition name.

(path-to-path/test-ecs-formation/task) $ vim test-definition.yml
nginx:
  image: nginx:latest
  ports:
    - 80:80
  environment:
    PARAM1: value1
    PARAM2: value2
  links:
    - api
  memory_reservation: 256
  cpu_units: 512
  essential: true

api:
  image: your_namespace/your-api:latest
  ports:
    - 8080:8080
  memory: 1024
  cpu_units: 1024
  essential: true
  links:
    - redis

redis:
  image: redis:latest
  ports:
    - 6379:6379
  memory: 512
  cpu_units: 512
  essential: true

Define Services on Cluster

Make Service Definition file in cluster directory. This file name must be equal ECS cluster name.

For example, if target cluster name is test-cluster, you need to make test-cluster.yml.

(path-to-path/test-ecs-formation/service) $ vim test-cluster.yml
test-service:
  task_definition: test-definition
  desired_count: 1
  role: your-ecs-elb-role
  load_balancers:
    -
      name: test-elb
      container_name: nginx
      container_port: 80
  autoscaling:
    target:
      min_capacity: 0
      max_capacity: 1
      role: arn:aws:iam::your_account_id:role/ecsAutoscaleRole

In case of ALB, you should specify target_group_arn.

(path-to-path/test-ecs-formation/service) $ vim test-cluster.yml
test-service:
  task_definition: test-definition
  desired_count: 1
  role: your-ecs-elb-role
  load_balancers:
    -
      target_group_arn: test-target-group-arn
      container_name: nginx
      container_port: 80

Keep desired_count at updating service

If you modify value of desired_count by AWS Management Console or aws-cli, you'll fear override value of desired_count by ecs-formation. This value should be flexibly changed in the operation.

If keep_desired_count is true, keep current desired_count at updating service.

(path-to-path/test-ecs-formation/service) $ vim test-cluster.yml
test-service:
  task_definition: test-definition
  desired_count: 1
  keep_desired_count: true

Task Placement Policy

Supports placement_constraints and placement_strategy. If you update these options, it's necessary to rebuild service once.

(path-to-path/test-ecs-formation/service) $ vim test-cluster.yml
test-service:   
  task_definition: test-definition
  desired_count: 1
  keep_desired_count: true
  placement_constraints:
    - type: memberOf
      expression: "attribute:ecs.instance-type =~ t2.*"
  placement_strategy:
    - type: spread
      field: "attribute:ecs.availability-zone"

Manage Task Definitions

Show update plan.

(path-to-path/test-ecs-formation $ ecs-formation task plan --all
(path-to-path/test-ecs-formation $ ecs-formation task plan -t test_definition

Apply all definition.

(path-to-path/test-ecs-formation $ ecs-formation task apply --all
(path-to-path/test-ecs-formation $ ecs-formation task apply -t test_definition

Manage Services on Cluster

Show update plan. Required cluster.

(path-to-path/test-ecs-formation $ ecs-formation service plan -c test-cluster --all

Apply all services.

(path-to-path/test-ecs-formation $ ecs-formation service apply -c test-cluster --all

Specify cluster and service.

(path-to-path/test-ecs-formation $ ecs-formation service apply -c test-cluster -s test-service

Blue Green Deployment

ecs-formation supports blue-green deployment.

Requirements on ecs-formation

  • Requires two ECS cluster. Blue and Green.
  • Requires two ELB. Primary ELB and Standby ELB.
  • ECS cluster should be built by EC2 Autoscaling group.

Define Blue Green Deployment

Make management file of Blue Green Deployment file in bluegreen directory.

(path-to-path/test-ecs-formation/bluegreen) $ vim test-bluegreen.yml
blue:
  cluster: test-blue
  service: test-service
  autoscaling_group: test-blue-asg
green:
  cluster: test-green
  service: test-service
  autoscaling_group: test-green-asg
primary_elb: test-elb-primary
standby_elb: test-elb-standby

Show blue green deployment plan.

(path-to-path/test-ecs-formation $ ecs-formation bluegreen plan

Apply blue green deployment.

(path-to-path/test-ecs-formation $ ecs-formation bluegreen apply -g test-bluegreen

if with --nodeploy option, not update services. Only swap ELB on blue and green groups.

(path-to-path/test-ecs-formation $ ecs-formation bluegreen apply --nodeploy -g test-bluegreen

If autoscaling group have several different classic ELB, you should specify array property of chain_elb. ecs-formation can swap chain_elb ELB group with main ELB group at the same time.

(path-to-path/test-ecs-formation/bluegreen) $ vim test-bluegreen.yml
blue:
  cluster: test-blue
  service: test-service
  autoscaling_group: test-blue-asg
green:
  cluster: test-green
  service: test-service
  autoscaling_group: test-green-asg
primary_elb: test-elb-primary
standby_elb: test-elb-standby
chain_elb:
  - primary_elb: test-internal-elb-primary
    standby_elb: test-internal-elb-standby

In case of ALB(Application Load Balancer), as follows.

(path-to-path/test-ecs-formation/bluegreen) $ vim test-bluegreen.yml
blue:
  cluster: test-blue
  service: test-service
  autoscaling_group: test-blue-asg
green:
  cluster: test-green
  service: test-service
  autoscaling_group: test-green-asg
elbv2:
  target_groups:
    - primary_group: test-internal-primary
      standby_group: test-internal-default

Others

Passing custom parameters

You can use custom parameters. Define parameters in yaml file(task, service, bluegreen) as follows.

nginx:
    image: openfresh/nginx:${NGINX_VERSION}
    ports:
        - 80:${NGINX_PORT}

You can set value for these parameters by using -p option.

ecs-formation task -p NGINX_VERSION=1.0 -p NGINX_PORT=80 plan -t your-web-task

Also, support default parameter value.

nginx:
    image: openfresh/nginx:${NGINX_VERSION|latest}
    ports:
        - 80:${NGINX_PORT|80}

env_file

You can use env_file like docker-compose. https://docs.docker.com/compose/compose-file/#env-file

nginx:
    image: openfresh/nginx:${NGINX_VERSION}
    ports:
        - 80:${NGINX_PORT}
    env_file:
        - ./test1.env
        - ../test2.env

License

See LICENSE.

Copyright © FRESH!. All Rights Reserved.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].