aws elastic container service
TRANSCRIPT
Who am I?• Site Reliability Engineer (SRE) since 2015
• DevOp since 2014
• Developer since 2005 (PHP, Ruby, NodeJS)
• Webmaster 1995-2005
• Lector and Speaker about Developers Tools (Version Control Systems, CIE, CD)
AWS ECS• Amazon EC2 Container Service (ECS) is a highly
scalable, high performance container management service that supports Docker containers and allows you to easily run applications on a managed cluster of Amazon EC2 instances. Amazon ECS eliminates the need for you to install, operate, and scale your own cluster management infrastructure.
• Pricing: free (pay for EBS, EC2, ELB)
Components• Cluster
• Container instance
• Task definition
• Scheduler
• Service
• Task
• Container
Task Definitions• docker image
• CPU, Memory for container
• Links
• Ports
• Service, Task
• Environment properties
• Data Volumes Support for docker-compose was announced at DockerCon’15
Example
• AWS Command Line Interface
• pip install awscli
Create Cluster
$ aws ecs create-cluster \ --cluster-name meetup-demo
Run Instances
$ aws ecs run-instances \ --image-id ami-d0b9acb8 --count 1 --instance-type t2.small --key-name mykeys --security-group-ids sg-91d1f1ff --iam-instance-profile \ Name=ecsInstanceRole --subnet-id subnet-61f1cffd --user-data file://cluster_setup
Cluster setup file
$ cat cluster_setup#!/bin/bash
yum install -y aws-cli
aws s3 cp s3://my-ecs-config/ecs.config /etc/ecs/ecs.config
echo ECS_CLUSTER=meetup-demo >> /etc/ecs/ecs.config
List instances
$ aws ecs list-container-instances \ --cluster meetup-demo
List task definitions
$ aws ecs list-task-definitions
Register new task
$ aws ecs register-task-definition --cli-input-json file://task.json
Create service
$ aws ecs create-service --service-name our-demo --task-definition hello_meetup:1 --desired-count 1 --cluster meetup-demo
List running services
$ aws ecs list-services --cluster meetup-demo
Describe service
$ aws ecs describe-services --services our-demo --cluster meetup-demo