Skip to content

Instantly share code, notes, and snippets.

@felipesere
Created October 19, 2015 23:27
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save felipesere/8bfc9202516af7572a59 to your computer and use it in GitHub Desktop.
Save felipesere/8bfc9202516af7572a59 to your computer and use it in GitHub Desktop.
Deploying form Circle-CI to AWS- ECS
#!/bin/bash
aws --version
aws configure set default.region us-west-2
aws configure set default.output json
echo "preparing task definition"
aws ecs describe-task-definition --task-definition applications | ./jq --arg x $CIRCLE_SHA1 ' .taskDefinition
| del(.status)
| del(.taskDefinitionArn)
| del(.revision)
| .containerDefinitions[0].image = ("<DOCKER-REPO>/<DOCKER-IMAGE>:"+$x)' > new-task-definition.json
NEW_REVISION=$(aws ecs register-task-definition --cli-input-json file://new-task-definition.json | ./jq '.taskDefinition.revision')
echo "updating service definition"
aws ecs update-service --cluster <CLUSTER-NAME> --service <SERVICE-NAME> --task-definition "applications:$NEW_REVISION"
@sizebay
Copy link

sizebay commented Jan 29, 2016

Nice job, dude!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment