You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/aws-cdk-lib/aws-ecs/README.md
+43-4Lines changed: 43 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1661,9 +1661,9 @@ new ecs.Ec2Service(this, 'EC2Service', {
1661
1661
1662
1662
### Managed Instances Capacity Providers
1663
1663
1664
-
Managed Instances Capacity Providers allow you to use AWS-managed EC2 instances for your ECS tasks while providing more control over instance selection than standard Fargate. AWS handles the instance lifecycle, patching, and maintenance while you can specify detailed instance requirements.
1664
+
Managed Instances Capacity Providers allow you to use AWS-managed EC2 instances for your ECS tasks while providing more control over instance selection than standard Fargate. AWS handles the instance lifecycle, patching, and maintenance while you can specify detailed instance requirements. You can define detailed instance requirements to control which types of instances are used for your workloads.
1665
1665
1666
-
To create a Managed Instances Capacity Provider, you need to specify the required EC2 instance profile, and networking configuration. You can also define detailed instance requirements to control which types of instances are used for your workloads.
1666
+
See [ECS documentation for Managed Instances Capacity Provider](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/managed-instances-capacity-providers-concept.html)for more documentation.
@@ -1761,6 +1766,40 @@ const miCapacityProvider = new ecs.ManagedInstancesCapacityProvider(this, 'MICap
1761
1766
onDemandMaxPricePercentageOverLowestPrice: 10,
1762
1767
},
1763
1768
});
1769
+
1770
+
```
1771
+
#### Note: Service Replacement When Migrating from LaunchType to CapacityProviderStrategy
1772
+
1773
+
**Understanding the Limitation**
1774
+
1775
+
The ECS [CreateService API](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateService.html#ECS-CreateService-request-launchType) does not allow specifying both `launchType` and `capacityProviderStrategies` simultaneously. When you specify `capacityProviderStrategies`, the CDK uses those capacity providers instead of a launch type. This is a limitation of the ECS API and CloudFormation, not a CDK bug.
1776
+
1777
+
**Impact on Updates**
1778
+
1779
+
Because `launchType` is immutable during updates, switching from `launchType` to `capacityProviderStrategies` requires CloudFormation to replace the service. This means your existing service will be deleted and recreated with the new configuration. This behavior is expected and reflects the underlying API constraints.
1780
+
1781
+
**Workaround**
1782
+
1783
+
While we work on a long-term solution, you can use the following [escape hatch](https://docs.aws.amazon.com/cdk/v2/guide/cfn-layer.html) to preserve your service during the migration:
1784
+
1785
+
```ts
1786
+
declareconst cluster:ecs.Cluster;
1787
+
declareconst taskDefinition:ecs.TaskDefinition;
1788
+
1789
+
const service =newecs.FargateService(this, 'Service', {
0 commit comments