Use DeleteDeployment with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DeleteDeployment with an AWS SDK or CLI

The following code examples show how to use DeleteDeployment.

CLI
AWS CLI

To delete a deployment in an API

Command:

<userinput>aws apigateway delete-deployment --rest-api-id <replaceable>1234123412</replaceable> --deployment-id <replaceable>a1b2c3</replaceable></userinput>
Java
SDK for Java 2.x
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

public static void deleteSpecificDeployment(ApiGatewayClient apiGateway, String restApiId, String deploymentId) { try { DeleteDeploymentRequest request = DeleteDeploymentRequest.builder() .restApiId(restApiId) .deploymentId(deploymentId) .build(); apiGateway.deleteDeployment(request); System.out.println("Deployment was deleted"); } catch (ApiGatewayException e) { System.err.println(e.awsErrorDetails().errorMessage()); System.exit(1); } }