- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
DeleteCapacityProviderCommand
Deletes the specified capacity provider.
The FARGATE
and FARGATE_SPOT
capacity providers are reserved and can't be deleted. You can disassociate them from a cluster using either PutClusterCapacityProviders or by deleting the cluster.
Prior to a capacity provider being deleted, the capacity provider must be removed from the capacity provider strategy from all services. The UpdateService API can be used to remove a capacity provider from a service's capacity provider strategy. When updating a service, the forceNewDeployment
option can be used to ensure that any tasks using the Amazon EC2 instance capacity provided by the capacity provider are transitioned to use the capacity from the remaining capacity providers. Only capacity providers that aren't associated with a cluster can be deleted. To remove a capacity provider from a cluster, you can either use PutClusterCapacityProviders or delete the cluster.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { ECSClient, DeleteCapacityProviderCommand } from "@aws-sdk/client-ecs"; // ES Modules import
// const { ECSClient, DeleteCapacityProviderCommand } = require("@aws-sdk/client-ecs"); // CommonJS import
const client = new ECSClient(config);
const input = { // DeleteCapacityProviderRequest
capacityProvider: "STRING_VALUE", // required
};
const command = new DeleteCapacityProviderCommand(input);
const response = await client.send(command);
// { // DeleteCapacityProviderResponse
// capacityProvider: { // CapacityProvider
// capacityProviderArn: "STRING_VALUE",
// name: "STRING_VALUE",
// status: "ACTIVE" || "INACTIVE",
// autoScalingGroupProvider: { // AutoScalingGroupProvider
// autoScalingGroupArn: "STRING_VALUE", // required
// managedScaling: { // ManagedScaling
// status: "ENABLED" || "DISABLED",
// targetCapacity: Number("int"),
// minimumScalingStepSize: Number("int"),
// maximumScalingStepSize: Number("int"),
// instanceWarmupPeriod: Number("int"),
// },
// managedTerminationProtection: "ENABLED" || "DISABLED",
// managedDraining: "ENABLED" || "DISABLED",
// },
// updateStatus: "DELETE_IN_PROGRESS" || "DELETE_COMPLETE" || "DELETE_FAILED" || "UPDATE_IN_PROGRESS" || "UPDATE_COMPLETE" || "UPDATE_FAILED",
// updateStatusReason: "STRING_VALUE",
// tags: [ // Tags
// { // Tag
// key: "STRING_VALUE",
// value: "STRING_VALUE",
// },
// ],
// },
// };
Example Usage
DeleteCapacityProviderCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
capacityProvider Required | string | undefined | The short name or full Amazon Resource Name (ARN) of the capacity provider to delete. |
DeleteCapacityProviderCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
capacityProvider | CapacityProvider | undefined | The details of the capacity provider. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
ClientException | client | These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid. The following list includes additional causes for the error:
|
InvalidParameterException | client | The specified parameter isn't valid. Review the available parameters for the API request. For more information about service event errors, see Amazon ECS service event messages . |
ServerException | server | These errors are usually caused by a server issue. |
ECSServiceException | Base exception class for all service exceptions from ECS service. |