How to tell Amplify I need to use different backend from different AWS account?


Hi, I started a web-app, with the backend first, using the CDK. I set-up a pipeline following best-practices, that is:

  • dev account: deploy backend to own account;
  • gamma account: deploy backend to a gamma specific account;
  • prod account: deploy backend to a prod specific account;
  • pipeline is actually in gamma account, and deploy the CDK to gamma, then to prod

Then I started working on the frontend with Amplify. I did not realized that Amplify could generated backend as well. My bad. But anyway, I was able to have amplify set-up in the prod account, that is connected to a prod backend environment (that only contains the auth imported Cognito pooled that is created by the CDK backend in the Prod account).

For deployment purpose, I would like the following:

  1. developers checkout the frontend code, specifies to amplify the backend should be the one generated by the CDK in their own dev account, so they can test in full;
  2. when developer commit and push to gitlab (could be in a gamma git branch), some integration tests are run in gamma account (that means some setup are done for the frontend/amplify to use the CDK generated gamma backend).
  3. at some point, the frontend code is merged (automatically or manually) to git/main, and flows such that amplify deploy this frontend connected to the CDK generated prod backend.

The backend continues to live on its own, and is deployed according to commit/push made on the backend branch, with the CDK pipeline deploying to the different accounts accordingly.

I'm not sure how to tune Amplify for such a thing.

How to tell amplify, at least locally, that the backend to use is the one from another AWS account (the dev one for now)?

1 Answer

Hi, I think that this article "Challenges in deploying Amplify on multiple AWS accounts" may be very helpful for what you're trying to achiveve.


Best, Didier

profile pictureAWS
answered 10 months ago

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