Skip to content

Commit 3d31c49

Browse files
Karthik Kumar Viswanathanguilt
authored andcommitted
fix(ecs): Move AvailabilityZoneRebalancing into aws-ecs-patterns.
1 parent eec900e commit 3d31c49

File tree

4 files changed

+31
-16
lines changed

4 files changed

+31
-16
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**
2+
* Indicates whether to use Availability Zone rebalancing for an ECS service.
3+
*
4+
* @see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-rebalancing.html
5+
*/
6+
export enum AvailabilityZoneRebalancing {
7+
/**
8+
* Availability zone rebalancing is enabled.
9+
*/
10+
ENABLED = 'ENABLED',
11+
12+
/**
13+
* Availability zone rebalancing is disabled.
14+
*/
15+
DISABLED = 'DISABLED',
16+
}

packages/aws-cdk-lib/aws-ecs-patterns/lib/base/fargate-service-base.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { FargatePlatformVersion, FargateTaskDefinition, RuntimePlatform } from '../../../aws-ecs';
2+
import { AvailabilityZoneRebalancing } from '../availability-zone-rebalancing';
23

34
export interface FargateServiceBaseProps {
45
/**
@@ -89,4 +90,15 @@ export interface FargateServiceBaseProps {
8990
* @default - If the property is undefined, `operatingSystemFamily` is LINUX and `cpuArchitecture` is X86_64
9091
*/
9192
readonly runtimePlatform?: RuntimePlatform;
93+
94+
/**
95+
* Whether to use Availability Zone rebalancing for the service.
96+
*
97+
* If enabled, `maxHealthyPercent` must be greater than 100, and the service must not be a target
98+
* of a Classic Load Balancer.
99+
*
100+
* @see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-rebalancing.html
101+
* @default AvailabilityZoneRebalancing.DISABLED
102+
*/
103+
readonly availabilityZoneRebalancing?: AvailabilityZoneRebalancing;
92104
}

packages/aws-cdk-lib/aws-ecs-patterns/lib/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ export * from './fargate/application-multiple-target-groups-fargate-service';
2222
export * from './base/network-multiple-target-groups-service-base';
2323
export * from './ecs/network-multiple-target-groups-ecs-service';
2424
export * from './fargate/network-multiple-target-groups-fargate-service';
25+
26+
export * from './availability-zone-rebalancing';
Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1 @@
1-
/**
2-
* Indicates whether to use Availability Zone rebalancing for an ECS service.
3-
*
4-
* @see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-rebalancing.html
5-
*/
6-
export enum AvailabilityZoneRebalancing {
7-
/**
8-
* Availability zone rebalancing is enabled.
9-
*/
10-
ENABLED = 'ENABLED',
11-
12-
/**
13-
* Availability zone rebalancing is disabled.
14-
*/
15-
DISABLED = 'DISABLED',
16-
}
1+
import AvailabilityZoneRebalancing from '../../aws-ecs-patterns';

0 commit comments

Comments
 (0)