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 Respuestas
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
EXPERTO
Peter_G
respondido hace 2 años
  • 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
respondido hace 2 años
0
Respuesta aceptada

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
respondido hace 2 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas