Skip to content
Merged
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
82 changes: 0 additions & 82 deletions packages/aws-cdk-lib/aws-ecs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2076,8 +2076,6 @@ Amazon ECS supports native blue/green deployments that allow you to deploy new v

[Amazon ECS blue/green deployments](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/deployment-type-blue-green.html)

### Using Fargate L2 constructs for Blue/Green Feature

```ts
import * as lambda from 'aws-cdk-lib/aws-lambda';

Expand Down Expand Up @@ -2111,86 +2109,6 @@ const target = service.loadBalancerTarget({
target.attachToApplicationTargetGroup(blueTargetGroup);
```

### Using Escape Hatches for Blue/Green Features

The new blue/green deployment features are added to CloudFormation but not yet available in the CDK L2 constructs, you can use escape hatches to access them through the L1 (CfnService) construct.

#### Load Balancer Advanced Configuration

Configure advanced load balancer settings for blue/green deployments with alternate target groups and listener rules:

```ts
declare const service: ecs.FargateService;

const cfnService = service.node.defaultChild as ecs.CfnService;
cfnService.loadBalancers = [{
containerName: 'web',
containerPort: 80,
targetGroupArn: 'arn:aws:elasticloadbalancing:region:account:targetgroup/production',
advancedConfiguration: {
alternateTargetGroupArn: 'arn:aws:elasticloadbalancing:region:account:targetgroup/test',
productionListenerRule: 'arn:aws:elasticloadbalancing:region:account:listener-rule/production-rule',
testListenerRule: 'arn:aws:elasticloadbalancing:region:account:listener-rule/test-rule',
roleArn: 'arn:aws:iam::account:role/ecs-blue-green-role'
}
}];
```

#### Blue/Green Deployment Configuration

Configure deployment strategy with bake time and lifecycle hooks:

```ts
declare const service: ecs.FargateService;

const cfnService = service.node.defaultChild as ecs.CfnService;
cfnService.deploymentConfiguration = {
maximumPercent: 200,
minimumHealthyPercent: 100,
strategy: 'BLUE_GREEN',
bakeTimeInMinutes: 15,
lifecycleHooks: [{
hookTargetArn: 'arn:aws:lambda:region:account:function:pre-deployment-hook',
roleArn: 'arn:aws:iam::account:role/deployment-hook-role',
lifecycleStages: ['PRE_STOP', 'POST_START']
}]
};
```

#### Service Connect Test Traffic Rules

Configure test traffic routing for Service Connect during blue/green deployments:

```ts
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;

const service = new ecs.FargateService(this, 'Service', {
cluster,
taskDefinition,
});

const cfnService = service.node.defaultChild as ecs.CfnService;
cfnService.serviceConnectConfiguration = {
enabled: true,
services: [{
portName: 'api',
clientAliases: [{
port: 80,
dnsName: 'my-service',
testTrafficRules: {
header: {
name: 'x-canary-test',
value: {
exact: 'beta-version'
}
}
}
}]
}]
};
```

## Daemon Scheduling Strategy
You can specify whether service use Daemon scheduling strategy by specifying `daemon` option in Service constructs. See [differences between Daemon and Replica scheduling strategy](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_services.html)

Expand Down
Loading