CloudFormation Stack Update scenarios with 'Insufficient capacity' on ECS Service despite available EC2 instances
Hey everyone, I'm running into an issue that's driving me crazy... I am trying to update an existing CloudFormation stack that manages an ECS service and its associated EC2 instances. The stack previously worked well, but after adding a new parameter for instance type, the update fails with the behavior message: `Resource update cancelled due to the following failure reason: Insufficient capacity`. I have verified that there are indeed available EC2 instances in the specified instance type in my target availability zone. Hereβs the relevant part of my CloudFormation template: ```yaml Resources: MyAutoScalingGroup: Type: AWS::AutoScaling::AutoScalingGroup Properties: LaunchConfigurationName: !Ref MyLaunchConfiguration MinSize: 1 MaxSize: 3 DesiredCapacity: 2 VPCZoneIdentifier: - !Ref SubnetId MyLaunchConfiguration: Type: AWS::AutoScaling::LaunchConfiguration Properties: InstanceType: !Ref InstanceTypeParameter ImageId: ami-0123456789abcdef0 IamInstanceProfile: !Ref InstanceProfile MyECSService: Type: AWS::ECS::Service Properties: Cluster: !Ref MyECSCluster DesiredCount: 1 TaskDefinition: !Ref MyTaskDefinition LaunchType: EC2 ``` I have tried changing the `InstanceTypeParameter` to various types (t2.micro, t3.small, etc.), but the behavior continues. I checked the EC2 limits for my account, and I have enough vCPUs available in the region. Additionally, I made sure that the target group associated with the ECS service is correctly configured. Could this scenario be related to scaling settings or something else in the ECS configuration? Is there a best practice to ensure that the CloudFormation stack can successfully update without running into capacity issues? Any insights would be greatly appreciated!