Skip to content

ECS, ALB (ELBv2), RDS and Cloud Formation reference with a small bash script for workflow

License

Notifications You must be signed in to change notification settings

marshyski/ecs-kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ecs-kit

ECS, ALB (ELBv2), RDS and Cloud Formation reference with a small bash script for workflow

Table of contents

  1. bash (Mac or Linux)
  2. aws-cli >=1.11.20

See https://raw.githubusercontent.com/marshyski/ecs-kit/master/userdata.sh

  1. RHEL 7
  2. awscli (Optional)
  3. awslogs agent (Optional)
  4. ecs agent
  • ALB
  • Auto Scaling Group
  • CloudFormation
  • CloudWatch
  • EC2
  • ECS
  • IAM
  • RDS
  • Route53
  • SNS Topic

This assumes you have VPC, Security Groups, IAM Certs, KeyPair, SNS Topic and Route53 Zones created

  1. Create ECS Cluster manually by adding just clicking create cluster and entering name <app name>-<environment>
  2. Create CloudWatch Log Group manually <app name>-<environment>

cft-ecs.json

userdata.sh

  • Enter http proxies in locations if needed
  • Change any logic for app config
  • Add additional installations before systemctl commands

task-definition.json

  • Change path to conf and log
  • Change name from helloworld to app name
  • Change image to location of Docker image
  • Tweak other values as needed

cft-db.json

  • Change ClusterName helloworld-* to <app name>-<environment>
  • Fill out params sections for each environment or just dev to get started

stack

  • Change STACK variable to the app name
  • Update ENVIRONMENT variable with additional environments
$ ./stack

  Stack Name: helloworld

  ./stack create  [dev qa prod] [db] - Create stack from cft-ecs.json
  ./stack delete  [dev qa prod] [db] - Delete stack name helloworld
  ./stack update  [dev qa prod]      - Update stack from version or latest

  you can override latest version for create and update
  ./stack update dev 0.0.1

  Database command example, database will be altered by cft-db.json
  ./stack create dev db
  ./stack delete dev db

  Example
  ./stack create dev db  # Create DB
  ./stack create dev     # Create Web / App Environment

enter image description here

  • Update application version quickly
  • Quicker refresh of EC2 instances with new AMIs
  • Use minimal tools and AWS services for logging, metrics, alarms, etc.
  • Bootstrap microservices to run on EC2 Container Service and Application Load Balancer

About

ECS, ALB (ELBv2), RDS and Cloud Formation reference with a small bash script for workflow

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages