Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

AWS Elastic Container Service

850 views

Published on

How create cluster from AWS CLI in ECS

Published in: Technology
  • Login to see the comments

  • Be the first to like this

AWS Elastic Container Service

  1. 1. AWS 
 Elastic Container Service Ladislav Prskavec ladislav@apiary.io Apiary.io
  2. 2. 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)
  3. 3. 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)
  4. 4. Components • Cluster • Container instance • Task definition • Scheduler • Service • Task • Container
  5. 5. 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
  6. 6. Example • AWS Command Line Interface • pip install awscli
  7. 7. Create Cluster $ aws ecs create-cluster 
 --cluster-name meetup-demo
  8. 8. 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
  9. 9. 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
  10. 10. List instances $ aws ecs list-container-instances 
 --cluster meetup-demo
  11. 11. List task definitions $ aws ecs list-task-definitions Register new task $ aws ecs register-task-definition 
 --cli-input-json file://task.json
  12. 12. Create service $ aws ecs create-service 
 --service-name our-demo 
 --task-definition hello_meetup:1 
 --desired-count 1 
 --cluster meetup-demo
  13. 13. List running services $ aws ecs list-services
 --cluster meetup-demo
  14. 14. Describe service $ aws ecs describe-services 
 --services our-demo
 --cluster meetup-demo
  15. 15. Q & A ladislav@apiary.io

×