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.
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'
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.