

# Promote a deployment

By default, when you create a deployment, the deployment is automatically set as the environment URL. You can turn off automatic promotion of your environment URL for the latest deployment, and then you’ll have to manually promote a deployment. You can also promote a previous deployment to perform an instant rollback of your app. Amplify retains the last 50 successful deployments per environment for instant rollback. Deployments beyond this limit are auto-expired, unless they are actively serving traffic. To see which deployments are serving traffic, see [Determine which deployment is serving traffic](deploy-your-app-serving-traffic.md).

When you manually promote a deployment, Amplify does not rebuild your app.

A promotion takes about 5 to 10 seconds to reach all viewers. Until then, some requests to the environment URL get the promoted deployment and others get the previous one.

**Promoting doesn’t undo migrations**  
If your app has a backend, promoting a deployment changes only which deployment serves the environment URL. It doesn’t undo migrations, so if you promote an older deployment, its code runs against the newest schema. A promoted deployment also keeps the publishable key that it was built with. If you revoked that key since, its backend requests get `401` `invalid_credential` until you deploy again.

To promote safely, keep each migration compatible with live code: add a column before code reads it, and drop one only after no deployed code uses it. Test schema changes in `preview` first. For more information, see [Tables and migrations](backend-data.md).

## Promote a deployment in the console
<a name="deploy-your-app-promote-console"></a>

1. Sign in to the Amplify console.

1. Choose an app.

1. In the left navigation pane, choose **Deployments**.

1. Choose a deployment you want to promote.

1. For **Actions**, choose **Promote to environment URL**.

1. Specify the environment, and choose **Promote**.

## Promote a deployment using the CLI
<a name="_promote_a_deployment_using_the_cli"></a>

The following CLI command promotes the deployment ID a1b2c3d4e5 to the production environment.

```bash
aws amplifygen3 deployment promote --id a1b2c3d4e5 --env production
```