Adds an AWS::ECS::CapacityProvider, makes it the default capacity provider for the mc ECS Cluster, and makes it the capacity provider for the mc ECS Service. See also note [1] below.
ASG MaxSize and MinSize are now hard-set to 1/0 - these shouldn't need to change with Running/Stopped state, only the DesiredCapacity should change.
Desired Outcome
Existing Running / Stopped behaviour should remain unaltered.
Now, if you should manually or auto-scale the mc ECS Service, the ASG should scale to match, with some delay. So if Desired Tasks in the ECS Service transitions 1->0, the Capacity Provider's alarms and the ASG will after 15 minutes or so also scale from 1 to 0 instances running, so scale to zero cost. If you later scale the ECS Service back 0->1 Desired, after a minute or so the Capacity Provider auto scale alarms will trigger the ASG to start an instance, and the pending task will deploy.
This isn't a huge benefit on its own, but it seems to deploy the ASG with the capacity provider as-designed. It will also allow the scale of the ECS Service itself to control the ASG, which is currently running as capacity only, without scaling rules.
[1]: Originally I thought to only link the capacity provider to the cluster, and allow the service to pick it up by-default, which is what the documentation suggests should happen. This was not working for me - I suspected a timing issue or need for an explicit DependsOn in the cf template - instead I elected to make the service/capacity-provider link explicit, which is probably better anyway.
Changes
AWS::ECS::CapacityProvider
, makes it the default capacity provider for the mc ECS Cluster, and makes it the capacity provider for the mc ECS Service. See also note [1] below.MaxSize
andMinSize
are now hard-set to 1/0 - these shouldn't need to change with Running/Stopped state, only theDesiredCapacity
should change.Desired Outcome
Running
/Stopped
behaviour should remain unaltered.This isn't a huge benefit on its own, but it seems to deploy the ASG with the capacity provider as-designed. It will also allow the scale of the ECS Service itself to control the ASG, which is currently running as capacity only, without scaling rules.
[1]: Originally I thought to only link the capacity provider to the cluster, and allow the service to pick it up by-default, which is what the documentation suggests should happen. This was not working for me - I suspected a timing issue or need for an explicit
DependsOn
in the cf template - instead I elected to make the service/capacity-provider link explicit, which is probably better anyway.