createCapacityProvider

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.

Samples

import aws.sdk.kotlin.services.ecs.model.AutoScalingGroupProvider
import aws.sdk.kotlin.services.ecs.model.ManagedScaling
import aws.sdk.kotlin.services.ecs.model.ManagedScalingStatus
import aws.sdk.kotlin.services.ecs.model.ManagedTerminationProtection
fun main() { 
   //sampleStart 
   // This example creates a capacity provider that uses the specified Auto Scaling group MyASG and has
// managed scaling and manager termination protection enabled.
val resp = ecsClient.createCapacityProvider {
    name = "MyCapacityProvider"
    autoScalingGroupProvider = AutoScalingGroupProvider {
        autoScalingGroupArn = "arn:aws:autoscaling:us-east-1:123456789012:autoScalingGroup:57ffcb94-11f0-4d6d-bf60-3bac5EXAMPLE:autoScalingGroupName/MyASG"
        managedScaling = ManagedScaling {
            status = ManagedScalingStatus.fromValue("ENABLED")
            targetCapacity = 100
        }
        managedTerminationProtection = ManagedTerminationProtection.fromValue("ENABLED")
    }
} 
   //sampleEnd
}