Skip to content

Instantly share code, notes, and snippets.

@felipesere
Created October 19, 2015 23:27
Show Gist options
  • Select an option

  • Save felipesere/8bfc9202516af7572a59 to your computer and use it in GitHub Desktop.

Select an option

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

sizebay commented Jan 29, 2016

Copy link
Copy Markdown

Nice job, dude!

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