AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Creates a new capacity provider. Capacity providers are associated with an Amazon ECS cluster and are used in capacity provider strategies to facilitate cluster auto scaling.
Only capacity providers that use an Auto Scaling group can be created. Amazon ECS
tasks on Fargate use the FARGATE
and FARGATE_SPOT
capacity providers.
These providers are available to all accounts in the Amazon Web Services Regions that
Fargate supports.
For .NET Core this operation is only available in asynchronous form. Please refer to CreateCapacityProviderAsync.
Namespace: Amazon.ECS
Assembly: AWSSDK.ECS.dll
Version: 3.x.y.z
public virtual CreateCapacityProviderResponse CreateCapacityProvider( CreateCapacityProviderRequest request )
Container for the necessary parameters to execute the CreateCapacityProvider service method.
Exception | Condition |
---|---|
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. |
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. |
LimitExceededException | The limit for the resource was exceeded. |
ServerException | These errors are usually caused by a server issue. |
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 or STAGING, the update process can get stuck in that state. However, when the agent reconnects, it resumes where it stopped previously. |
This example creates a capacity provider that uses the specified Auto Scaling group MyASG and has managed scaling and manager termination protection enabled.
var client = new AmazonECSClient(); var response = client.CreateCapacityProvider(new CreateCapacityProviderRequest { Name = "MyCapacityProvider", AutoScalingGroupProvider = new AutoScalingGroupProvider { AutoScalingGroupArn = "arn:aws:autoscaling:us-east-1:123456789012:autoScalingGroup:57ffcb94-11f0-4d6d-bf60-3bac5EXAMPLE:autoScalingGroupName/MyASG", ManagedScaling = new ManagedScaling { Status = "ENABLED", TargetCapacity = 100 }, ManagedTerminationProtection = "ENABLED" } }); CapacityProvider capacityProvider = response.CapacityProvider;
.NET Framework:
Supported in: 4.5 and newer, 3.5