Skip to content

Commit

Permalink
feat(ecs-patterns): add stickinessCookieDuration and minHealth naming…
Browse files Browse the repository at this point in the history
… in L3 construct
  • Loading branch information
cheruvian committed Mar 26, 2024
1 parent 383ead0 commit 7216c15
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -971,10 +971,17 @@
{
"Key": "deregistration_delay.timeout_seconds",
"Value": "10"
},{
"Key": "stickiness.enabled",
"Value": "true"
},
{
"Key": "stickiness.enabled",
"Value": "false"
"Key": "stickiness.type",
"Value": "lb_cookie"
},
{
"Key": "stickiness.lb_cookie.duration_seconds",
"Value": "240"
}
],
"TargetType": "instance",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ new ApplicationMultipleTargetGroupsEc2Service(stack, 'myService', {
image: ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
},
enableExecuteCommand: true,
minHealthyPercent: 33,
minimumHealthyPercent: 33,
targetGroups: [
{
containerPort: 80,
deregistrationDelay: Duration.seconds(10),
stickinessCookieDuration: Duration.minutes(4),
},
{
containerPort: 90,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ export interface ApplicationMultipleTargetGroupsServiceBaseProps {
* the Amazon ECS service's DesiredCount value, that must
* continue to run and remain healthy during a deployment.
*
* @see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DeploymentConfiguration.html
* @default - 0 if daemon, otherwise 50
*/
readonly minHealthyPercent?: number;
readonly minimumHealthyPercent?: number;
}

/**
Expand Down Expand Up @@ -285,6 +286,17 @@ export interface ApplicationTargetProps {
* @default 300
*/
readonly deregistrationDelay?: Duration;
/**
* The stickiness cookie expiration period.
*
* Setting this value enables load balancer stickiness.
*
* After this period, the cookie is considered stale. The minimum value is
* 1 second and the maximum value is 7 days (604800 seconds).
*
* @default Duration.days(1)
*/
readonly stickinessCookieDuration?: Duration;
}

/**
Expand Down Expand Up @@ -534,6 +546,7 @@ export abstract class ApplicationMultipleTargetGroupsServiceBase extends Constru
],
conditions,
deregistrationDelay: targetProps.deregistrationDelay,
stickinessCookieDuration: targetProps.stickinessCookieDuration,
priority: targetProps.priority,
});
this.targetGroups.push(targetGroup);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ export interface NetworkMultipleTargetGroupsServiceBaseProps {
* the Amazon ECS service's DesiredCount value, that must
* continue to run and remain healthy during a deployment.
*
* @see https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_DeploymentConfiguration.html
* @default - 0 if daemon, otherwise 50
*/
readonly minHealthyPercent?: number;
readonly minimumHealthyPercent?: number;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export class ApplicationMultipleTargetGroupsEc2Service extends ApplicationMultip
enableExecuteCommand: props.enableExecuteCommand,
placementConstraints: props.placementConstraints,
placementStrategies: props.placementStrategies,
minHealthyPercent: props.minHealthyPercent,
minHealthyPercent: props.minimumHealthyPercent,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export class NetworkMultipleTargetGroupsEc2Service extends NetworkMultipleTarget
enableExecuteCommand: props.enableExecuteCommand,
placementConstraints: props.placementConstraints,
placementStrategies: props.placementStrategies,
minHealthyPercent: props.minHealthyPercent,
minHealthyPercent: props.minimumHealthyPercent,
});
}
}

0 comments on commit 7216c15

Please sign in to comment.