---
title: "Use cloud sandbox in dev environment"
section: "deploy-and-host/sandbox-environments"
platforms: ["android", "angular", "flutter", "javascript", "nextjs", "react", "react-native", "swift", "vue"]
gen: 2
last-updated: "2025-02-13T21:24:04.000Z"
url: "https://docs.amplify.aws/react/deploy-and-host/sandbox-environments/setup/"
---

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 designed for development purposes and are not intended for production workloads. To accelerate deployments, Amplify utilizes **CDK hot swapping** where supported, enabling rapid updates to resources such as AWS Lambda functions and AWS AppSync resolver templates without requiring a full redeployment.  

However, certain operations cannot be hot-swapped and require resource recreation to proceed:  

- **Amazon DynamoDB GSI Operations:** In sandbox environments (but not in production), modifying or deleting a Global Secondary Index (GSI) is a time-intensive process. To simplify this, Amplify drops and recreates the table instead of modifying the index.  
- **Amazon Cognito User Pool Changes:** Unsupported modifications, such as deleting a required field, result in Amplify dropping and recreating the user pool to ensure a consistent and functional configuration.

![How cloud sandbox environments work](/images/gen2/how-amplify-works/sandbox.png)

## 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](/[platform]/start/quickstart).

First, open the terminal and run the following command:

```bash title="Terminal" showLineNumbers={false}
npx ampx sandbox
```

When you deploy a cloud sandbox, Amplify creates an [AWS CloudFormation](https://aws.amazon.com/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](/images/gen2/sandbox/sandbox1.png)

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)](https://docs.aws.amazon.com/cdk/v2/guide/cli.html#cli-deploy-hotswap).

![terminal output of a successful cloud sandbox deployments with hot-swapped resources](/images/gen2/sandbox/sandbox2.png)

### Terminating a sandbox environment

After testing all the changes associated with the backend, you can terminate the sandbox session via <kbd>Ctrl</kbd>+<kbd>c</kbd>.

To delete all the resources in the sandbox environment, run the following command:

```bash title="Terminal" showLineNumbers={false}
npx ampx sandbox delete
```

## Manage sandbox environments

You can view and manage all the sandbox environments for your team in the new [Amplify console](https://us-east-1.console.aws.amazon.com/amplify/apps/sandboxes). 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"](/images/gen2/sandbox/sandbox4.png)

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](/images/gen2/sandbox/sandbox5.png)

## 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.
