Wednesday, 14 June 2017

Starting the new ECS task on the ec2 instances using the latest TaskDefinition of EC2 container using bash script

$myecs_securitytoken=$(aws ecr get-authorization-token --region <region_name> --output text --query authorizationData[].authorizationToken) $myecs_securitytoken mytaskdef=$(aws ecs list-task-definitions --family <task_familyname> --sort desc --max-items 1 --query taskDefinitionArns|cut -c75-76) echo $mytaskdef > taskd.out $aws ecs run-task --cluster "<cluster_name>" --task-definition "task_definition_name:cat taskd.out" Docker commands ------------------- Remove all the exited containers: docker rm -v $(docker ps -aq -f status=exited) Remove all the docker images: docker rmi -f $(docker images -q)

No comments:

Post a Comment