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:http://www.kapwing.com/blog/how-to-rename-your-master-branch-to-main-in-git/
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.
After the master branch was renamed to main, the corresponding env have to be also renamed from master to main.
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.
The new main branch and the new main env can now be connected in the amplify console.
Afterwards the production branch must be changed to main.
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:
That profile pictures can also be copied by a script s3-migration.sh. But it’s necessary to rename the folder name to the new identity pool identity browser id, that the pictures will be found.
I fixed that manually 😊