By using AWS re:Post, you agree to the Terms of Use
/Deploy to elastic beanstalk across accounts/

Deploy to elastic beanstalk across accounts


Currently we have all our environments on one account, we use CodePipeline to deploy to a test environment then approve to production environment. We are splitting our environments to exist in different accounts.

How can we get codepipeline to deploy to elastic beanstalk in another account? Ideally we still want the ability to see it is/has deployed successfully/failed

Looking at CloudFormation for CodePipeline creation, i cannot see anything about deploying across accounts for beanstalk. I cannot see anything in CloudFormation to deploy the update via CloudFormation. It seems the only option is using the EB cli or aws cli.


2 Answers
Accepted Answer

Resolved, support gave me some help.

Basically for the action stage you can set a RoleARN, this role should be on the account you wish to deploy to, then the beanstalk app and environment is scoped to that account rather than the account where the pipeline is running.

I found you will need to allow the target account to have access to the pipeline account artifact bucket.

Also it's best to set your own KMS key for the source stage as you can then allow the target accounts use this KMS key

Support gave me some links as well

answered 2 months ago

I have used cloudformation to deploy EB environments with a lot of success. I didn't use cross account but see no obvious technical blockers however there is some additional iam complexity. Here is some steps.

  1. build your application artifact as normal eg WAR file
  2. Create a deploy action to copy WAR file to cross account bucket - see here
  3. Trigger a cross account cloudformation stack with the updated WAR artifact as a parameter - see here. When cloudformation detects the ApplicationVersion source files have changed this will trigger a new resource which will trigger the version attribute with the environment resource to be updated triggering the deployment
answered 3 months ago
  • Think is I cannot find what properties I would need to update in the cloudformation stack that would deploy that code, which attribute do I need to change? I've taken a look at my existing environments and cannot find any reference to the application version.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions