DeploymentLifecycleStage Enum
Deployment lifecycle stages where hooks can be executed.
Example
ts
import * as lambda from 'aws-cdk-lib/aws-lambda';
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.TaskDefinition;
declare const lambdaHook: lambda.Function;
declare const blueTargetGroup: elbv2.ApplicationTargetGroup;
declare const greenTargetGroup: elbv2.ApplicationTargetGroup;
declare const prodListenerRule: elbv2.ApplicationListenerRule;
const service = new ecs.FargateService(this, 'Service', {
cluster,
taskDefinition,
deploymentStrategy: ecs.DeploymentStrategy.BLUE_GREEN,
});
service.addLifecycleHook(new ecs.DeploymentLifecycleLambdaTarget(lambdaHook, 'PreScaleHook', {
lifecycleStages: [ecs.DeploymentLifecycleStage.PRE_SCALE_UP],
}));
const target = service.loadBalancerTarget({
containerName: 'nginx',
containerPort: 80,
protocol: ecs.Protocol.TCP,
alternateTarget: new ecs.AlternateTarget('AlternateTarget', {
alternateTargetGroup: greenTargetGroup,
productionListener: ecs.ListenerRuleConfiguration.applicationListenerRule(prodListenerRule),
}),
});
target.attachToApplicationTargetGroup(blueTargetGroup);
Members
| Member | Description |
|---|---|
RECONCILE_SERVICE | Execute during service reconciliation. |
PRE_SCALE_UP | Execute before scaling up tasks. |
POST_SCALE_UP | Execute after scaling up tasks. |
TEST_TRAFFIC_SHIFT | Execute during test traffic shift. |
POST_TEST_TRAFFIC_SHIFT | Execute after test traffic shift. |
PRODUCTION_TRAFFIC_SHIFT | Execute during production traffic shift. |
POST_PRODUCTION_TRAFFIC_SHIFT | Execute after production traffic shift. |
Referenced by
DeploymentLifecycleHookTargetConfig.lifecycleStageslifecycle_stageslifecycleStagesLifecycleStagesLifecycleStagesDeploymentLifecycleLambdaTargetProps.lifecycleStageslifecycle_stageslifecycleStagesLifecycleStagesLifecycleStages