EcsDeploymentGroup

class aws_cdk.aws_codedeploy.EcsDeploymentGroup(scope, id, *, blue_green_deployment_config, service, alarms=None, application=None, auto_rollback=None, deployment_config=None, deployment_group_name=None, ignore_alarm_configuration=None, ignore_poll_alarms_failure=None, role=None)

Bases: Resource

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

Resource:

AWS::CodeDeploy::DeploymentGroup

ExampleMetadata:

infused

Example:

# my_application: codedeploy.EcsApplication
# cluster: ecs.Cluster
# task_definition: ecs.FargateTaskDefinition
# blue_target_group: elbv2.ITargetGroup
# green_target_group: elbv2.ITargetGroup
# listener: elbv2.IApplicationListener


service = ecs.FargateService(self, "Service",
    cluster=cluster,
    task_definition=task_definition,
    deployment_controller=ecs.DeploymentController(
        type=ecs.DeploymentControllerType.CODE_DEPLOY
    )
)

codedeploy.EcsDeploymentGroup(self, "BlueGreenDG",
    service=service,
    blue_green_deployment_config=codedeploy.EcsBlueGreenDeploymentConfig(
        blue_target_group=blue_target_group,
        green_target_group=green_target_group,
        listener=listener
    ),
    deployment_config=codedeploy.EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • blue_green_deployment_config (Union[EcsBlueGreenDeploymentConfig, Dict[str, Any]]) – The configuration options for blue-green ECS deployments.

  • service (IBaseService) – The ECS service to deploy with this Deployment Group.

  • alarms (Optional[Sequence[IAlarm]]) – 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. Default: []

  • application (Optional[IEcsApplication]) – The reference to the CodeDeploy ECS Application that this Deployment Group belongs to. Default: One will be created for you.

  • auto_rollback (Union[AutoRollbackConfig, Dict[str, Any], None]) – The auto-rollback configuration for this Deployment Group. Default: - default AutoRollbackConfig.

  • deployment_config (Optional[IEcsDeploymentConfig]) – The Deployment Configuration this Deployment Group uses. Default: EcsDeploymentConfig.ALL_AT_ONCE

  • deployment_group_name (Optional[str]) – The physical, human-readable name of the CodeDeploy Deployment Group. Default: An auto-generated name will be used.

  • ignore_alarm_configuration (Optional[bool]) – Whether to skip the step of checking CloudWatch alarms during the deployment process. Default: - false

  • ignore_poll_alarms_failure (Optional[bool]) – Whether to continue a deployment even if fetching the alarm status from CloudWatch failed. Default: false

  • role (Optional[IRole]) – The service Role of this Deployment Group. Default: - A new Role will be created.

Methods

add_alarm(alarm)

Associates an additional alarm with this Deployment Group.

Parameters:

alarm (IAlarm) – the alarm to associate with this Deployment Group.

Return type:

None

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

Parameters:

policy (RemovalPolicy) –

Return type:

None

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

application

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

deployment_config

The Deployment Configuration this Group uses.

deployment_group_arn

The ARN of the Deployment Group.

deployment_group_name

The name of the Deployment Group.

env

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

The tree node.

role

The service Role of this Deployment Group.

stack

The stack in which this resource is defined.

Static Methods

classmethod from_ecs_deployment_group_attributes(scope, id, *, application, deployment_group_name, deployment_config=None)

Reference an ECS Deployment Group defined outside the CDK app.

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

Parameters:
  • scope (Construct) – the parent Construct for this new Construct.

  • id (str) – the logical ID of this new Construct.

  • application (IEcsApplication) – The reference to the CodeDeploy ECS Application that this Deployment Group belongs to.

  • deployment_group_name (str) – The physical, human-readable name of the CodeDeploy ECS Deployment Group that we are referencing.

  • deployment_config (Optional[IEcsDeploymentConfig]) – The Deployment Configuration this Deployment Group uses. Default: EcsDeploymentConfig.ALL_AT_ONCE

Return type:

IEcsDeploymentGroup

Returns:

a Construct representing a reference to an existing Deployment Group

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool