There are more AWS SDK examples available in the AWS Doc SDK Examples
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:
aws apigateway delete-deployment --rest-api-id
1234123412
--deployment-ida1b2c3
-
For API details, see DeleteDeployment
in AWS CLI Command Reference.
-
- 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); } }
-
For API details, see DeleteDeployment in AWS SDK for Java 2.x API Reference.
-
CreateRestApi
DeleteRestApi