Menu
AWS CloudFormation
User Guide (API Version 2010-05-15)

AWS::CodeDeploy::DeploymentGroup

The AWS::CodeDeploy::DeploymentGroup resource creates an AWS CodeDeploy deployment group that details which application revision to use and which instances your application revisions are deployed to.

Syntax

To declare this entity in your AWS CloudFormation template, use the following syntax:

JSON

Copy
{ "Type" : "AWS::CodeDeploy::DeploymentGroup", "Properties" : { "ApplicationName" : String, "AutoScalingGroups" : [ String, ... ], "Deployment" : Deployment, "DeploymentConfigName" : String, "DeploymentGroupName" : String, "Ec2TagFilters" : [ Ec2TagFilters, ... ], "OnPremisesInstanceTagFilters" : [ OnPremisesInstanceTagFilters, ... ], "ServiceRoleArn" : String } }

YAML

Copy
Type: "AWS::CodeDeploy::DeploymentGroup" Properties: ApplicationName: String AutoScalingGroups: - String Deployment: Deployment DeploymentConfigName: String DeploymentGroupName: String Ec2TagFilters: - Ec2TagFilters OnPremisesInstanceTagFilters: - OnPremisesInstanceTagFilters ServiceRoleArn: String

Properties

ApplicationName

The name of an AWS CodeDeploy application for this deployment group.

Required: Yes

Type: String

Update requires: Replacement

AutoScalingGroups

A list of associated Auto Scaling groups that AWS CodeDeploy automatically deploys revisions to when new instances are created.

Required: No

Type: List of strings

Update requires: No interruption

Deployment

The application revision that will be deployed to this deployment group.

Required: No

Type: AWS CodeDeploy DeploymentGroup Deployment

Update requires: No interruption

DeploymentConfigName

A deployment configuration name or a predefined configuration name. With predefined configurations, you can deploy application revisions to one instance at a time, half of the instances at a time, or all the instances at once. For more information and valid values, see the DeploymentConfigName parameter for the CreateDeploymentGroup action in the AWS CodeDeploy API Reference.

Required: No

Type: String

Update requires: No interruption

DeploymentGroupName

A name for the deployment group. If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the deployment group name. For more information, see Name Type.

Important

If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.

Required: No

Type: String

Update requires: Replacement

Ec2TagFilters

The Amazon EC2 tags to filter on. AWS CodeDeploy includes all instances that match the tag filter with this deployment group.

Required: No

Type: AWS CodeDeploy DeploymentGroup Ec2TagFilters

Update requires: No interruption

OnPremisesInstanceTagFilters

The on-premises instance tags to filter on. AWS CodeDeploy includes all on-premises instances that match the tag filter with this deployment group. To register on-premises instances with AWS CodeDeploy, see Configure Existing On-Premises Instances by Using AWS CodeDeploy in the AWS CodeDeploy User Guide.

Required: No

Type: AWS CodeDeploy DeploymentGroup OnPremisesInstanceTagFilters

Update requires: No interruption

ServiceRoleArn

A service role Amazon Resource Name (ARN) that grants AWS CodeDeploy permission to make calls to AWS services on your behalf. For more information, see Create a Service Role for AWS CodeDeploy in the AWS CodeDeploy User Guide.

Note

In some cases, you might need to add a dependency on the service role's policy. For more information, see IAM role policy in DependsOn Attribute.

Required: Yes

Type: String

Update requires: No interruption

Return Value

Ref

When you pass the logical ID of an AWS::CodeDeploy::DeploymentGroup resource to the intrinsic Ref function, the function returns the deployment group name, such as mydeploymentgroup-a123d0d1.

For more information about using the Ref function, see Ref.

Example

Revision in GitHub

The following example creates a deployment group that is associated with Auto Scaling groups and uses an application revision that is stored in a GitHub repository. You specify the repository information as input parameters.

JSON

Copy
"DeploymentGroup" : { "Type" : "AWS::CodeDeploy::DeploymentGroup", "Properties" : { "ApplicationName" : {"Ref" : "ApplicationName"}, "AutoScalingGroups" : [ {"Ref" : "CodeDeployAutoScalingGroups" } ], "Deployment" : { "Description" : "A sample deployment", "IgnoreApplicationStopFailures" : "true", "Revision" : { "RevisionType" : "GitHub", "GitHubLocation" : { "CommitId" : {"Ref" : "CommitId"}, "Repository" : {"Ref" : "Repository"} } } }, "ServiceRoleArn" : {"Ref" : "RoleArn"} } }

YAML

Copy
DeploymentGroup: Type: "AWS::CodeDeploy::DeploymentGroup" Properties: ApplicationName: Ref: "ApplicationName" AutoScalingGroups: - Ref: CodeDeployAutoScalingGroups Deployment: Description: "A sample deployment" IgnoreApplicationStopFailures: true Revision: RevisionType: GitHub GitHubLocation: CommitId: Ref: CommitId Repository: Ref: Repository ServiceRoleArn: Ref: RoleArn

Associate EC2 Instances

The following example creates a deployment group that uses instance tags to associate EC2 instances with the deployment group. The deployment group uses an application revision that is stored in an S3 bucket.

JSON

Copy
"DeploymentGroup" : { "Type" : "AWS::CodeDeploy::DeploymentGroup", "Properties" : { "ApplicationName" : {"Ref" : "Application"}, "Deployment" : { "Description" : "First time", "IgnoreApplicationStopFailures" : "true", "Revision" : { "RevisionType" : "S3", "S3Location" : { "Bucket" : {"Ref" : "Bucket"}, "Key" : {"Ref" : "Key"}, "BundleType" : "Zip", "ETag" : {"Ref" : "ETag"}, "Version" : {"Ref" : "Version"} } } }, "Ec2TagFilters" : [{ "Key" : {"Ref" : "TagKey"}, "Value" : {"Ref" : "TagValue"}, "Type" : "KEY_AND_VALUE" }], "ServiceRoleArn" : {"Ref" : "RoleArn"} } }

YAML

Copy
DeploymentGroup: Type: "AWS::CodeDeploy::DeploymentGroup" Properties: ApplicationName: Ref: "Application" Deployment: Description: "First time" IgnoreApplicationStopFailures: true Revision: RevisionType: S3 S3Location: Bucket: Ref: Bucket Key: Ref: Key BundleType: Zip ETag: Ref: ETag Version: Ref: Version Ec2TagFilters: - Key: Ref: TagKey Value: Ref: TagValue Type: "KEY_AND_VALUE" ServiceRoleArn: Ref: RoleArn