Deploying a REST API from the API Gateway console - Amazon API Gateway

Deploying a REST API from the API Gateway console

You must have created a REST API before deploying it for the first time. For more information, see Creating a REST API in Amazon API Gateway.

Deploy a REST API to a stage

The API Gateway console lets you deploy an API by creating a deployment and associating it with a new or existing stage.

Note

To associate a stage in API Gateway with a different deployment, see Associate a stage with a different REST API deployment instead.

  1. Sign in to the API Gateway console at https://console.aws.amazon.com/apigateway.

  2. In the APIs navigation pane, choose the API you want to deploy.

  3. In the Resources pane, choose Deploy API.

  4. For Stage, select from the following:

    1. To create a new stage, select New stage, and then enter a name in Stage name. Optionally, you can provide a description for the deployment in Deployment description.

    2. To choose an existing stage, select the stage name from the dropdown menu. You might want to provide a description of the new deployment in Deployment description.

    3. To create a deployment that is not associated with a stage, select No stage. Later, you can associate this deployment with a stage.

  5. Choose Deploy.

Redeploy a REST API to a stage

To redeploy an API, perform the same steps as in Deploy a REST API to a stage. You can reuse the same stage as many times as desired.

Update the stage configuration of a REST API deployment

After an API is deployed, you can modify the stage settings to enable or disable the API cache, logging, or request throttling. You can also choose a client certificate for the backend to authenticate API Gateway and set stage variables to pass deployment context to the API integration at runtime. For more information, see Update stage settings.

Important

After modifying stage settings, you must redeploy the API for the changes to take effect.

Note

If the updated settings, such as enabling logging, requires a new IAM role, you can add the required IAM role without redeploying the API. However, it can take a few minutes before the new IAM role takes effect. Before that happens, traces of your API calls are not logged even if you have enabled the logging option.

Set stage variables for a REST API deployment

For a deployment, you can set or modify stage variables to pass deployment-specific data to the API integration at runtime. You can do this on the Stage Variables tab in the Stage Editor. For more information, see instructions in Setting up stage variables for a REST API deployment.

Associate a stage with a different REST API deployment

Because a deployment represents an API snapshot and a stage defines a path into a snapshot, you can choose different deployment-stage combinations to control how users call into different versions of the API. This is useful, for example, when you want to roll back API state to a previous deployment or to merge a 'private branch' of the API into the public one.

The following procedure shows how to do this using the Stage Editor in the API Gateway console. It is assumed that you must have deployed an API more than once.

  1. If you're not already on the Stages pane, in the main navigation pane, choose Stages.

  2. Select the stage you want to update.

  3. On the Deployment history tab, select the deployment you want the stage to use.

  4. Choose Change active deployment.

  5. Confirm you want to change the active deployment and choose Change active deployment in the Make active deployment dialog box.