interface AlternateTargetProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.ECS.AlternateTargetProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsecs#AlternateTargetProps |
![]() | software.amazon.awscdk.services.ecs.AlternateTargetProps |
![]() | aws_cdk.aws_ecs.AlternateTargetProps |
![]() | aws-cdk-lib » aws_ecs » AlternateTargetProps |
Properties for AlternateTarget configuration.
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 |
---|---|---|
alternate | ITarget | The alternate target group. |
production | Listener | The production listener rule ARN (ALB) or listener ARN (NLB). |
role? | IRole | The IAM role for the configuration. |
test | Listener | The test listener configuration. |
alternateTargetGroup
Type:
ITarget
The alternate target group.
productionListener
Type:
Listener
The production listener rule ARN (ALB) or listener ARN (NLB).
role?
Type:
IRole
(optional, default: a new role will be created)
The IAM role for the configuration.
testListener?
Type:
Listener
(optional, default: none)
The test listener configuration.