Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated May 8, 2024

Use cloud sandbox in dev environment

You can use a personal cloud sandbox environment that provides an isolated development space to rapidly build, test, and iterate on a fullstack app. Each developer on your team can use their own disposable sandbox environment connected to cloud resources.

Cloud sandbox environments are not intended for production workloads.

How cloud sandbox environments work

Create a new sandbox environment

You can set up a new sandbox environment on your machine once you have an Amplify app set up. If you have not yet created an Amplify Gen 2 app, visit the Quickstart.

First, open the terminal and run the following command:

Terminal
npx ampx sandbox

When you deploy a cloud sandbox, Amplify creates an AWS CloudFormation stack following the naming convention of amplify-<app-name>-<$(whoami)>-sandbox in your AWS account with the resources configured in your amplify/ folder.

terminal output of a successful cloud sandbox deployment

After a successful deployment, sandbox watches for file changes in your amplify/ folder and performs real-time updates to the associated CloudFormation stack. This functionality is built leveraging the hot swap capability of the AWS Cloud Development Kit (CDK).

terminal output of a successful cloud sandbox deployments with hot-swapped resources

Terminating a sandbox environment

After testing all the changes associated with the backend, you can terminate the sandbox session via Ctrl+c and can then choose whether you want to keep or delete all the resources in the sandbox environment.

terminal output after exiting sandbox with ctrl+c and prompt for resource deletion

Manage sandbox environments

You can view and manage all the sandbox environments for your team in the new Amplify console. This is useful for a team leader to audit all of the Amplify sandbox environments deployed within an account.

Choose Manage Sandboxes to get started:

Amplify console view with a deployed Amplify app and navigation for "Manage sandboxes"

You can then check the number, status, and last updates for sandbox environments across your team. You can also use the console to delete sandbox environments when no longer needed.

Amplify console view for "Manage sandbox" showing one active cloud sandbox

Best practices

Keep the following best practices in mind when working with cloud sandbox environments:

  • Sandboxes are identical in fidelity to your production environments.
  • Code changes are continuously deployed to your sandbox on every save for fast iterations.
  • Use sandboxes for experimentation and testing, not for production workloads.
  • Deploy one sandbox per Amplify app per developer to prevent conflicts.
  • Reset sandboxes occasionally to clear out unused resources and save costs.