aws-cdk-lib.aws_codedeploy.EcsDeploymentGroup

class EcsDeploymentGroup (construct)

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

Implements IConstruct, IDependable, IResource, IEcsDeploymentGroup

A CodeDeploy deployment group that orchestrates ECS blue-green deployments.

Example

declare const myApplication: codedeploy.EcsApplication;
declare const cluster: ecs.Cluster;
declare const taskDefinition: ecs.FargateTaskDefinition;
declare const blueTargetGroup: elbv2.ITargetGroup;
declare const greenTargetGroup: elbv2.ITargetGroup;
declare const listener: elbv2.IApplicationListener;

const service = new ecs.FargateService(this, 'Service', {
  cluster,
  taskDefinition,
  deploymentController: {
    type: ecs.DeploymentControllerType.CODE_DEPLOY,
  },
});

new codedeploy.EcsDeploymentGroup(this, 'BlueGreenDG', {
  service,
  blueGreenDeploymentConfig: {
    blueTargetGroup,
    greenTargetGroup,
    listener,
  },
  deploymentConfig: codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES,
});

Initializer

new EcsDeploymentGroup(scope: Construct, id: string, props: EcsDeploymentGroupProps)

Parameters

  • scope Construct
  • id string
  • props EcsDeploymentGroupProps

Construct Props

NameTypeDescription
blueGreenDeploymentConfigEcsBlueGreenDeploymentConfigThe configuration options for blue-green ECS deployments.
serviceIBaseServiceThe ECS service to deploy with this Deployment Group.
alarms?IAlarm[]The CloudWatch alarms associated with this Deployment Group.
application?IEcsApplicationThe reference to the CodeDeploy ECS Application that this Deployment Group belongs to.
autoRollback?AutoRollbackConfigThe auto-rollback configuration for this Deployment Group.
deploymentConfig?IEcsDeploymentConfigThe Deployment Configuration this Deployment Group uses.
deploymentGroupName?stringThe physical, human-readable name of the CodeDeploy Deployment Group.
ignorePollAlarmsFailure?booleanWhether to continue a deployment even if fetching the alarm status from CloudWatch failed.
role?IRoleThe service Role of this Deployment Group.

blueGreenDeploymentConfig

Type: EcsBlueGreenDeploymentConfig

The configuration options for blue-green ECS deployments.


service

Type: IBaseService

The ECS service to deploy with this Deployment Group.


alarms?

Type: IAlarm[] (optional, default: [])

The CloudWatch alarms associated with this Deployment Group.

CodeDeploy will stop (and optionally roll back) a deployment if during it any of the alarms trigger.

Alarms can also be added after the Deployment Group is created using the #addAlarm method.

See also: https://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-create-alarms.html


application?

Type: IEcsApplication (optional, default: One will be created for you.)

The reference to the CodeDeploy ECS Application that this Deployment Group belongs to.


autoRollback?

Type: AutoRollbackConfig (optional, default: default AutoRollbackConfig.)

The auto-rollback configuration for this Deployment Group.


deploymentConfig?

Type: IEcsDeploymentConfig (optional, default: EcsDeploymentConfig.ALL_AT_ONCE)

The Deployment Configuration this Deployment Group uses.


deploymentGroupName?

Type: string (optional, default: An auto-generated name will be used.)

The physical, human-readable name of the CodeDeploy Deployment Group.


ignorePollAlarmsFailure?

Type: boolean (optional, default: false)

Whether to continue a deployment even if fetching the alarm status from CloudWatch failed.


role?

Type: IRole (optional, default: A new Role will be created.)

The service Role of this Deployment Group.

Properties

NameTypeDescription
applicationIEcsApplicationThe reference to the CodeDeploy ECS Application that this Deployment Group belongs to.
deploymentConfigIEcsDeploymentConfigThe Deployment Configuration this Group uses.
deploymentGroupArnstringThe ARN of the Deployment Group.
deploymentGroupNamestringThe name of the Deployment Group.
envResourceEnvironmentThe environment this resource belongs to.
nodeNodeThe tree node.
roleIRoleThe service Role of this Deployment Group.
stackStackThe stack in which this resource is defined.

application

Type: IEcsApplication

The reference to the CodeDeploy ECS Application that this Deployment Group belongs to.


deploymentConfig

Type: IEcsDeploymentConfig

The Deployment Configuration this Group uses.


deploymentGroupArn

Type: string

The ARN of the Deployment Group.


deploymentGroupName

Type: string

The name of the Deployment Group.


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.


role

Type: IRole

The service Role of this Deployment Group.


stack

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
addAlarm(alarm)Associates an additional alarm with this Deployment Group.
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
toString()Returns a string representation of this construct.
static fromEcsDeploymentGroupAttributes(scope, id, attrs)Reference an ECS Deployment Group defined outside the CDK app.

addAlarm(alarm)

public addAlarm(alarm: IAlarm): void

Parameters

  • alarm IAlarm — the alarm to associate with this Deployment Group.

Associates an additional alarm with this Deployment Group.


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 fromEcsDeploymentGroupAttributes(scope, id, attrs)

public static fromEcsDeploymentGroupAttributes(scope: Construct, id: string, attrs: EcsDeploymentGroupAttributes): IEcsDeploymentGroup

Parameters

  • scope Construct — the parent Construct for this new Construct.
  • id string — the logical ID of this new Construct.
  • attrs EcsDeploymentGroupAttributes — the properties of the referenced Deployment Group.

Returns

  • IEcsDeploymentGroup

Reference an ECS Deployment Group defined outside the CDK app.

Account and region for the DeploymentGroup are taken from the application.