Back to blog
Aug 18, 2020
3 min read

AWS Amplify Console: How I changed master branchenv to main

Change of the master branch end amplfiy env to main and migration of the env data

As part of #BlackLivesMatter there was a discussion to rename git branch master to main. How to do that in git and GitHub and some more about the background is described here:

Together with the master branch I had a master env, which was connected to the git master branch in the amplify console. I also wanted to rename this master env.

AWS Amplify

After the master branch was renamed to main, the corresponding env have to be also renamed from master to main.

Create new env

Check If you are in the master env with amplify status. If not checkout the master env with amplify env checkout master. Run the command amplify add env main and amplify push. After that, you can connect the main branch with the main env in the amplify console.

Connection of main branch with main env in the Amplify Console

The new main branch and the new main env can now be connected in the amplify console.

Amplify Console connection branch to env

Amplify Console connection branch to env

Afterwards the production branch must be changed to main.

Amplify Console production branch


The new env main is now ready to use, but the data is missing. That must be migrated from the master env to the main env. In my case, it was Cognito users, DynamoDB data and S3 profile photos.


There are some approaches to export und import cognito users:

However, since it is a small internal app, it is sufficient for users to register again 😊


The DynamoDB data is more important. The easiest way to migrate the data was with a shell script and the aws cli:


As described here the users can upload new profile pictures: AWS Amplify Storage: React example for Avatar pictures

That profile pictures can also be copied by a script But it’s necessary to rename the folder name to the new identity pool identity browser id, that the pictures will be found.

identity browser

I fixed that manually 😊