aws-cdk-lib.aws_codedeploy.EcsDeploymentConfig

class EcsDeploymentConfig (construct)

LanguageType name
.NETAmazon.CDK.AWS.CodeDeploy.EcsDeploymentConfig
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscodedeploy#EcsDeploymentConfig
Javasoftware.amazon.awscdk.services.codedeploy.EcsDeploymentConfig
Pythonaws_cdk.aws_codedeploy.EcsDeploymentConfig
TypeScript (source)aws-cdk-lib » aws_codedeploy » EcsDeploymentConfig

Implements IConstruct, IDependable, IResource, IBaseDeploymentConfig, IEcsDeploymentConfig

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 EcsDeploymentConfigProps

Construct Props

NameTypeDescription
deploymentConfigName?stringThe physical, human-readable name of the Deployment Configuration.
trafficRouting?TrafficRoutingThe 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: TrafficRouting (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

NameTypeDescription
deploymentConfigArnstringThe arn of the deployment config.
deploymentConfigNamestringThe name of the deployment config.
envResourceEnvironmentThe environment this resource belongs to.
nodeNodeThe tree node.
stackStackThe stack in which this resource is defined.
static ALL_AT_ONCEIEcsDeploymentConfigCodeDeploy predefined deployment configuration that shifts all traffic to the updated ECS task set at once.
static CANARY_10PERCENT_15MINUTESIEcsDeploymentConfigCodeDeploy predefined deployment configuration that shifts 10 percent of traffic in the first increment.
static CANARY_10PERCENT_5MINUTESIEcsDeploymentConfigCodeDeploy predefined deployment configuration that shifts 10 percent of traffic in the first increment.
static LINEAR_10PERCENT_EVERY_1MINUTESIEcsDeploymentConfigCodeDeploy predefined deployment configuration that shifts 10 percent of traffic every minute until all traffic is shifted.
static LINEAR_10PERCENT_EVERY_3MINUTESIEcsDeploymentConfigCodeDeploy 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: ResourceEnvironment

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: IEcsDeploymentConfig

CodeDeploy predefined deployment configuration that shifts all traffic to the updated ECS task set at once.


static CANARY_10PERCENT_15MINUTES

Type: IEcsDeploymentConfig

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: IEcsDeploymentConfig

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: IEcsDeploymentConfig

CodeDeploy predefined deployment configuration that shifts 10 percent of traffic every minute until all traffic is shifted.


static LINEAR_10PERCENT_EVERY_3MINUTES

Type: IEcsDeploymentConfig

CodeDeploy predefined deployment configuration that shifts 10 percent of traffic every three minutes until all traffic is shifted.

Methods

NameDescription
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
toString()Returns a string representation of this construct.
static fromEcsDeploymentConfigName(scope, id, ecsDeploymentConfigName)Import a custom Deployment Configuration for an ECS Deployment Group defined outside the CDK.

applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

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).


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromEcsDeploymentConfigName(scope, id, ecsDeploymentConfigName)

public 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

  • IEcsDeploymentConfig

Import a custom Deployment Configuration for an ECS Deployment Group defined outside the CDK.