简体   繁体   中英

Should I update ecs service through CloudFormation or ecs directly

I want to create a CI/CD pipeline for deploying micro-services using AWS ECS.

Everything is ok until new image uploaded to ECR (trigger build new Docker image when new code is committed, pushes new Docker image to ECR).

The next step is i need to update service with new Docker image, then i have to options:

  1. Update CloudFormation for ecs(which i need to design 1 stack contain only ecs infrastructure for each mirco-service)
  2. Update ecs serivce directly via update-service cli

Which approach should i choose?

Updated: At the first, i prefer the option 1, it have advantages like:

  • Rollback if deployment failed
  • Avoid dirty data (compare with direct update resource)

But the thing i concern is only one stack for each ecs infrastucture, this will create many stacks, does this lead too hard to manage stacks?

Thank all!!

If you are using IaC such as CDK or CFN to manage resources then it is always suggested to make updates to those resources via IaC. Making updates directly to the resources could cause your stack to drift and cause you bother in the long term.

The best practice is to always use CloudFormation or CDK.

You can see version history to track changes. You can do auto rollbacks if there are any deployment issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM