Skip to main content

capacity_providers

Creates, updates, deletes, gets or lists a capacity_providers resource.

Overview

Namecapacity_providers
TypeResource
Idaws.ecs.capacity_providers

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
capacity_providersarrayThe list of capacity providers.
failuresarrayAny failures associated with the call.
next_tokenstringThe nextToken value to include in a future DescribeCapacityProviders request. When the results of a DescribeCapacityProviders request exceed maxResults, this value can be used to retrieve the next page of results. This value is null when there are no more results to return.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_capacity_providersselectregionDescribes one or more of your capacity providers.
create_capacity_providerinsertregion, nameCreates a capacity provider. Capacity providers are associated with a cluster and are used in capacity provider strategies to facilitate cluster auto scaling. You can create capacity providers for Amazon ECS Managed Instances and EC2 instances. Fargate has the predefined FARGATE and FARGATE_SPOT capacity providers.
update_capacity_providerupdateregion, nameModifies the parameters for a capacity provider. These changes only apply to new Amazon ECS Managed Instances, or EC2 instances, not existing ones.
put_cluster_capacity_providersreplaceregion, cluster, capacityProviders, defaultCapacityProviderStrategyModifies the available capacity providers and the default capacity provider strategy for a cluster. You must specify both the available capacity providers and a default capacity provider strategy for the cluster. If the specified cluster has existing capacity providers associated with it, you must specify all existing capacity providers in addition to any new ones you want to add. Any existing capacity providers that are associated with a cluster that are omitted from a PutClusterCapacityProviders API call will be disassociated with the cluster. You can only disassociate an existing capacity provider from a cluster if it's not being used by any existing tasks. When creating a service or running a task on a cluster, if no capacity provider or launch type is specified, then the cluster's default capacity provider strategy is used. We recommend that you define a default capacity provider strategy for your cluster. However, you must specify an empty array ([]) to bypass defining a default strategy. Amazon ECS Managed Instances doesn't support this, because when you create a capacity provider with Amazon ECS Managed Instances, it becomes available only within the specified cluster.
delete_capacity_providerdeleteregionDeletes 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.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Describes one or more of your capacity providers.

SELECT
capacity_providers,
failures,
next_token
FROM aws.ecs.capacity_providers
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a capacity provider. Capacity providers are associated with a cluster and are used in capacity provider strategies to facilitate cluster auto scaling. You can create capacity providers for Amazon ECS Managed Instances and EC2 instances. Fargate has the predefined FARGATE and FARGATE_SPOT capacity providers.

INSERT INTO aws.ecs.capacity_providers (
name,
cluster,
autoScalingGroupProvider,
managedInstancesProvider,
tags,
region
)
SELECT
'{{ name }}' /* required */,
'{{ cluster }}',
'{{ autoScalingGroupProvider }}',
'{{ managedInstancesProvider }}',
'{{ tags }}',
'{{ region }}'
RETURNING
capacity_provider
;

UPDATE examples

Modifies the parameters for a capacity provider. These changes only apply to new Amazon ECS Managed Instances, or EC2 instances, not existing ones.

UPDATE aws.ecs.capacity_providers
SET
name = '{{ name }}',
cluster = '{{ cluster }}',
autoScalingGroupProvider = '{{ autoScalingGroupProvider }}',
managedInstancesProvider = '{{ managedInstancesProvider }}'
WHERE
region = '{{ region }}' --required
AND name = '{{ name }}' --required
RETURNING
capacity_provider;

REPLACE examples

Modifies the available capacity providers and the default capacity provider strategy for a cluster. You must specify both the available capacity providers and a default capacity provider strategy for the cluster. If the specified cluster has existing capacity providers associated with it, you must specify all existing capacity providers in addition to any new ones you want to add. Any existing capacity providers that are associated with a cluster that are omitted from a PutClusterCapacityProviders API call will be disassociated with the cluster. You can only disassociate an existing capacity provider from a cluster if it's not being used by any existing tasks. When creating a service or running a task on a cluster, if no capacity provider or launch type is specified, then the cluster's default capacity provider strategy is used. We recommend that you define a default capacity provider strategy for your cluster. However, you must specify an empty array ([]) to bypass defining a default strategy. Amazon ECS Managed Instances doesn't support this, because when you create a capacity provider with Amazon ECS Managed Instances, it becomes available only within the specified cluster.

REPLACE aws.ecs.capacity_providers
SET
cluster = '{{ cluster }}',
capacityProviders = '{{ capacityProviders }}',
defaultCapacityProviderStrategy = '{{ defaultCapacityProviderStrategy }}'
WHERE
region = '{{ region }}' --required
AND cluster = '{{ cluster }}' --required
AND capacityProviders = '{{ capacityProviders }}' --required
AND defaultCapacityProviderStrategy = '{{ defaultCapacityProviderStrategy }}' --required
RETURNING
cluster;

DELETE examples

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.

DELETE FROM aws.ecs.capacity_providers
WHERE region = '{{ region }}' --required
;