diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/README.md b/packages/aws-cdk-lib/aws-ecs-patterns/README.md index 77f62440f5efa..6dda31ecccfaf 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/README.md +++ b/packages/aws-cdk-lib/aws-ecs-patterns/README.md @@ -921,56 +921,6 @@ const scheduledFargateTask = new ecsPatterns.ScheduledFargateTask(this, 'Schedul }); ``` -### Use the REMOVE_DEFAULT_DESIRED_COUNT feature flag - -The REMOVE_DEFAULT_DESIRED_COUNT feature flag is used to override the default desiredCount that is autogenerated by the CDK. This will set the desiredCount of any service created by any of the following constructs to be undefined. - -* ApplicationLoadBalancedEc2Service -* ApplicationLoadBalancedFargateService -* NetworkLoadBalancedEc2Service -* NetworkLoadBalancedFargateService -* QueueProcessingEc2Service -* QueueProcessingFargateService - -If a desiredCount is not passed in as input to the above constructs, CloudFormation will either create a new service to start up with a desiredCount of 1, or update an existing service to start up with the same desiredCount as prior to the update. - -To enable the feature flag, ensure that the REMOVE_DEFAULT_DESIRED_COUNT flag within an application stack context is set to true, like so: - -```ts -declare const stack: Stack; -stack.node.setContext(cxapi.ECS_REMOVE_DEFAULT_DESIRED_COUNT, true); -``` - -The following is an example of an application with the REMOVE_DEFAULT_DESIRED_COUNT feature flag enabled: - -```ts nofixture -import { Construct } from 'constructs'; -import { App, Stack } from 'aws-cdk-lib'; -import * as ec2 from 'aws-cdk-lib/aws-ec2'; -import * as ecs from 'aws-cdk-lib/aws-ecs'; -import * as ecsPatterns from 'aws-cdk-lib/aws-ecs-patterns'; -import * as cxapi from 'aws-cdk-lib/cx-api'; -import * as path from 'path'; - -class MyStack extends Stack { - constructor(scope: Construct, id: string) { - super(scope, id); - - this.node.setContext(cxapi.ECS_REMOVE_DEFAULT_DESIRED_COUNT, true); - - const vpc = new ec2.Vpc(this, 'VPC', { - maxAzs: 2, - }); - - new ecsPatterns.QueueProcessingFargateService(this, 'QueueProcessingService', { - vpc, - memoryLimitMiB: 512, - image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')), - }); - } -} -``` - ### Deploy application and metrics sidecar The following is an example of deploying an application along with a metrics sidecar container that utilizes `dockerLabels` for discovery: diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts index 626f35bff4150..8f734fe2fb461 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-load-balanced-service-base.ts @@ -78,8 +78,7 @@ export interface ApplicationLoadBalancedServiceBaseProps { * The desired number of instantiations of the task definition to keep running on the service. * The minimum value is 1 * - * @default - If the feature flag, ECS_REMOVE_DEFAULT_DESIRED_COUNT is false, the default is 1; - * if true, the default is 1 for all new services and uses the existing services desired count + * @default - The default is 1 for all new services and uses the existing service's desired count * when updating an existing service. */ readonly desiredCount?: number; diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts index 219aa491fcdbe..11898cbfb511c 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/application-multiple-target-groups-service-base.ts @@ -50,8 +50,7 @@ export interface ApplicationMultipleTargetGroupsServiceBaseProps { /** * The desired number of instantiations of the task definition to keep running on the service. * - * @default - If the feature flag, ECS_REMOVE_DEFAULT_DESIRED_COUNT is false, the default is 1; - * if true, the default is 1 for all new services and uses the existing services desired count + * @default - The default is 1 for all new services and uses the existing service's desired count * when updating an existing service. */ readonly desiredCount?: number; diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts index 45f58dd517a12..1939c0fd0684a 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-load-balanced-service-base.ts @@ -66,8 +66,7 @@ export interface NetworkLoadBalancedServiceBaseProps { * The desired number of instantiations of the task definition to keep running on the service. * The minimum value is 1 * - * @default - If the feature flag, ECS_REMOVE_DEFAULT_DESIRED_COUNT is false, the default is 1; - * if true, the default is 1 for all new services and uses the existing services desired count + * @default - The default is 1 for all new services and uses the existing service's desired count * when updating an existing service. */ readonly desiredCount?: number; diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts index 5eeaa3ba9bf82..72d58e12ee2f2 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/network-multiple-target-groups-service-base.ts @@ -41,8 +41,7 @@ export interface NetworkMultipleTargetGroupsServiceBaseProps { * The desired number of instantiations of the task definition to keep running on the service. * The minimum value is 1 * - * @default - If the feature flag, ECS_REMOVE_DEFAULT_DESIRED_COUNT is false, the default is 1; - * if true, the default is 1 for all new services and uses the existing services desired count + * @default - The default is 1 for all new services and uses the existing service's desired count * when updating an existing service. */ readonly desiredCount?: number; diff --git a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/queue-processing-service-base.ts b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/queue-processing-service-base.ts index beb207309b217..d61567e55670e 100644 --- a/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/queue-processing-service-base.ts +++ b/packages/aws-cdk-lib/aws-ecs-patterns/lib/base/queue-processing-service-base.ts @@ -58,8 +58,7 @@ export interface QueueProcessingServiceBaseProps { /** * The desired number of instantiations of the task definition to keep running on the service. * - * @default - If the feature flag, ECS_REMOVE_DEFAULT_DESIRED_COUNT is false, the default is 1; - * if true, the minScalingCapacity is 1 for all new services and uses the existing services desired count + * @default - The minScalingCapacity is 1 for all new services and uses the existing services desired count * when updating an existing service. * @deprecated - Use `minScalingCapacity` or a literal object instead. */ @@ -128,14 +127,14 @@ export interface QueueProcessingServiceBaseProps { /** * Maximum capacity to scale to. * - * @default - If the feature flag, ECS_REMOVE_DEFAULT_DESIRED_COUNT is false, the default is (desiredTaskCount * 2); if true, the default is 2. + * @default 2 */ readonly maxScalingCapacity?: number; /** * Minimum capacity to scale to. * - * @default - If the feature flag, ECS_REMOVE_DEFAULT_DESIRED_COUNT is false, the default is the desiredTaskCount; if true, the default is 1. + * @default 1 */ readonly minScalingCapacity?: number;