Show / Hide Table of Contents

Class DeploymentGroup

Provides a CodeDeploy Deployment Group for a CodeDeploy Application

NOTE on blue/green deployments: When using green_fleet_provisioning_option with the COPY_AUTO_SCALING_GROUP action, CodeDeploy will create a new ASG with a different name. This ASG is not managed by this provider and will conflict with existing configuration and state. You may want to use a different approach to managing deployments that involve multiple ASG, such as DISCOVER_EXISTING with separate blue and green ASG.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var exampleRole = new Aws.Iam.Role("exampleRole", new Aws.Iam.RoleArgs
    {
        AssumeRolePolicy = @"{
""Version"": ""2012-10-17"",
""Statement"": [
{
  ""Sid"": """",
  ""Effect"": ""Allow"",
  ""Principal"": {
    ""Service"": ""codedeploy.amazonaws.com""
  },
  ""Action"": ""sts:AssumeRole""
}
]
}

",
    });
    var aWSCodeDeployRole = new Aws.Iam.RolePolicyAttachment("aWSCodeDeployRole", new Aws.Iam.RolePolicyAttachmentArgs
    {
        PolicyArn = "arn:aws:iam::aws:policy/service-role/AWSCodeDeployRole",
        Role = exampleRole.Name,
    });
    var exampleApplication = new Aws.CodeDeploy.Application("exampleApplication", new Aws.CodeDeploy.ApplicationArgs
    {
    });
    var exampleTopic = new Aws.Sns.Topic("exampleTopic", new Aws.Sns.TopicArgs
    {
    });
    var exampleDeploymentGroup = new Aws.CodeDeploy.DeploymentGroup("exampleDeploymentGroup", new Aws.CodeDeploy.DeploymentGroupArgs
    {
        AlarmConfiguration = new Aws.CodeDeploy.Inputs.DeploymentGroupAlarmConfigurationArgs
        {
            Alarms = 
            {
                "my-alarm-name",
            },
            Enabled = true,
        },
        AppName = exampleApplication.Name,
        AutoRollbackConfiguration = new Aws.CodeDeploy.Inputs.DeploymentGroupAutoRollbackConfigurationArgs
        {
            Enabled = true,
            Events = 
            {
                "DEPLOYMENT_FAILURE",
            },
        },
        DeploymentGroupName = "example-group",
        Ec2TagSets = 
        {
            new Aws.CodeDeploy.Inputs.DeploymentGroupEc2TagSetArgs
            {
                Ec2TagFilter = 
                {

                    {
                        { "key", "filterkey1" },
                        { "type", "KEY_AND_VALUE" },
                        { "value", "filtervalue" },
                    },

                    {
                        { "key", "filterkey2" },
                        { "type", "KEY_AND_VALUE" },
                        { "value", "filtervalue" },
                    },
                },
            },
        },
        ServiceRoleArn = exampleRole.Arn,
        TriggerConfigurations = 
        {
            new Aws.CodeDeploy.Inputs.DeploymentGroupTriggerConfigurationArgs
            {
                TriggerEvents = 
                {
                    "DeploymentFailure",
                },
                TriggerName = "example-trigger",
                TriggerTargetArn = exampleTopic.Arn,
            },
        },
    });
}

}

Blue Green Deployments with ECS

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var exampleApplication = new Aws.CodeDeploy.Application("exampleApplication", new Aws.CodeDeploy.ApplicationArgs
    {
        ComputePlatform = "ECS",
    });
    var exampleDeploymentGroup = new Aws.CodeDeploy.DeploymentGroup("exampleDeploymentGroup", new Aws.CodeDeploy.DeploymentGroupArgs
    {
        AppName = exampleApplication.Name,
        AutoRollbackConfiguration = new Aws.CodeDeploy.Inputs.DeploymentGroupAutoRollbackConfigurationArgs
        {
            Enabled = true,
            Events = 
            {
                "DEPLOYMENT_FAILURE",
            },
        },
        BlueGreenDeploymentConfig = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigArgs
        {
            DeploymentReadyOption = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigDeploymentReadyOptionArgs
            {
                ActionOnTimeout = "CONTINUE_DEPLOYMENT",
            },
            TerminateBlueInstancesOnDeploymentSuccess = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigTerminateBlueInstancesOnDeploymentSuccessArgs
            {
                Action = "TERMINATE",
                TerminationWaitTimeInMinutes = 5,
            },
        },
        DeploymentConfigName = "CodeDeployDefault.ECSAllAtOnce",
        DeploymentGroupName = "example",
        DeploymentStyle = new Aws.CodeDeploy.Inputs.DeploymentGroupDeploymentStyleArgs
        {
            DeploymentOption = "WITH_TRAFFIC_CONTROL",
            DeploymentType = "BLUE_GREEN",
        },
        EcsService = new Aws.CodeDeploy.Inputs.DeploymentGroupEcsServiceArgs
        {
            ClusterName = aws_ecs_cluster.Example.Name,
            ServiceName = aws_ecs_service.Example.Name,
        },
        LoadBalancerInfo = new Aws.CodeDeploy.Inputs.DeploymentGroupLoadBalancerInfoArgs
        {
            TargetGroupPairInfo = new Aws.CodeDeploy.Inputs.DeploymentGroupLoadBalancerInfoTargetGroupPairInfoArgs
            {
                ProdTrafficRoute = new Aws.CodeDeploy.Inputs.DeploymentGroupLoadBalancerInfoTargetGroupPairInfoProdTrafficRouteArgs
                {
                    ListenerArns = 
                    {
                        aws_lb_listener.Example.Arn,
                    },
                },
                TargetGroup = 
                {

                    {
                        { "name", aws_lb_target_group.Blue.Name },
                    },

                    {
                        { "name", aws_lb_target_group.Green.Name },
                    },
                },
            },
        },
        ServiceRoleArn = aws_iam_role.Example.Arn,
    });
}

}

Blue Green Deployments with Servers and Classic ELB

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var exampleApplication = new Aws.CodeDeploy.Application("exampleApplication", new Aws.CodeDeploy.ApplicationArgs
    {
    });
    var exampleDeploymentGroup = new Aws.CodeDeploy.DeploymentGroup("exampleDeploymentGroup", new Aws.CodeDeploy.DeploymentGroupArgs
    {
        AppName = exampleApplication.Name,
        BlueGreenDeploymentConfig = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigArgs
        {
            DeploymentReadyOption = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigDeploymentReadyOptionArgs
            {
                ActionOnTimeout = "STOP_DEPLOYMENT",
                WaitTimeInMinutes = 60,
            },
            GreenFleetProvisioningOption = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigGreenFleetProvisioningOptionArgs
            {
                Action = "DISCOVER_EXISTING",
            },
            TerminateBlueInstancesOnDeploymentSuccess = new Aws.CodeDeploy.Inputs.DeploymentGroupBlueGreenDeploymentConfigTerminateBlueInstancesOnDeploymentSuccessArgs
            {
                Action = "KEEP_ALIVE",
            },
        },
        DeploymentGroupName = "example-group",
        DeploymentStyle = new Aws.CodeDeploy.Inputs.DeploymentGroupDeploymentStyleArgs
        {
            DeploymentOption = "WITH_TRAFFIC_CONTROL",
            DeploymentType = "BLUE_GREEN",
        },
        LoadBalancerInfo = new Aws.CodeDeploy.Inputs.DeploymentGroupLoadBalancerInfoArgs
        {
            ElbInfo = 
            {

                {
                    { "name", aws_elb.Example.Name },
                },
            },
        },
        ServiceRoleArn = aws_iam_role.Example.Arn,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
DeploymentGroup
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.CodeDeploy
Assembly: Pulumi.Aws.dll
Syntax
public class DeploymentGroup : CustomResource

Constructors

View Source

DeploymentGroup(String, DeploymentGroupArgs, CustomResourceOptions)

Create a DeploymentGroup resource with the given unique name, arguments, and options.

Declaration
public DeploymentGroup(string name, DeploymentGroupArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

DeploymentGroupArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

AlarmConfiguration

Configuration block of alarms associated with the deployment group (documented below).

Declaration
public Output<DeploymentGroupAlarmConfiguration> AlarmConfiguration { get; }
Property Value
Type Description
Output<DeploymentGroupAlarmConfiguration>
View Source

AppName

The name of the application.

Declaration
public Output<string> AppName { get; }
Property Value
Type Description
Output<System.String>
View Source

AutoRollbackConfiguration

Configuration block of the automatic rollback configuration associated with the deployment group (documented below).

Declaration
public Output<DeploymentGroupAutoRollbackConfiguration> AutoRollbackConfiguration { get; }
Property Value
Type Description
Output<DeploymentGroupAutoRollbackConfiguration>
View Source

AutoscalingGroups

Autoscaling groups associated with the deployment group.

Declaration
public Output<ImmutableArray<string>> AutoscalingGroups { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<System.String>>
View Source

BlueGreenDeploymentConfig

Configuration block of the blue/green deployment options for a deployment group (documented below).

Declaration
public Output<DeploymentGroupBlueGreenDeploymentConfig> BlueGreenDeploymentConfig { get; }
Property Value
Type Description
Output<DeploymentGroupBlueGreenDeploymentConfig>
View Source

DeploymentConfigName

The name of the group's deployment config. The default is "CodeDeployDefault.OneAtATime".

Declaration
public Output<string> DeploymentConfigName { get; }
Property Value
Type Description
Output<System.String>
View Source

DeploymentGroupName

The name of the deployment group.

Declaration
public Output<string> DeploymentGroupName { get; }
Property Value
Type Description
Output<System.String>
View Source

DeploymentStyle

Configuration block of the type of deployment, either in-place or blue/green, you want to run and whether to route deployment traffic behind a load balancer (documented below).

Declaration
public Output<DeploymentGroupDeploymentStyle> DeploymentStyle { get; }
Property Value
Type Description
Output<DeploymentGroupDeploymentStyle>
View Source

Ec2TagFilters

Tag filters associated with the deployment group. See the AWS docs for details.

Declaration
public Output<ImmutableArray<DeploymentGroupEc2TagFilter>> Ec2TagFilters { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<DeploymentGroupEc2TagFilter>>
View Source

Ec2TagSets

Configuration block(s) of Tag filters associated with the deployment group, which are also referred to as tag groups (documented below). See the AWS docs for details.

Declaration
public Output<ImmutableArray<DeploymentGroupEc2TagSet>> Ec2TagSets { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<DeploymentGroupEc2TagSet>>
View Source

EcsService

Configuration block(s) of the ECS services for a deployment group (documented below).

Declaration
public Output<DeploymentGroupEcsService> EcsService { get; }
Property Value
Type Description
Output<DeploymentGroupEcsService>
View Source

LoadBalancerInfo

Single configuration block of the load balancer to use in a blue/green deployment (documented below).

Declaration
public Output<DeploymentGroupLoadBalancerInfo> LoadBalancerInfo { get; }
Property Value
Type Description
Output<DeploymentGroupLoadBalancerInfo>
View Source

OnPremisesInstanceTagFilters

On premise tag filters associated with the group. See the AWS docs for details.

Declaration
public Output<ImmutableArray<DeploymentGroupOnPremisesInstanceTagFilter>> OnPremisesInstanceTagFilters { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<DeploymentGroupOnPremisesInstanceTagFilter>>
View Source

ServiceRoleArn

The service role ARN that allows deployments.

Declaration
public Output<string> ServiceRoleArn { get; }
Property Value
Type Description
Output<System.String>
View Source

TriggerConfigurations

Configuration block(s) of the triggers for the deployment group (documented below).

Declaration
public Output<ImmutableArray<DeploymentGroupTriggerConfiguration>> TriggerConfigurations { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<DeploymentGroupTriggerConfiguration>>

Methods

View Source

Get(String, Input<String>, DeploymentGroupState, CustomResourceOptions)

Get an existing DeploymentGroup resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static DeploymentGroup Get(string name, Input<string> id, DeploymentGroupState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

DeploymentGroupState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
DeploymentGroup
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.