Page updated Jan 16, 2024


Team workflows

Amplify environments help you manage your local and cloud environments to mimic your team workflows. Common tasks include:

  • Manage environments to support development processes (e.g., development, staging, production)
  • Test new features safely
  • Share environments between team members
  • Support team workflows

To display all commands available for a new Amplify project, run the following command from the root directory.

1amplify env

Commands overview

amplify env add [--permissions-boundary <IAM Policy ARN>]Adds a new environment
amplify env pull [--restore]Pulls the current environment from the cloud
amplify env checkout <env-name> [--restore]Switches to the selected environment
amplify env list [--details] [--json]Displays a list of all the environments
amplify env get --name <env-name>Displays the environment details
amplify env update [--permissions-boundary <IAM Policy ARN>]Updates the environment's IAM Permissions Boundary
amplify env import --name <env-name> --config <provider-configs> [--awsInfo <aws-configs>]Imports an environment
amplify env remove <env-name>Removes an environment

Environment CLI commands

Add a new environment

1amplify env add

The add command goes through the following steps:

  • Asks for a name for the new environment
  • Creates IAM role for unauthenticated users
  • Creates IAM role for authenticated users
  • Creates S3 bucket for deployment
  • Creates a new backend environment in AWS Amplify Console to view and manage resources.

Optionally, you can configure an IAM Permissions Boundary for all Amplify-generated roles via the --permissions-boundary parameter. For more information about configuring IAM Permissions Boundary, see IAM Permissions Boundary for Amplify-generated roles.

Pull the environment from the cloud

1amplify env pull [--restore]

Use this command to pull the current environment from the cloud. Add the --restore flag to overwrite your local changes like amplify pull command.

Checkout an environment

1amplify env checkout <env-name> [--restore]

Use this command to checkout the <env-name> environment. Add the --restore flag to overwrite your local changes.

List environments

1amplify env list [--details] [--json]

Use this command to list all the environments. Add the --details or --json flags to see more details and format the output. Details include the AWS Region, IAM roles, S3 bucket and stack information.

See the output below for an Amplify project with dev and test environments. The active environment is preceded with an asterisk.

1amplify env list
1| Environments |
2| ------------ |
3| *dev |
4| test |

Show environment details

1amplify env get --name <env-name>

Use this command to list all details for <env-name> environment. Details include the AWS Region, IAM roles, S3 bucket and stack information.

Import an environment

1amplify env import --name <env-name> --config <provider-configs> [--awsInfo <aws-configs>]

Use this command to import an existing environment. Find below an example of a bash command.

2set -e
6\"Region\": \"us-east-1\",\
7\"DeploymentBucketName\": \"mytestproject-20181106123241-deployment\",\
8\"UnauthRoleName\": \"mytestproject-20181106123241-unauthRole\",\
9\"StackName\": \"mytestproject-20181106123241\",\
10\"StackId\": \"arn:aws:cloudformation:us-east-1:132393967379:stack/mytestproject67-20181106123241/1c03a3e0-e203-11e8-bea9-500c20ff1436\",\
11\"AuthRoleName\": \"mytestproject67-20181106123241-authRole\",\
12\"UnauthRoleArn\": \"arn:aws:iam::132393967379:role/mytestproject67-20181106123241-unauthRole\",\
13\"AuthRoleArn\": \"arn:aws:iam::132393967379:role/mytestproject67-20181106123241-authRole\"\
26amplify env import \
27--name dev \
28--config $PROVIDER_CONFIG \
29--awsInfo $AWS_CONFIG \

You can get the AWSCLOUDFORMATIONCONFIG from the team-provider-info.json file from your existing Amplify project.

Remove an environment

1amplify env remove <env-name>

Use this command to remove an environment. This will remove both the local and the cloud environments including all provisioned services and resources.