Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(ecs-patterns): remove references to REMOVE_DEFAULT_DESIRED_COUNT #29344

Merged
merged 3 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions packages/aws-cdk-lib/aws-ecs-patterns/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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;

Expand Down