Search code examples
amazon-web-servicesaws-cloudformationamazon-ecs

Cloudformation doesn't change back a setting I manually modified


Trying to understand CFs behavior better.

I have a template that defines an ECS service:

  ECSService:
    Type: AWS::ECS::Service
    Properties:
      Cluster: mycluster
      ...
      DesiredCount: 2

I go to the service the CF creates and set the DesiredCount to 0.

Then I deploy the CF template again but it doesn't change back the DesiredCount to 2.

Why doesn't it assert the full config?


Solution

  • The functionality you're looking for is called "Drift Detection".

    This feature is not yet a part of CloudFormation, but it is currently in beta and is a planned release for 2018, according to Amazon.

    It's generally a good practice to not modify resources managed by a Cloudformation stack. If you need to update a resource, perform a stack update.

    Update (11/19): Good news! AWS has released this feature: https://aws.amazon.com/blogs/aws/new-cloudformation-drift-detection/