interface DeploymentLifecycleLambdaTargetProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.ECS.DeploymentLifecycleLambdaTargetProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsecs#DeploymentLifecycleLambdaTargetProps |
![]() | software.amazon.awscdk.services.ecs.DeploymentLifecycleLambdaTargetProps |
![]() | aws_cdk.aws_ecs.DeploymentLifecycleLambdaTargetProps |
![]() | aws-cdk-lib » aws_ecs » DeploymentLifecycleLambdaTargetProps |
Configuration for a lambda deployment lifecycle hook.
Example
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);
Properties
Name | Type | Description |
---|---|---|
lifecycle | Deployment [] | The lifecycle stages when this hook should be executed. |
role? | IRole | The IAM role that grants permissions to invoke the lambda target. |
lifecycleStages
Type:
Deployment
[]
The lifecycle stages when this hook should be executed.
role?
Type:
IRole
(optional, default: A unique role will be generated for this lambda function.)
The IAM role that grants permissions to invoke the lambda target.