Skip to content
v2.277.0

EcsDeploymentGroupProps Struct ​

Construction properties for EcsDeploymentGroup.

Example ​

ts
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,
});
python
# 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
)
java
EcsApplication myApplication;
Cluster cluster;
FargateTaskDefinition taskDefinition;
ITargetGroup blueTargetGroup;
ITargetGroup greenTargetGroup;
IApplicationListener listener;


FargateService service = FargateService.Builder.create(this, "Service")
        .cluster(cluster)
        .taskDefinition(taskDefinition)
        .deploymentController(DeploymentController.builder()
                .type(DeploymentControllerType.CODE_DEPLOY)
                .build())
        .build();

EcsDeploymentGroup.Builder.create(this, "BlueGreenDG")
        .service(service)
        .blueGreenDeploymentConfig(EcsBlueGreenDeploymentConfig.builder()
                .blueTargetGroup(blueTargetGroup)
                .greenTargetGroup(greenTargetGroup)
                .listener(listener)
                .build())
        .deploymentConfig(EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
EcsApplication myApplication;
Cluster cluster;
FargateTaskDefinition taskDefinition;
ITargetGroup blueTargetGroup;
ITargetGroup greenTargetGroup;
IApplicationListener listener;


var service = new FargateService(this, "Service", new FargateServiceProps {
    Cluster = cluster,
    TaskDefinition = taskDefinition,
    DeploymentController = new DeploymentController {
        Type = DeploymentControllerType.CODE_DEPLOY
    }
});

new EcsDeploymentGroup(this, "BlueGreenDG", new EcsDeploymentGroupProps {
    Service = service,
    BlueGreenDeploymentConfig = new EcsBlueGreenDeploymentConfig {
        BlueTargetGroup = blueTargetGroup,
        GreenTargetGroup = greenTargetGroup,
        Listener = listener
    },
    DeploymentConfig = EcsDeploymentConfig.CANARY_10PERCENT_5MINUTES
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var myApplication EcsApplication
var cluster Cluster
var taskDefinition FargateTaskDefinition
var blueTargetGroup ITargetGroup
var greenTargetGroup ITargetGroup
var listener IApplicationListener


service := ecs.NewFargateService(this, jsii.String("Service"), &FargateServiceProps{
	Cluster: Cluster,
	TaskDefinition: TaskDefinition,
	DeploymentController: &DeploymentController{
		Type: ecs.DeploymentControllerType_CODE_DEPLOY,
	},
})

codedeploy.NewEcsDeploymentGroup(this, jsii.String("BlueGreenDG"), &EcsDeploymentGroupProps{
	Service: Service,
	BlueGreenDeploymentConfig: &EcsBlueGreenDeploymentConfig{
		BlueTargetGroup: *BlueTargetGroup,
		GreenTargetGroup: *GreenTargetGroup,
		Listener: *Listener,
	},
	DeploymentConfig: codedeploy.EcsDeploymentConfig_CANARY_10PERCENT_5MINUTES(),
})

Properties ​

alarmsoptionalIAlarmRef[]alarmsoptionaltyping.List[IAlarmRef]alarmsoptionalList<IAlarmRef>AlarmsoptionalIAlarmRef[]Alarmsoptional*[]IAlarmRef = [] #
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.

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

Default: One will be created for you.

autoRollbackoptionalAutoRollbackConfigauto_rollbackoptionalAutoRollbackConfigautoRollbackoptionalAutoRollbackConfigAutoRollbackoptionalAutoRollbackConfigAutoRollbackoptionalAutoRollbackConfig #
The auto-rollback configuration for this Deployment Group.

Default: default AutoRollbackConfig.

blueGreenDeploymentConfigEcsBlueGreenDeploymentConfigblue_green_deployment_configEcsBlueGreenDeploymentConfigblueGreenDeploymentConfigEcsBlueGreenDeploymentConfigBlueGreenDeploymentConfigEcsBlueGreenDeploymentConfigBlueGreenDeploymentConfigEcsBlueGreenDeploymentConfig required #
The configuration options for blue-green ECS deployments.
deploymentConfigoptionalIDeploymentConfigRefdeployment_configoptionalIDeploymentConfigRefdeploymentConfigoptionalIDeploymentConfigRefDeploymentConfigoptionalIDeploymentConfigRefDeploymentConfigoptionalIDeploymentConfigRef = EcsDeploymentConfig.ALL_AT_ONCE #
The Deployment Configuration this Deployment Group uses.
deploymentGroupNameoptionalstringdeployment_group_nameoptionalstrdeploymentGroupNameoptionalStringDeploymentGroupNameoptionalstringDeploymentGroupNameoptional*string #
The physical, human-readable name of the CodeDeploy Deployment Group.

Default: An auto-generated name will be used.

ignoreAlarmConfigurationoptionalbooleanignore_alarm_configurationoptionalboolignoreAlarmConfigurationoptionalBooleanIgnoreAlarmConfigurationoptionalboolIgnoreAlarmConfigurationoptional*bool = false #
Whether to skip the step of checking CloudWatch alarms during the deployment process.
ignorePollAlarmsFailureoptionalbooleanignore_poll_alarms_failureoptionalboolignorePollAlarmsFailureoptionalBooleanIgnorePollAlarmsFailureoptionalboolIgnorePollAlarmsFailureoptional*bool = false #
Whether to continue a deployment even if fetching the alarm status from CloudWatch failed.
roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole #
The service Role of this Deployment Group.

Default: A new Role will be created.

serviceIBaseServiceserviceIBaseServiceserviceIBaseServiceServiceIBaseServiceServiceIBaseService required #
The ECS service to deploy with this Deployment Group.