Share single environment
You have two independent environments (main & dev) in the cloud and have corresponding Git branches with your Amplify backend infrastructure code on Git. Suppose all team members want to work on the same Amplify project and push backend related changes to the same dev environment to test their changes. Each team member would run the following:
cd <project-dir>amplify initDo you want to use an existing environment? YesChoose the environment you would like to use:❯ devmain# The rest of init steps# amplify add/update amplify pushSince the team is sharing the same dev backend, periodically team members would need to pull in changes which their team members pushed for the dev environment to be in sync. Let's pull in the changes from the dev branch & environment.
amplify pullSharing projects within the team
Inside the amplify directory file-structure, you will observe a team-provider-info.json file which contains a structure similar to the following:
{ "dev": { "awscloudformation": { "AuthRoleName": "multenvtest-20181115101929-authRole", "UnauthRoleArn": "arn:aws:iam::132393967379:role/multenvtest-20181115101929-unauthRole", "AuthRoleArn": "arn:aws:iam::132393967379:role/multenvtest-20181115101929-authRole", "Region": "us-east-1", "DeploymentBucketName": "multenvtest-20181115101929-deployment", "UnauthRoleName": "multenvtest-20181115101929-unauthRole", "StackName": "multenvtest-20181115101929", "StackId": "arn:aws:cloudformation:us-east-1:132393967379:stack/multenvtest-20181115101929/fc7b1010-e902-11e8-a9bd-50fae97e0835" } }, "main": { "awscloudformation": { "AuthRoleName": "multenvtest-20181115102119-authRole", "UnauthRoleArn": "arn:aws:iam::345090917734:role/multenvtest-20181115102119-unauthRole", "AuthRoleArn": "arn:aws:iam::345090917734:role/multenvtest-20181115102119-authRole", "Region": "us-east-1", "DeploymentBucketName": "multenvtest-20181115102119-deployment", "UnauthRoleName": "multenvtest-20181115102119-unauthRole", "StackName": "multenvtest-20181115102119", "StackId": "arn:aws:cloudformation:us-east-1:345090917734:stack/multenvtest-20181115102119/3e907b70-e903-11e8-a18b-503acac41e61" } }}This file is to be shared between team members, so that they have the ability to push/provision resources to the same CloudFormation stack and that way teams can work in a push/pull way and can always be in sync with the latest state of the project in the cloud.
If you want to share a project publicly and open source your serverless infrastructure, you should remove or put the amplify/team-provider-info.json file in the .gitignore file.