AWS Elastic Beanstalk Migration Between Accounts

Girish G
Tensult Blogs
Published in
4 min readDec 3, 2019

In this blog, I will be walking you through on how to migrate an Elastic Beanstalk environment from one AWS account to another. For the purpose of this blog, I will be creating an Elastic Beanstalk environment for an open-source application called Metabase with Docker Platform.

You can launch the Metabase environment by following the instructions here. Once your environment is up and running, access the Metabase application using the URL. You can configure Metabase by following the Metabase documentation here.

Elastic Beanstalk Application Dashboard.
Metabase environment
Metabase Homepage.
Metabase Homepage

Once you have completed the configuration and checked the Metabase application you can go ahead and migrate your environment.

Navigate to Elastic Beanstalk on your AWS console and select your Elastic Beanstalk environment. From the Actions menu select Save Configuration to save the configuration.

Elastic Beanstalk Application Dashboard.
Save Configuration

The saved configuration is stored in an S3 bucket in the same region as your Elastic Beanstalk Environment.

S3 bucket for Elastic Beanstalk.
S3 bucket for Elastic Beanstalk
S3 bucket and saved configuration file with path.
Configuration File of Elastic Beanstalk Environment

Copy the contents of your Elastic Beanstalk Bucket from your source AWS account to a Target AWS account.

You can follow our blog here to copy the contents of your Elastic Beanstalk Bucket from your source AWS account to a Target AWS account.

Once you have copied the contents to the Target bucket, create an Elastic Beanstalk application with the same name as your source Elastic Beanstalk application in the Target AWS account.

You will see the configuration you copied from your source account under the saved configurations of your new application.

 Saved Configuration.
Saved Configuration from Source Account

Note: Edit the saved configuration file you copied from the source account by replacing the ServiceRole of the source account with the ServiceRole ARN of the Target account.

Replace the region filed in PlatformArn parameter with the region you want your Elastic Beanstalk to be migrated to.

You will have to create the application with the exact same name as the existing application in the source account to be able to see your saved configuration in the Target account.

Use the Saved configuration to create a new environment.

Saved Configuration of Elastic Beanstalk Environment.
Create environment.

Upload your code and you are good to go. Elastic Beanstalk takes care of the remaining work for you.

Elastic Beanstalk Environment Creation.
Elastic Beanstalk Creating Your Environment
AWS Elastic Beanstalk Application Console.
Migrated Environment

Alternatively, you can launch the Elastic Beanstalk environment by using the AWS CLI.

aws elasticbeanstalk create-environment --application-name <source-account-application-name> --environment-name <user-choice> --template-name <copied-saved-configuration-file> --region <region-of-your-choice>

Please replace the placeholders in the above command”

Note: Once is Elastic Beanstalk application is up and running, deploy your application code.

Conclusion

I hope you have understood Elastic Beanstalk migration between AWS accounts. That brings us to the end of this blog and I hope this was informative. Kindly share your thoughts in the comments section below. Please try this and let me know if you face any issues. Also, subscribe to our newsletter for more interesting updates.

Originally published at https://blogs.tensult.com on 20th November 2019

--

--