The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

AWS CodeDeploy Plugin for Jenkins

step([$class: 'AWSCodeDeployPublisher']): Deploy an application to AWS CodeDeploy

  • s3bucket
    The bucket in S3 where new AWS CodeDeploy revisions will be uploaded.
    • Type: String
  • s3prefix
    The prefix in the S3 Bucket to prepend to the AWS CodeDeploy revision. Default is the root of the bucket. You can use environment variables in this field.
    • Type: String
  • applicationName
    The name of the AWS CodeDeploy application you wish to deploy to. This plugin assumes that you've already created the application and deployment group. If you haven't already, work through the How to create an Application with AWS CodeDeploy documentation. You can use environment variables in this field.
    • Type: String
  • deploymentGroupName
    The name of the AWS CodeDeploy deployment group attached to your application that you want to deploy to. This plugin assumes that you've already created the application and deployment group. If you haven't already, work through the How to create an Application with AWS CodeDeploy documentation.
    • Type: String
  • deploymentConfig
    • Type: String
  • region
    • Type: String
  • deploymentGroupAppspec

    If checked, the build will use a dedicated appspec.yml file per deployment group.

    The appspec file should be named "appspec.DEPLOYMENT_GROUP_NAME.yml" and must be present in the jenkins project workspace.



    e.g.: appsec.staging.yml

    • Type: boolean
  • waitForCompletion

    If checked, this build will wait for the AWS CodeDeploy deployment to finish (with either success or failure). Polling Timeout, below, sets the maximum amount of time to wait.

    If unchecked, the deployment will be handed off to AWS CodeDeploy and the build will move on to the next step.

    The build will be marked a failure if either the timeout is reached or the deployment fails. The build log will indicate which.

    • Type: boolean
  • pollingTimeoutSec
    • Type: long
  • pollingFreqSec
    • Type: long
  • credentials
    • Type: String
  • versionFileName
    • Type: String
  • deploymentMethod
    • Type: String
  • awsAccessKey

    AWS Access and Secret keys to use for this deployment. At minimum the keys must be allowed to execute codedeploy:* and s3:Put*. It's a best practice to have these keys be from an IAM role with limited scope.

    If your Jenkins install is running on an EC2 instance with an associate IAM role, you can leave these fields blank. You will just need to ensure that the role has the correct policies.

    • Type: String
  • awsSecretKey

    AWS Access and Secret keys to use for this deployment. At minimum the keys must be allowed to execute codedeploy:* and s3:Put*. It's a best practice to have these keys be from an IAM role with limited scope.

    If your Jenkins install is running on an EC2 instance with an associate IAM role, you can leave these fields blank. You will just need to ensure that the role has the correct policies.

    • Type: String
  • iamRoleArn

    In order to keep your application(s) more secure, this plugin only uses temporary credentials via STS, scoped to each application. To set this up:

    1. Log into the AWS Management Console, and navigate to the Identity and Access Management console.
    2. Click on Roles, then click Create New Role.
    3. Give an appropriate name for this role (for example, "JenkinsCodeDeployProject").
    4. In the "Select Role Type" screen, click "Role for Cross-Account Access" then select Allows IAM users from a 3rd party AWS account to access this account.
    5. The account and external IDs for this Jenkins project are listed below
    6. In the policy screen, select Custom Policy and copy-paste the following policy:
      • {"Version": "2012-10-17", "Statement": [{"Effect": "Allow", "Action": ["codedeploy:*", "s3:*"], "Resource": "*"}]}
    7. Click Create Role, then copy-paste the Role ARN into the below field.
    8. Click the Test Connection button to ensure that the permissions are set up properly.
    • Type: String
  • externalId
    The External ID you should use in the IAM cross-account access policy.
    • Type: String
  • includes
    Includes and Excludes together define the file(s) that will be contained in the application revision that is uploaded to Amazon S3.
    • Type: String
  • proxyHost

    Proxy host DNS name

    • Type: String
  • proxyPort

    Proxy host port

    • Type: int
  • excludes
    Includes and Excludes together define the file(s) that will be contained in the application revision that is uploaded to Amazon S3.
    • Type: String
  • subdirectory
    A subdirectory inside the workspace to be packed instead of the whole workspace. Remember that the appspec.yml must be placed at the top of the .zip archive. The excludes and includes will be applied based on this path.
    • Type: String

Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

    


See existing feedback here.