Skip to content

Instantly share code, notes, and snippets.

@Javlopez
Forked from brun0d/ECS101.txt
Created June 14, 2017 01:47
Show Gist options
  • Save Javlopez/3cd48fb2e17c75c30454f713313ee077 to your computer and use it in GitHub Desktop.
Save Javlopez/3cd48fb2e17c75c30454f713313ee077 to your computer and use it in GitHub Desktop.
ECS Docker Friends
Crear Cluster
aws ecs create-cluster --cluster-name cdmx
Listar Clusters
aws ecs list-clusters
Describir el Cluster
aws ecs describe-clusters --clusters cdmx
Eliminar cluster
aws ecs delete-cluster --cluster cdmx
Agregar Instancias al cluster (estar en el folder)
aws ec2 run-instances --image-id ami-62745007 --count 1 --instance-type t2.micro --iam-instance-profile Name=ecsInstanceRole --key-name docker --security-group-ids sg-2c467a45 --user-data file://copy-ecs-config-to-s3
Revisamos la instancia
aws ec2 describe-instance-status --instance-id <id>
Verificamos que este en el cluster
aws ecs list-container-instances --cluster cdmx
Registramos una nueva tarea (en el folder)
aws ecs register-task-definition --cli-input-json file://web-task-definition.json
Listamos las tareas
aws ecs describe-task-definition --task-definition web:1
Ver esqueleto
aws ecs register-task-definition --generate-cli-skeleton
ECR
Login
aws ecr get-login
Crear repo
aws ecr create-repository --repository-name bruno
Ver repos
aws ecr describe-repositories
Anotar url: 384524963431.dkr.ecr.us-east-2.amazonaws.com/bruno
Ver imagenes en un repo
aws ecr list-images --repository-name bruno
Etiquetar imagen:
docker tag nginx:1.9 384524963431.dkr.ecr.us-east-2.amazonaws.com/bruno
Push imagen
docker push xxx.dkr.ecr.us-east-1.amazonaws.com/bruno
Registramos el task de nuevo
aws ecs register-task-definition --cli-input-json file://web-task-definition.json
Ejecutamos la task
aws ecs run-task --cluster cdmx --task-definition web --count 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment