Using the AWS CodeDeploy task

Still need help?

The Atlassian Community is here for you.

Ask the community

With the AWS CodeDeploy task for Bamboo you can deploy applications to EC2 instances automatically, reliably, and rapidly. Additionally, AWS CodeDeploy keeps track of the whole deployment process.

On this page:

Overview

The AWS CodeDeploy task compresses the specified directory with an AppSpec file into a .zip file, uploads the file to Amazon S3, and starts the deployment according to the configuration provided in the CodeDeploy application.

Before you begin

There are several requirements that must be met before you can start using the AWS CodeDeploy task. In short, you must configure the following in your AWS Management Console:

  • an EC2 instance with a tagged deployment group
  • a CodeDeploy application
  • an IAM user

  • an S3 bucket

For more guidelines about your AWS configuration, see AWS CodeDeploy configuration for Bamboo.

The content that you want to be zipped and deployed requires a specific structure. For more information, see Preparing files for deployment.

Adding an AWS CodeDeploy task to a Bamboo plan

To use the CodeDeploy task:

  1. Go to the plan configuration.
  2. Select Add task.
  3. Select AWS CodeDeploy.
  4. Provide the following details:


    FieldDescription
    Task descriptionA short description of the task.
    Disable this taskSelect the check box to skip this task in the build.
    Add condition to task Make task run only when a certain condition is met. 
    You can find conditions on Atlassian Marketplace or implement your own.  
    AWS credentials

    You can select existing AWS credentials from the list or add new AWS credentials. The newly created AWS credentials are added to the shared credentials list in Bamboo.  

    To make existing AWS credentials available for selection within the AWS CodeDeploy task in Bamboo, add them to Shared credentials.

    Region

    A region in which the application is deployed.

    Deployable content directory

    Location of the directory that contains the deployable content and an AppSpec file. By default, it is the root build directory. The content of the directory is compressed into a .zip file and sent to Amazon S3 bucket for deployment. For more information, see Preparing files for deployment.

    Amazon S3 bucketThe name of an S3 bucket from which the deployable content (your app and the AppSpec file) is deployed. Start typing to open a selection list of the existing S3 buckets that are available for the AWS credentials provided in the task configuration. For more information, see Amazon S3 bucket.
    Application nameThe name of the CodeDeploy application that you created in the AWS management console. For more information, see AWS CodeDeploy application.
    Deployment groupStart typing to open a list of deployment groups available for the Application name specified in the previous step.

AWS CodeDeploy configuration for Bamboo

The infrastructure setup is described in detail by AWS. For more information, see Getting Started with AWS CodeDeploy.

Atlassian provides guidelines for the following:

IAM user

We recommend creating a dedicated CodeDeploy IAM user or group.

The following policy gives full permissions to Amazon S3 buckets, CodeDeploy application and deployment group:


{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "codedeploy:*",
                "s3:*"
            ],
            "Resource": "*"
        }
    ]
}

For more examples of policies, see Bucket Policy Examples.

AWS CodeDeploy application

Each CodeDeploy application holds information about the deployment configuration.

For more information, see Create an Application with AWS CodeDeploy.

Amazon S3 bucket

An Amazon S3 bucket must exist. We recommend creating a dedicated CodeDeploy S3 bucket that is located in the same region as the instances to which you want to deploy the application.

For more information about how to grant access to S3 buckets, see IAM user.








To make existing AWS credentials available for selection within the AWS CodeDeploy task in Bamboo, add them to Shared credentials.




Preparing files for deployment

The deployable content that is compressed and sent to an Amazon S3 bucket is called a revision and it consists of the application and an AppSpec (Application Specification) file.

Examples of revisions


Last modified on Jul 18, 2021

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.