Deploy to elastic beanstalk across accounts

0

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.

Thanks

3 個答案
1

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
AWS
專家
Peter_G
已回答 2 年前
  • 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.

1

CloudFormation manages all the calls to the backend AWS APIs for you. You can run the same CloudFormation template in multiple accounts or multiple regions, and it will create identical environments across them.

profile picture
已回答 2 年前
0
已接受的答案

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

https://aws.amazon.com/blogs/devops/cross-account-ci-cd-pipeline-single-tenant-saas/

https://aws.amazon.com/blogs/devops/aws-building-a-secure-cross-account-continuous-delivery-pipeline/

PaulR
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南