I have an existing Bitbucket Pipelines setup with AWS CodeDeploy that works on single region. Now I'm trying to modify the existing setup to cater for multi region deployment. Here's my bitbucket-pipelines.yml:
image: php:7.1.29
pipelines:
branches:
develop:
- step:
caches:
- composer
script:
- apt-get update && apt-get install -y unzip zip
- zip -r MobileAPIDEV.zip .
- pipe: atlassian/aws-code-deploy:0.5.3
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: 'MobileAPIDEV'
ZIP_FILE: 'MobileAPIDEV.zip'
COMMAND: 'upload'
S3_BUCKET: $S3_BUCKET
- pipe: atlassian/aws-code-deploy:0.5.3
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: 'MobileAPIDEV'
DEPLOYMENT_GROUP: 'MobileAPIDEV'
WAIT: 'false'
S3_BUCKET: $S3_BUCKET
COMMAND: 'deploy'
IGNORE_APPLICATION_STOP_FAILURES: 'true'
FILE_EXISTS_BEHAVIOR: 'OVERWRITE'
master:
- step:
caches:
- composer
script:
- apt-get update && apt-get install -y unzip zip
- zip -r prodMobileAPI.zip .
- pipe: atlassian/aws-code-deploy:0.5.3
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: 'prodMobileAPI'
ZIP_FILE: 'prodMobileAPI.zip'
COMMAND: 'upload'
S3_BUCKET: $S3_BUCKET
- pipe: atlassian/aws-code-deploy:0.5.3
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
APPLICATION_NAME: 'prodMobileAPI'
DEPLOYMENT_GROUP: 'prodMobileAPI'
WAIT: 'false'
S3_BUCKET: $S3_BUCKET
COMMAND: 'deploy'
IGNORE_APPLICATION_STOP_FAILURES: 'true'
FILE_EXISTS_BEHAVIOR: 'OVERWRITE'
- pipe: atlassian/aws-code-deploy:0.5.3
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY # Optional if already defined in the context.
AWS_DEFAULT_REGION: eu-central-1
APPLICATION_NAME: 'prodMobileAPI'
DEPLOYMENT_GROUP: 'prodMobileAPI'
WAIT: 'false'
S3_BUCKET: $S3_BUCKET
COMMAND: 'deploy'
IGNORE_APPLICATION_STOP_FAILURES: 'true'
FILE_EXISTS_BEHAVIOR: 'OVERWRITE'
I added the third pipe under master branch and set eu-central-1 as the new default region. I'm not sure if I'm doing it correctly because I couldn't find any example for multi region deployment using this approach.
When I tried to deploy, I got this error: An error occurred (RevisionDoesNotExistException) when calling the GetApplicationRevision operation: No application revision found for revision.
I confirm that my CodeDeploy setup in the other region has the correct role, and the Access Key that I used for the Bitbucket Pipeline has sufficient permission as well.