class EcsDeploymentGroup (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CodeDeploy.EcsDeploymentGroup |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscodedeploy#EcsDeploymentGroup |
Java | software.amazon.awscdk.services.codedeploy.EcsDeploymentGroup |
Python | aws_cdk.aws_codedeploy.EcsDeploymentGroup |
TypeScript (source) | aws-cdk-lib » aws_codedeploy » EcsDeploymentGroup |
Implements
IConstruct
, IDependable
, IResource
, IEcs
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
Ecs
Deployment Group Props
Construct Props
Name | Type | Description |
---|---|---|
blue | Ecs | The configuration options for blue-green ECS deployments. |
service | IBase | The ECS service to deploy with this Deployment Group. |
alarms? | IAlarm [] | The CloudWatch alarms associated with this Deployment Group. |
application? | IEcs | The reference to the CodeDeploy ECS Application that this Deployment Group belongs to. |
auto | Auto | The auto-rollback configuration for this Deployment Group. |
deployment | IEcs | The Deployment Configuration this Deployment Group uses. |
deployment | string | The physical, human-readable name of the CodeDeploy Deployment Group. |
ignore | boolean | Whether to skip the step of checking CloudWatch alarms during the deployment process. |
ignore | boolean | Whether to continue a deployment even if fetching the alarm status from CloudWatch failed. |
role? | IRole | The service Role of this Deployment Group. |
blueGreenDeploymentConfig
Type:
Ecs
The configuration options for blue-green ECS deployments.
service
Type:
IBase
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:
IEcs
(optional, default: One will be created for you.)
The reference to the CodeDeploy ECS Application that this Deployment Group belongs to.
autoRollback?
Type:
Auto
(optional, default: default AutoRollbackConfig.)
The auto-rollback configuration for this Deployment Group.
deploymentConfig?
Type:
IEcs
(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.
ignoreAlarmConfiguration?
Type:
boolean
(optional, default: false)
Whether to skip the step of checking CloudWatch alarms during the deployment process.
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
Name | Type | Description |
---|---|---|
application | IEcs | The reference to the CodeDeploy ECS Application that this Deployment Group belongs to. |
deployment | IEcs | The Deployment Configuration this Group uses. |
deployment | string | The ARN of the Deployment Group. |
deployment | string | The name of the Deployment Group. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
role | IRole | The service Role of this Deployment Group. |
stack | Stack | The stack in which this resource is defined. |
application
Type:
IEcs
The reference to the CodeDeploy ECS Application that this Deployment Group belongs to.
deploymentConfig
Type:
IEcs
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:
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.
role
Type:
IRole
The service Role of this Deployment Group.
stack
Type:
Stack
The stack in which this resource is defined.
Methods
Name | Description |
---|---|
add | Associates an additional alarm with this Deployment Group. |
apply | Apply the given removal policy to this resource. |
to | Returns a string representation of this construct. |
static from | Reference an ECS Deployment Group defined outside the CDK app. |
Alarm(alarm)
addpublic addAlarm(alarm: IAlarm): void
Parameters
- alarm
IAlarm
— the alarm to associate with this Deployment Group.
Associates an additional alarm with this Deployment Group.
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.
EcsDeploymentGroupAttributes(scope, id, attrs)
static frompublic 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
Ecs
— the properties of the referenced Deployment Group.Deployment Group Attributes
Returns
Reference an ECS Deployment Group defined outside the CDK app.
Account and region for the DeploymentGroup are taken from the application.