View a markdown version of this page

Promote a deployment - AWS Amplify

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.

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.

Promote a deployment in the console

  1. Sign in to the Amplify console.

  2. Choose an app.

  3. In the left navigation pane, choose Deployments.

  4. Choose a deployment you want to promote.

  5. For Actions, choose Promote to environment URL.

  6. Specify the environment, and choose Promote.

Promote a deployment using the CLI

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

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