Show / Hide Table of Contents

Namespace Pulumi.Aws.CodeDeploy

Classes

Application

Provides a CodeDeploy application to be used as a basis for deployments

Example Usage

ECS Application

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var example = new Aws.CodeDeploy.Application("example", new Aws.CodeDeploy.ApplicationArgs
    {
        ComputePlatform = "ECS",
    });
}

}

Lambda Application

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var example = new Aws.CodeDeploy.Application("example", new Aws.CodeDeploy.ApplicationArgs
    {
        ComputePlatform = "Lambda",
    });
}

}

Server Application

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var example = new Aws.CodeDeploy.Application("example", new Aws.CodeDeploy.ApplicationArgs
    {
        ComputePlatform = "Server",
    });
}

}

ApplicationArgs

ApplicationState

DeploymentConfig

Provides a CodeDeploy deployment config for an application

Example Usage

Server Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var fooDeploymentConfig = new Aws.CodeDeploy.DeploymentConfig("fooDeploymentConfig", new Aws.CodeDeploy.DeploymentConfigArgs
    {
        DeploymentConfigName = "test-deployment-config",
        MinimumHealthyHosts = new Aws.CodeDeploy.Inputs.DeploymentConfigMinimumHealthyHostsArgs
        {
            Type = "HOST_COUNT",
            Value = 2,
        },
    });
    var fooDeploymentGroup = new Aws.CodeDeploy.DeploymentGroup("fooDeploymentGroup", new Aws.CodeDeploy.DeploymentGroupArgs
    {
        AlarmConfiguration = new Aws.CodeDeploy.Inputs.DeploymentGroupAlarmConfigurationArgs
        {
            Alarms = 
            {
                "my-alarm-name",
            },
            Enabled = true,
        },
        AppName = aws_codedeploy_app.Foo_app.Name,
        AutoRollbackConfiguration = new Aws.CodeDeploy.Inputs.DeploymentGroupAutoRollbackConfigurationArgs
        {
            Enabled = true,
            Events = 
            {
                "DEPLOYMENT_FAILURE",
            },
        },
        DeploymentConfigName = fooDeploymentConfig.Id,
        DeploymentGroupName = "bar",
        Ec2TagFilters = 
        {
            new Aws.CodeDeploy.Inputs.DeploymentGroupEc2TagFilterArgs
            {
                Key = "filterkey",
                Type = "KEY_AND_VALUE",
                Value = "filtervalue",
            },
        },
        ServiceRoleArn = aws_iam_role.Foo_role.Arn,
        TriggerConfigurations = 
        {
            new Aws.CodeDeploy.Inputs.DeploymentGroupTriggerConfigurationArgs
            {
                TriggerEvents = 
                {
                    "DeploymentFailure",
                },
                TriggerName = "foo-trigger",
                TriggerTargetArn = "foo-topic-arn",
            },
        },
    });
}

}

Lambda Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var fooDeploymentConfig = new Aws.CodeDeploy.DeploymentConfig("fooDeploymentConfig", new Aws.CodeDeploy.DeploymentConfigArgs
    {
        ComputePlatform = "Lambda",
        DeploymentConfigName = "test-deployment-config",
        TrafficRoutingConfig = new Aws.CodeDeploy.Inputs.DeploymentConfigTrafficRoutingConfigArgs
        {
            TimeBasedLinear = new Aws.CodeDeploy.Inputs.DeploymentConfigTrafficRoutingConfigTimeBasedLinearArgs
            {
                Interval = 10,
                Percentage = 10,
            },
            Type = "TimeBasedLinear",
        },
    });
    var fooDeploymentGroup = new Aws.CodeDeploy.DeploymentGroup("fooDeploymentGroup", new Aws.CodeDeploy.DeploymentGroupArgs
    {
        AlarmConfiguration = new Aws.CodeDeploy.Inputs.DeploymentGroupAlarmConfigurationArgs
        {
            Alarms = 
            {
                "my-alarm-name",
            },
            Enabled = true,
        },
        AppName = aws_codedeploy_app.Foo_app.Name,
        AutoRollbackConfiguration = new Aws.CodeDeploy.Inputs.DeploymentGroupAutoRollbackConfigurationArgs
        {
            Enabled = true,
            Events = 
            {
                "DEPLOYMENT_STOP_ON_ALARM",
            },
        },
        DeploymentConfigName = fooDeploymentConfig.Id,
        DeploymentGroupName = "bar",
        ServiceRoleArn = aws_iam_role.Foo_role.Arn,
    });
}

}

DeploymentConfigArgs

DeploymentConfigState

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,
    });
}

}

DeploymentGroupArgs

DeploymentGroupState

Back to top Copyright 2016-2020, Pulumi Corporation.