AutoRollbackConfig

class aws_cdk.aws_codedeploy.AutoRollbackConfig(*, deployment_in_alarm=None, failed_deployment=None, stopped_deployment=None)

Bases: object

The configuration for automatically rolling back deployments in a given Deployment Group.

Parameters:
  • deployment_in_alarm (Optional[bool]) – Whether to automatically roll back a deployment during which one of the configured CloudWatch alarms for this Deployment Group went off. Default: true if you’ve provided any Alarms with the alarms property, false otherwise

  • failed_deployment (Optional[bool]) – Whether to automatically roll back a deployment that fails. Default: true

  • stopped_deployment (Optional[bool]) – Whether to automatically roll back a deployment that was manually stopped. Default: false

ExampleMetadata:

infused

Example:

import aws_cdk.aws_autoscaling as autoscaling
import aws_cdk.aws_cloudwatch as cloudwatch

# application: codedeploy.ServerApplication
# asg: autoscaling.AutoScalingGroup
# alarm: cloudwatch.Alarm

deployment_group = codedeploy.ServerDeploymentGroup(self, "CodeDeployDeploymentGroup",
    application=application,
    deployment_group_name="MyDeploymentGroup",
    auto_scaling_groups=[asg],
    # adds User Data that installs the CodeDeploy agent on your auto-scaling groups hosts
    # default: true
    install_agent=True,
    # adds EC2 instances matching tags
    ec2_instance_tags=codedeploy.InstanceTagSet({
        # any instance with tags satisfying
        # key1=v1 or key1=v2 or key2 (any value) or value v3 (any key)
        # will match this group
        "key1": ["v1", "v2"],
        "key2": [],
        "": ["v3"]
    }),
    # adds on-premise instances matching tags
    on_premise_instance_tags=codedeploy.InstanceTagSet({
        "key1": ["v1", "v2"]
    }, {
        "key2": ["v3"]
    }),
    # CloudWatch alarms
    alarms=[alarm],
    # whether to ignore failure to fetch the status of alarms from CloudWatch
    # default: false
    ignore_poll_alarms_failure=False,
    # whether to skip the step of checking CloudWatch alarms during the deployment process
    # default: false
    ignore_alarm_configuration=False,
    # auto-rollback configuration
    auto_rollback=codedeploy.AutoRollbackConfig(
        failed_deployment=True,  # default: true
        stopped_deployment=True,  # default: false
        deployment_in_alarm=True
    )
)

Attributes

deployment_in_alarm

Whether to automatically roll back a deployment during which one of the configured CloudWatch alarms for this Deployment Group went off.

Default:

true if you’ve provided any Alarms with the alarms property, false otherwise

failed_deployment

Whether to automatically roll back a deployment that fails.

Default:

true

stopped_deployment

Whether to automatically roll back a deployment that was manually stopped.

Default:

false