class EcsDeploymentConfig (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CodeDeploy.EcsDeploymentConfig |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscodedeploy#EcsDeploymentConfig |
Java | software.amazon.awscdk.services.codedeploy.EcsDeploymentConfig |
Python | aws_cdk.aws_codedeploy.EcsDeploymentConfig |
TypeScript (source) | aws-cdk-lib » aws_codedeploy » EcsDeploymentConfig |
Implements
IConstruct
, IDependable
, IResource
, IBase
, IEcs
A custom Deployment Configuration for an ECS Deployment Group.
Example
declare const service: ecs.FargateService;
declare const blueTargetGroup: elbv2.ITargetGroup;
declare const greenTargetGroup: elbv2.ITargetGroup;
declare const listener: elbv2.IApplicationListener;
declare const testListener: elbv2.IApplicationListener;
new codedeploy.EcsDeploymentGroup(this, 'BlueGreenDG', {
autoRollback: {
// CodeDeploy will automatically roll back if the 8-hour approval period times out and the deployment stops
stoppedDeployment: true,
},
service,
blueGreenDeploymentConfig: {
// The deployment will wait for approval for up to 8 hours before stopping the deployment
deploymentApprovalWaitTime: Duration.hours(8),
blueTargetGroup,
greenTargetGroup,
listener,
testListener,
},
deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES,
});
Initializer
new EcsDeploymentConfig(scope: Construct, id: string, props?: EcsDeploymentConfigProps)
Parameters
- scope
Construct
- id
string
- props
Ecs
Deployment Config Props
Construct Props
Name | Type | Description |
---|---|---|
deployment | string | The physical, human-readable name of the Deployment Configuration. |
traffic | Traffic | The configuration that specifies how traffic is shifted from the 'blue' target group to the 'green' target group during a deployment. |
deploymentConfigName?
Type:
string
(optional, default: automatically generated name)
The physical, human-readable name of the Deployment Configuration.
trafficRouting?
Type:
Traffic
(optional, default: AllAtOnce)
The configuration that specifies how traffic is shifted from the 'blue' target group to the 'green' target group during a deployment.
Properties
Name | Type | Description |
---|---|---|
deployment | string | The arn of the deployment config. |
deployment | string | The name of the deployment config. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
static ALL_AT_ONCE | IEcs | CodeDeploy predefined deployment configuration that shifts all traffic to the updated ECS task set at once. |
static CANARY_10 | IEcs | CodeDeploy predefined deployment configuration that shifts 10 percent of traffic in the first increment. |
static CANARY_10 | IEcs | CodeDeploy predefined deployment configuration that shifts 10 percent of traffic in the first increment. |
static LINEAR_10 | IEcs | CodeDeploy predefined deployment configuration that shifts 10 percent of traffic every minute until all traffic is shifted. |
static LINEAR_10 | IEcs | CodeDeploy predefined deployment configuration that shifts 10 percent of traffic every three minutes until all traffic is shifted. |
deploymentConfigArn
Type:
string
The arn of the deployment config.
deploymentConfigName
Type:
string
The name of the deployment config.
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
static ALL_AT_ONCE
Type:
IEcs
CodeDeploy predefined deployment configuration that shifts all traffic to the updated ECS task set at once.
static CANARY_10PERCENT_15MINUTES
Type:
IEcs
CodeDeploy predefined deployment configuration that shifts 10 percent of traffic in the first increment.
The remaining 90 percent is deployed 15 minutes later.
static CANARY_10PERCENT_5MINUTES
Type:
IEcs
CodeDeploy predefined deployment configuration that shifts 10 percent of traffic in the first increment.
The remaining 90 percent is deployed five minutes later.
static LINEAR_10PERCENT_EVERY_1MINUTES
Type:
IEcs
CodeDeploy predefined deployment configuration that shifts 10 percent of traffic every minute until all traffic is shifted.
static LINEAR_10PERCENT_EVERY_3MINUTES
Type:
IEcs
CodeDeploy predefined deployment configuration that shifts 10 percent of traffic every three minutes until all traffic is shifted.
Methods
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Import a custom Deployment Configuration for an ECS Deployment Group defined outside the CDK. |
RemovalPolicy(policy)
applypublic applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY
), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN
).
String()
topublic toString(): string
Returns
string
Returns a string representation of this construct.
EcsDeploymentConfigName(scope, id, ecsDeploymentConfigName)
static frompublic static fromEcsDeploymentConfigName(scope: Construct, id: string, ecsDeploymentConfigName: string): IEcsDeploymentConfig
Parameters
- scope
Construct
— the parent Construct for this new Construct. - id
string
— the logical ID of this new Construct. - ecsDeploymentConfigName
string
— the name of the referenced custom Deployment Configuration.
Returns
Import a custom Deployment Configuration for an ECS Deployment Group defined outside the CDK.