Top Banner
Container Service in Action
25

AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Jul 18, 2015

Download

Internet

Heitor Vital
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Container Service in Action

Page 2: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Heitor Vital

● Áreas de Atuação o Cloud Computing o Segurança Informação o Jogos o Dispositivos Móveis o …

● Acadêmico o MBA FGV o Mestrado UFPE o Graduação UFPE

br.linkedin.com/in/heitorvital

twitter.com/heitorvital

hvital.blogspot.com.br

labs.siteblindado.com

Page 3: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Antes o mundo era simples 1 Server + LAMP, agora ...

Page 4: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Matrix from Hell

Page 5: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Transporte de carga pré-1960

Page 6: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Solução Transportes

Page 7: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Docker is a shipping container system for code

Docker enables any application and its dependencies to be packaged up as a lightweight, portable, self-sufficient container

Page 8: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Vantagens

● Developers o Inside the box (code) o Build once...run anywhere

● SysAdmins / DevOps o Outside the box (infra) o Configure once...run anything

Page 9: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Virtual Machines X Containers

Page 10: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Segurança

● Ambientes Isolados o Filesystem: root filesystem separado o Resource: cpu e memória isolados via cgroups o Network: namespace próprio, virtual interface e IP próprio

● Isso é suficiente?? o 6 CVEs em 2014 o Relativamente baixo ainda :)

Page 11: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Docker Timeline

● 01/2013 - Projeto interno (dotCloud) ● 03/2013 - PyCon US + Docker 0.1 ● 09/2013 - RedHat + Docker 0.6 ● 01/2014 - $15M Greylock Partners ● 04/2014 - Suporte Elastic Beanstalk ● 09/2014 - $40M Sequoia Capital ● 11/2014 - Suporte ECS (EC2 Container Service)

Page 12: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Docker on AWS

● Configuration & Deployment ● Microservices ● Batch processing

Page 13: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Facilidades

Cluster management Scaling Scheduling Security Extensible

Page 14: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Key Components

● Containers Instances o EC2 Instances o Docker daemon o ECS Agent (connect to clusters)

● Clusters o Grupo de Containers Instances o Pode ser de tipos diferentes o Multi-AZ Support

● Tasks [Definition] o Grupo de containers

relacionados o Executado nos

Containers Instances

● Containers o Docker container o Executor de task

Page 15: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

“Hands-On”

Page 16: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Configurar CLI

Toda execução do Amazon ECS é via AWS CLI. Referência

$  sudo  easy_install  pip  

$  sudo  pip  install  awscli  

$  aws  configure

Page 17: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Create Cluster

$  aws  ecs  create-­‐cluster  -­‐-­‐cluster-­‐name  iMastersCluster  

{          "cluster":  {                  "clusterName":  "iMastersCluster",                    "status":  "ACTIVE",                    "clusterArn":  "arn:aws:ecs:us-­‐east-­‐1:748809930145:cluster/iMastersCluster"          }  }

Page 18: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Create Container Instances

Usar template do CloudFormation de exemplo https://s3.amazonaws.com/amazon-ecs-cloudformation/Amazon_ECS_Quickstart.template

Page 19: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

List Container Instances

$  aws  ecs  list-­‐container-­‐instances  -­‐-­‐cluster  iMastersCluster  

{          "containerInstanceArns":  [                  "arn:aws:ecs:us-­‐east-­‐1:748809930145:container-­‐instance/4b89a26c-­‐a9ea-­‐4149-­‐bb20-­‐ccbb50828860"          ]  }

CUIDADO: Esperar um tempo. Se a lista estiver vazia, esperar mais um pouco!

Page 20: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Register Task Definition

$  aws  ecs  register-­‐task-­‐definition  -­‐-­‐cli-­‐input-­‐json  file://task.json  

{      "containerDefinitions":  [          {              "name":  “sleep",  "image":  “busybox”,  "cpu":  10,              "command":  ["sleep","360"],              "memory":  10,"essential":  true          }      ],      "family":  "sleep360"  }

NOTAS: Aqui não é output do comando. É o conteúdo do arquivo | 1.024 cpu units por core | Mínimo de 4MB RAM por container

Page 21: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

List Task Definitions

$  aws  ecs  list-­‐task-­‐definitions  

{          "taskDefinitionArns":  [                  "arn:aws:ecs:us-­‐east-­‐1:748809930145:task-­‐definition/sleep360:1",                    "arn:aws:ecs:us-­‐east-­‐1:748809930145:task-­‐definition/sleep360:2"          ]  }

Page 22: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Run Task

$  aws  ecs  run-­‐task  -­‐-­‐cluster  iMastersCluster    

                                     -­‐-­‐task-­‐definition  sleep360:1    

                                     -­‐-­‐count  1  

{        //  Output  grande  com  detalhes  da  task  }

NOTAS: Aqui não é output do comando. É o conteúdo do arquivo | 1.024 cpu units por core | Mínimo de 4MB RAM por container

Page 23: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Check running Task

$  aws  ecs  list-­‐tasks  -­‐-­‐cluster  iMastersCluster  

{          "taskArns":  [                  "arn:aws:ecs:us-­‐east-­‐1:748809930145:task/b2fae186-­‐4cdd-­‐4f18-­‐ad1d-­‐e38d637f9c80"          ]  }  

OU  SSH  na  máquina  $  docker  ps  

$  docker  inspect  CONTAINER_ID

Page 24: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

Referências

Ainda teremos muitas novidades em breve. Produto ainda em PREVIEW

1. https://aws.amazon.com/ecs/ 2. http://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html 3. https://aws.amazon.com/blogs/aws/ec2-container-service-in-action/ 4. https://www.youtube.com/watch?v=2vJLS8qfhI0 5. https://www.youtube.com/watch?v=JIuyCgNg8io 6. https://www.youtube.com/watch?v=LE5uBqNp2Ds 7. http://docs.aws.amazon.com/cli/latest/reference/ecs/index.html 8. https://github.com/aws/amazon-ecs-agent 9. https://www.docker.com/ 10.http://www.dockerbook.com/ 11.http://scm.zoomquiet.io/data/20131004215734/index.html

Page 25: AWS EC2 Container Service (ECS) In Action - iMasters Developer Week - Vitoria

OBRIGADO !!br.linkedin.com/in/heitorvital

twitter.com/heitorvital

hvital.blogspot.com.br

labs.siteblindado.com

Heitor Vital