ECS Capacity providers best practices
I am researching best practices when implementing Capacity Providers for ECS Clusters. One of the AWS reference videos recommends the usage of one Auto-Scaling Group / Capacity Provider per AZ. What is the main benefit of this recommendation other than distributing tasks at the capacity provider level ? Are there any other best practices to be aware of when implementing Capacity Providers ?
When you define an AutoScaling group, given that you can choose the subnets in which the group will evolve, it will ipso facto define which AZs you will be running into.
If you create an ASG which uses Spot instances, given that the spot price of the instances varies based on the AZ, this will allow you to have a single service span across all defined AZs, given that 1 Capacity Provider = 1 ASG = 1 Zone.
If you have implemented the logic for an ASG with spot, doing the same logic but for ASG without spot is very straight forward.
Then you simply change the base
value for your service to favor one or the other (spot vs non spot).
Remember though that you cannot mix FARGATE capacity providers with ASG ones for same service. Mostly, out of features being available on EC2 which won't be on FARGATE (i.e. elevated access, kernel features, etc.) which are defined at the task definition level.
One could use a Launch Template and SpotFleet with overrides for each AZ and per instance types, but then the auto-scaling of the required instances in that fleet must be implemented by the user, whereas, the scaling of the nodes for a capacity provider is driven by ECS directly, so Capacity Providers with ASG using Spot is much more hands-off and managed service.
Relevant questions
CloudFormation - LaunchTemplate MarketType
Accepted Answerasked a year agoProcessing environmental data with netCDF files
asked 4 months agoShould ECS Service Task start be triggered by ASG capacity 0->1?
Accepted Answerasked 5 months agoShould ECS/EC2 ASGProvider Capacity Provider be able to scale-up from zero, 0->1
Accepted Answerasked 5 months agoECS Capacity providers best practices
Accepted Answerasked a month agoELB logging/monitoring best practices
Accepted Answerasked 2 years agoUse AWS FARGATE_SPOT as fallback
Accepted Answerasked 2 years agoExisting FARGATE_SPOT provider cannot provide Fargate platform upgr. to 1.4
asked 2 years agoECS: Capacity Provider vs Autoscaling Group
asked 5 months agoAWS Fargate Spot - Automated Draining for Spot Support
Accepted Answerasked 2 years ago
Thank you!