DEV Community

Johannes Konings
Johannes Konings

Posted on • Originally published at johanneskonings.dev on

2 1

AWS Amplify Console: How I changed master branch and env to main

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.

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

Migration

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.

Cognito

There are some approaches to export und import cognito users:

https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-import-users.html

https://medium.com/collaborne-engineering/migrate-aws-cognito-user-pools-ff2a91a745a2

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

DynamoDb

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

dynamodb-migration.sh

S3

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.

identity brwoser

I fixed that manually 😊

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more