Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to deploy to AWS Codedeploy with multiple Deployment Groups?

gbrown
Contributor
January 8, 2020 edited

I am following the Deploy to AWS with CodeDeploy guide found on this site but i am struggling with how to deploy to more than 1 deployment group in the same code deploy application. Should I create a repository variable for each deployment group?

To be clear, I want to be able to pick which deployment group I deploy to because i have more than 1.

1 answer

1 vote
Alexander Zhukov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 17, 2020 edited

Hi @gbrown , if you wan't to be able to select a deployment group to deploy to, you should use the DEPLOYMENT_GROUP pipe variable. For example, this is how you would deploy to a staging and production deployment groups:

image: atlassian/default-image:2

pipelines:
  default:
    - step:
        name: Build
        script:
          - cd app && zip -r ../myapp.zip *
        artifacts:
          - myapp.zip

    - step:
        name: Upload to S3
        script:
          - pipe: atlassian/aws-code-deploy:0.2.10
            variables:
              AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
              AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
              AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
              COMMAND: 'upload'
              APPLICATION_NAME: ${APPLICATION_NAME}
              ZIP_FILE: 'myapp.zip'

    - step:
        name: Deploy to Staging
        deployment: Staging
        script:
        - pipe: atlassian/aws-code-deploy:0.2.10
          variables:

DEPLOYMENT_GROUP: staging-deployment-group
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION} COMMAND: 'deploy' APPLICATION_NAME: ${APPLICATION_NAME} WAIT: 'true'

- step:
name: Deploy to Prod
deployment: Production
script:
- pipe: atlassian/aws-code-deploy:0.2.10
variables:

DEPLOYMENT_GROUP: production-deployment-group
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
COMMAND: 'deploy'
APPLICATION_NAME: ${APPLICATION_NAME}
WAIT: 'true'
Daniel Forer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 29, 2020

Hi @Alexander Zhukov ,

I came across this thread looking for the same solution as gbrown. I have a question though:

Would the proposed pipe above deploy to both Staging and Production in one go? I think it does.

How would I be able to choose in bitbucket which singular deployment group I will deploy to? Just QA or just Staging or just Prod?

 

Thanks

Dan

Abryan Manalansang August 16, 2020

I have the same issue. @gbrown and @Daniel Forer were you able to solve this?

Abryan Manalansang August 18, 2020

@Alexander Zhukov how does this work if you can only define one DEPLOYMENT_GROUP variable in the Repository variables?

 

    - step:
        name: Deploy to Staging
        deployment: Staging
        script:
        - pipe: atlassian/aws-code-deploy:0.2.10
          variables:

DEPLOYMENT_GROUP: staging-deployment-group
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID} AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY} AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION} COMMAND: 'deploy' APPLICATION_NAME: ${APPLICATION_NAME} WAIT: 'true'

- step:
name: Deploy to Prod
deployment: Production
script:
- pipe: atlassian/aws-code-deploy:0.2.10
variables:

DEPLOYMENT_GROUP: production-deployment-group
AWS_ACCESS_KEY_ID: ${AWS_ACCESS_KEY_ID}
AWS_SECRET_ACCESS_KEY: ${AWS_SECRET_ACCESS_KEY}
AWS_DEFAULT_REGION: ${AWS_DEFAULT_REGION}
COMMAND: 'deploy'
APPLICATION_NAME: ${APPLICATION_NAME}
WAIT: 'true'R 

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, team ’25 europe, early bird extension, conference discount, barcelona, hybrid event, AI teamwork, early bird pass, digital access, collaboration conference, atlassian events, register now, developer conference

1 week left to save on your Team '25 Europe pass

Still thinking about joining us for Team '25 Europe? Early bird has been extended for just one week! Now’s the time to lock in your lowest rate. Use code TEU25COMM-20 to save 20% at checkout. Hurry, this only lasts for 1 more week.

Learn more
AUG Leaders

Atlassian Community Events