I want to migrate my AWS Elastic Beanstalk environment from one AWS account to another AWS account.
Short description
To migrate an Elastic Beanstalk environment between accounts, use saved configurations.
Saved configurations are stored in the Amazon Simple Storage Service (Amazon S3) bucket for Elastic Beanstalk in a folder with the same name as your application. The following is an example location of a saved configuration for an application that's named my-app in the us-east-1 AWS Region for account 01234567890:
s3://elasticbeanstalk-us-east-1-01234567890/resources/templates/my-app/
Resolution
In the following resolution, Account A is the account where the Elastic Beanstalk environment is located. Account B is the account where the Elastic Beanstalk environment is migrated to.
Note: In this example, Elastic Beanstalk environments are already created for both accounts. When you create the environment, Elastic Beanstalk creates the configuration. The environment is uploaded to the Amazon S3 bucket that's associated with Account B.
Save the configuration in Account A
Complete the following steps:
-
Save the configuration in Account A.
-
Download the saved configuration to your local machine from the S3 bucket.
Example S3 path:
s3://elasticbeanstalk-region-account-a-id/resources/templates/application-a-name/
-
Change your account-specific parameters in the downloaded configuration file, and then save the changes. For example, change the key pair name, subnet ID, or application name such as, application-b-name.
Use the saved configuration to create an Elastic Beanstalk environment in Account B
Complete the following steps:
-
Log in to Account B.
-
Upload the saved configuration from your local machine to an S3 bucket in Account B.
Example S3 path:
s3://elasticbeanstalk-us-east-2-account-b-id/resources/templates/application-b-name/
-
Open the Elastic Beanstalk console.
-
For Regions, choose your Region.
-
In the navigation pane, choose Applications, and then choose Create application.
-
For Application name, enter the name of your new application, for example application-b-name.
-
In the navigation pane, in the section for your new application, choose Saved configurations.
-
Choose the saved configuration that you uploaded to the S3 bucket in Account B:
s3://elasticbeanstalk-us-east-2-account-b-id/resources/templates/application-b-name/
-
Launch your Elastic Beanstalk environment.