CreateCapacityProvider
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. AWS Fargate has the predefined FARGATE
and FARGATE_SPOT
capacity providers.
Request Syntax
{
"autoScalingGroupProvider": {
"autoScalingGroupArn": "string
",
"managedDraining": "string
",
"managedScaling": {
"instanceWarmupPeriod": number
,
"maximumScalingStepSize": number
,
"minimumScalingStepSize": number
,
"status": "string
",
"targetCapacity": number
},
"managedTerminationProtection": "string
"
},
"cluster": "string
",
"managedInstancesProvider": {
"infrastructureRoleArn": "string
",
"instanceLaunchTemplate": {
"ec2InstanceProfileArn": "string
",
"instanceRequirements": {
"acceleratorCount": {
"max": number
,
"min": number
},
"acceleratorManufacturers": [ "string
" ],
"acceleratorNames": [ "string
" ],
"acceleratorTotalMemoryMiB": {
"max": number
,
"min": number
},
"acceleratorTypes": [ "string
" ],
"allowedInstanceTypes": [ "string
" ],
"bareMetal": "string
",
"baselineEbsBandwidthMbps": {
"max": number
,
"min": number
},
"burstablePerformance": "string
",
"cpuManufacturers": [ "string
" ],
"excludedInstanceTypes": [ "string
" ],
"instanceGenerations": [ "string
" ],
"localStorage": "string
",
"localStorageTypes": [ "string
" ],
"maxSpotPriceAsPercentageOfOptimalOnDemandPrice": number
,
"memoryGiBPerVCpu": {
"max": number
,
"min": number
},
"memoryMiB": {
"max": number
,
"min": number
},
"networkBandwidthGbps": {
"max": number
,
"min": number
},
"networkInterfaceCount": {
"max": number
,
"min": number
},
"onDemandMaxPricePercentageOverLowestPrice": number
,
"requireHibernateSupport": boolean
,
"spotMaxPricePercentageOverLowestPrice": number
,
"totalLocalStorageGB": {
"max": number
,
"min": number
},
"vCpuCount": {
"max": number
,
"min": number
}
},
"monitoring": "string
",
"networkConfiguration": {
"securityGroups": [ "string
" ],
"subnets": [ "string
" ]
},
"storageConfiguration": {
"storageSizeGiB": number
}
},
"propagateTags": "string
"
},
"name": "string
",
"tags": [
{
"key": "string
",
"value": "string
"
}
]
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- autoScalingGroupProvider
-
The details of the Auto Scaling group for the capacity provider.
Type: AutoScalingGroupProvider object
Required: No
- cluster
-
The name of the cluster to associate with the capacity provider. When you create a capacity provider with Amazon ECS Managed Instances, it becomes available only within the specified cluster.
Type: String
Required: No
- managedInstancesProvider
-
The configuration for the Amazon ECS Managed Instances provider. This configuration specifies how Amazon ECS manages Amazon EC2 instances on your behalf, including the infrastructure role, instance launch template, and tag propagation settings.
Type: CreateManagedInstancesProviderConfiguration object
Required: No
- name
-
The name of the capacity provider. Up to 255 characters are allowed. They include letters (both upper and lowercase letters), numbers, underscores (_), and hyphens (-). The name can't be prefixed with "
aws
", "ecs
", or "fargate
".Type: String
Required: Yes
-
The metadata that you apply to the capacity provider to categorize and organize them more conveniently. Each tag consists of a key and an optional value. You define both of them.
The following basic restrictions apply to tags:
-
Maximum number of tags per resource - 50
-
For each resource, each tag key must be unique, and each tag key can have only one value.
-
Maximum key length - 128 Unicode characters in UTF-8
-
Maximum value length - 256 Unicode characters in UTF-8
-
If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.
-
Tag keys and values are case-sensitive.
-
Do not use
aws:
,AWS:
, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for AWS use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.
Type: Array of Tag objects
Array Members: Minimum number of 0 items. Maximum number of 50 items.
Required: No
-
Response Syntax
{
"capacityProvider": {
"autoScalingGroupProvider": {
"autoScalingGroupArn": "string",
"managedDraining": "string",
"managedScaling": {
"instanceWarmupPeriod": number,
"maximumScalingStepSize": number,
"minimumScalingStepSize": number,
"status": "string",
"targetCapacity": number
},
"managedTerminationProtection": "string"
},
"capacityProviderArn": "string",
"cluster": "string",
"managedInstancesProvider": {
"infrastructureRoleArn": "string",
"instanceLaunchTemplate": {
"ec2InstanceProfileArn": "string",
"instanceRequirements": {
"acceleratorCount": {
"max": number,
"min": number
},
"acceleratorManufacturers": [ "string" ],
"acceleratorNames": [ "string" ],
"acceleratorTotalMemoryMiB": {
"max": number,
"min": number
},
"acceleratorTypes": [ "string" ],
"allowedInstanceTypes": [ "string" ],
"bareMetal": "string",
"baselineEbsBandwidthMbps": {
"max": number,
"min": number
},
"burstablePerformance": "string",
"cpuManufacturers": [ "string" ],
"excludedInstanceTypes": [ "string" ],
"instanceGenerations": [ "string" ],
"localStorage": "string",
"localStorageTypes": [ "string" ],
"maxSpotPriceAsPercentageOfOptimalOnDemandPrice": number,
"memoryGiBPerVCpu": {
"max": number,
"min": number
},
"memoryMiB": {
"max": number,
"min": number
},
"networkBandwidthGbps": {
"max": number,
"min": number
},
"networkInterfaceCount": {
"max": number,
"min": number
},
"onDemandMaxPricePercentageOverLowestPrice": number,
"requireHibernateSupport": boolean,
"spotMaxPricePercentageOverLowestPrice": number,
"totalLocalStorageGB": {
"max": number,
"min": number
},
"vCpuCount": {
"max": number,
"min": number
}
},
"monitoring": "string",
"networkConfiguration": {
"securityGroups": [ "string" ],
"subnets": [ "string" ]
},
"storageConfiguration": {
"storageSizeGiB": number
}
},
"propagateTags": "string"
},
"name": "string",
"status": "string",
"tags": [
{
"key": "string",
"value": "string"
}
],
"type": "string",
"updateStatus": "string",
"updateStatusReason": "string"
}
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- capacityProvider
-
The full description of the new capacity provider.
Type: CapacityProvider object
Errors
For information about the errors that are common to all actions, see Common Errors.
- ClientException
-
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.
- message
-
Message that describes the cause of the exception.
HTTP Status Code: 400
- ClusterNotFoundException
-
The specified cluster wasn't found. You can view your available clusters with ListClusters. Amazon ECS clusters are Region specific.
HTTP Status Code: 400
- InvalidParameterException
-
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.
HTTP Status Code: 400
- LimitExceededException
-
The limit for the resource was exceeded.
HTTP Status Code: 400
- ServerException
-
These errors are usually caused by a server issue.
- message
-
Message that describes the cause of the exception.
HTTP Status Code: 500
- UnsupportedFeatureException
-
The specified task isn't supported in this Region.
HTTP Status Code: 400
- UpdateInProgressException
-
There's already a current Amazon ECS container agent update in progress on the container instance that's specified. If the container agent becomes disconnected while it's in a transitional stage, such as
PENDING
orSTAGING
, the update process can get stuck in that state. However, when the agent reconnects, it resumes where it stopped previously.HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: