Reputation: 11329
I'm currently trying to automate our dev process using CodePipeline. My docker application fetches from the Source(Github) -> Builds(AWS CodeBuild) -> Deploy. In the final deployment process, I'm having trouble revising my task definition and restarting my cluster tasks. I understand that I need a CloudFormation template to perform these actions, but there isn't much documentation on how I can accomplish the deployment process by using CloudFormation(revising my task definition and updating my tasks). Could there be another way to autonomously deploy my containers via AWS?
Upvotes: 0
Views: 231
Reputation: 11329
After trial and error with different methods, the best way to update your ECS Task Definitions and service is to directly update them through the AWS CLI in your post_build section of your buildspec.yml through AWS CodeBuild. You can even use the environment variable that is set using the commit ID to keep track of the tag of each images!
Upvotes: 1
Reputation: 2545
For the scenario that you described, you may want to try this sample https://github.com/awslabs/ecs-refarch-continuous-deployment
Upvotes: 0
Reputation: 306
If you deployed your original service from CloudFormation then CloudFormation makes it incredibly easy to deploy a new Task Definition onto ECS.
Here is a good starter for how CloudFormation will deploy services for you onto the EC2 Container Service: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-ecs.html
Once you have it all deployed from CloudFormation you have 2 options for the deployment: 1) Update the CloudFormation template with the new deployment pieces that you need and it will create a change set for you and update your stack. 2) Only use CloudFormation to deploy the service and put the task definition as a parameter. This will allow you to just modify the inputs to the stack instead of updating the entire thing every time.
CloudFormation will automatically try and do a blue/green deployment for you when you update it within the stack.
Upvotes: 0