Updating an API Deployment
Find out how to modify API deployments that you previously created with the API Gateway service.
After you have deployed an API on an API gateway by creating an API deployment, you might decide to change the API deployment. For example, you might want to change an API deployment specification to add additional back ends to the API deployment.
Note that there are some properties of API deployments for which you can't change the original values.
You can update API deployments by using the Console, the CLI, and the API. You can update an API deployment specification by using the Console or by editing a JSON file.
- On the Gateways list page, select the API gateway containing the API deployment that you want to update. If you need help finding the list page or the API gateway, see Listing API Gateways.
- Under Resources, select Deployments.
The Deployments list page opens. All API deployments in the selected API gateway are displayed in a table.
- From the
-
Select Edit to change the API deployment's name, or to replace the original API deployment specification. You can change the original API deployment specification by selecting one of the following options:
- From scratch: Change the API deployment specification properties by providing values in the Console.
- Upload an existing API: Change the API deployment specification properties by uploading a replacement JSON file.
For more information about defining API deployment specifications, see Creating an API Deployment Specification. Avoid entering confidential information.
- Select Move resource to move the API deployment to a different compartment.
- Select Add tags and View tags to change and view the tags applied to the API deployment.
for the API deployment that you want to update: -
To update existing API deployments using the CLI:
- Configure your client environment to use the CLI (Configuring Your Client Environment to use the CLI for API Gateway Development).
-
To update an existing API deployment:
-
Open a command prompt and run
oci api-gateway deployment update
to update the API deployment:oci api-gateway deployment update --deployment-id <deployment-ocid> --specification file:///<filename>
where:
<deployment-ocid>
is the OCID of the API deployment to update. To find out the API deployment's OCID, see Listing API Gateways.<filename>
is the relative location and filename of the JSON file containing the replacement API deployment specification. For example,replacement-specification.json
. For more information about defining API deployment specifications, see Creating an API Deployment Specification.
For example:
oci api-gateway deployment update --deployment-id ocid1.apideployment.oc1..aaaaaaaaab______pwa --specification file:///Users/jdoe/work/replacement-specification.json
The response to the command includes:
- The lifecycle state (for example, ACTIVE, FAILED).
- The id of the work request to update the API deployment (details of work requests are available for seven days after completion, cancellation, or failure).
If you want the command to wait to return control until the API deployment is active (or the request has failed), include either or both the following parameters:
--wait-for-state ACTIVE
--wait-for-state FAILED
For example:
oci api-gateway deployment update --deployment-id ocid1.apideployment.oc1..aaaaaaaaab______pwa --specification file:///Users/jdoe/work/replacement-specification.json --wait-for-state ACTIVE
-
(Optional) To see the status of the work request that is updating the API deployment, enter:
oci api-gateway work-request get --work-request-id <work-request-ocid>
-
(Optional) To view the logs of the work request that is updating the API deployment, enter:
oci api-gateway work-request-log list --work-request-id <work-request-ocid>
-
(Optional) If the work request that is updating the API deployment fails and you want to review the error logs, enter:
oci api-gateway work-request-error --work-request-id <work-request-ocid>
-
(Optional) To verify that the API deployment has been updated, enter the following command and confirm that the API deployment's properties are as you expect:
oci api-gateway deployment get --deployment-id <deployment-ocid>
-
For more information about using the CLI, see Command Line Interface (CLI). For a complete list of flags and options available for CLI commands, see CLI Help.
Run the UpdateDeployment operation to update an API deployment.