AWS Classic

v5.21.1 published on Thursday, Nov 17, 2022 by Pulumi

CapacityProvider

Provides an ECS cluster capacity provider. More information can be found on the ECS Developer Guide.

NOTE: Associating an ECS Capacity Provider to an Auto Scaling Group will automatically add the AmazonECSManaged tag to the Auto Scaling Group. This tag should be included in the aws.autoscaling.Group resource configuration to prevent the provider from removing it in subsequent executions as well as ensuring the AmazonECSManaged tag is propagated to all EC2 Instances in the Auto Scaling Group if min_size is above 0 on creation. Any EC2 Instances in the Auto Scaling Group without this tag must be manually be updated, otherwise they may cause unexpected scaling behavior and metrics.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    // ... other configuration, including potentially other tags ...
    var testGroup = new Aws.AutoScaling.Group("testGroup", new()
    {
        Tags = new[]
        {
            new Aws.AutoScaling.Inputs.GroupTagArgs
            {
                Key = "AmazonECSManaged",
                Value = "true",
                PropagateAtLaunch = true,
            },
        },
    });

    var testCapacityProvider = new Aws.Ecs.CapacityProvider("testCapacityProvider", new()
    {
        AutoScalingGroupProvider = new Aws.Ecs.Inputs.CapacityProviderAutoScalingGroupProviderArgs
        {
            AutoScalingGroupArn = testGroup.Arn,
            ManagedTerminationProtection = "ENABLED",
            ManagedScaling = new Aws.Ecs.Inputs.CapacityProviderAutoScalingGroupProviderManagedScalingArgs
            {
                MaximumScalingStepSize = 1000,
                MinimumScalingStepSize = 1,
                Status = "ENABLED",
                TargetCapacity = 10,
            },
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/autoscaling"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ecs"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		testGroup, err := autoscaling.NewGroup(ctx, "testGroup", &autoscaling.GroupArgs{
			Tags: autoscaling.GroupTagArray{
				&autoscaling.GroupTagArgs{
					Key:               pulumi.String("AmazonECSManaged"),
					Value:             pulumi.String("true"),
					PropagateAtLaunch: pulumi.Bool(true),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = ecs.NewCapacityProvider(ctx, "testCapacityProvider", &ecs.CapacityProviderArgs{
			AutoScalingGroupProvider: &ecs.CapacityProviderAutoScalingGroupProviderArgs{
				AutoScalingGroupArn:          testGroup.Arn,
				ManagedTerminationProtection: pulumi.String("ENABLED"),
				ManagedScaling: &ecs.CapacityProviderAutoScalingGroupProviderManagedScalingArgs{
					MaximumScalingStepSize: pulumi.Int(1000),
					MinimumScalingStepSize: pulumi.Int(1),
					Status:                 pulumi.String("ENABLED"),
					TargetCapacity:         pulumi.Int(10),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.autoscaling.Group;
import com.pulumi.aws.autoscaling.GroupArgs;
import com.pulumi.aws.autoscaling.inputs.GroupTagArgs;
import com.pulumi.aws.ecs.CapacityProvider;
import com.pulumi.aws.ecs.CapacityProviderArgs;
import com.pulumi.aws.ecs.inputs.CapacityProviderAutoScalingGroupProviderArgs;
import com.pulumi.aws.ecs.inputs.CapacityProviderAutoScalingGroupProviderManagedScalingArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var testGroup = new Group("testGroup", GroupArgs.builder()        
            .tags(GroupTagArgs.builder()
                .key("AmazonECSManaged")
                .value(true)
                .propagateAtLaunch(true)
                .build())
            .build());

        var testCapacityProvider = new CapacityProvider("testCapacityProvider", CapacityProviderArgs.builder()        
            .autoScalingGroupProvider(CapacityProviderAutoScalingGroupProviderArgs.builder()
                .autoScalingGroupArn(testGroup.arn())
                .managedTerminationProtection("ENABLED")
                .managedScaling(CapacityProviderAutoScalingGroupProviderManagedScalingArgs.builder()
                    .maximumScalingStepSize(1000)
                    .minimumScalingStepSize(1)
                    .status("ENABLED")
                    .targetCapacity(10)
                    .build())
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

# ... other configuration, including potentially other tags ...
test_group = aws.autoscaling.Group("testGroup", tags=[aws.autoscaling.GroupTagArgs(
    key="AmazonECSManaged",
    value="true",
    propagate_at_launch=True,
)])
test_capacity_provider = aws.ecs.CapacityProvider("testCapacityProvider", auto_scaling_group_provider=aws.ecs.CapacityProviderAutoScalingGroupProviderArgs(
    auto_scaling_group_arn=test_group.arn,
    managed_termination_protection="ENABLED",
    managed_scaling=aws.ecs.CapacityProviderAutoScalingGroupProviderManagedScalingArgs(
        maximum_scaling_step_size=1000,
        minimum_scaling_step_size=1,
        status="ENABLED",
        target_capacity=10,
    ),
))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

// ... other configuration, including potentially other tags ...
const testGroup = new aws.autoscaling.Group("testGroup", {tags: [{
    key: "AmazonECSManaged",
    value: "true",
    propagateAtLaunch: true,
}]});
const testCapacityProvider = new aws.ecs.CapacityProvider("testCapacityProvider", {autoScalingGroupProvider: {
    autoScalingGroupArn: testGroup.arn,
    managedTerminationProtection: "ENABLED",
    managedScaling: {
        maximumScalingStepSize: 1000,
        minimumScalingStepSize: 1,
        status: "ENABLED",
        targetCapacity: 10,
    },
}});
resources:
  testGroup:
    type: aws:autoscaling:Group
    properties:
      tags:
        - key: AmazonECSManaged
          value: true
          propagateAtLaunch: true
  testCapacityProvider:
    type: aws:ecs:CapacityProvider
    properties:
      autoScalingGroupProvider:
        autoScalingGroupArn: ${testGroup.arn}
        managedTerminationProtection: ENABLED
        managedScaling:
          maximumScalingStepSize: 1000
          minimumScalingStepSize: 1
          status: ENABLED
          targetCapacity: 10

Create CapacityProvider Resource

new CapacityProvider(name: string, args: CapacityProviderArgs, opts?: CustomResourceOptions);
@overload
def CapacityProvider(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     auto_scaling_group_provider: Optional[CapacityProviderAutoScalingGroupProviderArgs] = None,
                     name: Optional[str] = None,
                     tags: Optional[Mapping[str, str]] = None)
@overload
def CapacityProvider(resource_name: str,
                     args: CapacityProviderArgs,
                     opts: Optional[ResourceOptions] = None)
func NewCapacityProvider(ctx *Context, name string, args CapacityProviderArgs, opts ...ResourceOption) (*CapacityProvider, error)
public CapacityProvider(string name, CapacityProviderArgs args, CustomResourceOptions? opts = null)
public CapacityProvider(String name, CapacityProviderArgs args)
public CapacityProvider(String name, CapacityProviderArgs args, CustomResourceOptions options)
type: aws:ecs:CapacityProvider
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args CapacityProviderArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args CapacityProviderArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args CapacityProviderArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args CapacityProviderArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args CapacityProviderArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

CapacityProvider Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The CapacityProvider resource accepts the following input properties:

AutoScalingGroupProvider CapacityProviderAutoScalingGroupProviderArgs

Configuration block for the provider for the ECS auto scaling group. Detailed below.

Name string

Name of the capacity provider.

Tags Dictionary<string, string>

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

AutoScalingGroupProvider CapacityProviderAutoScalingGroupProviderArgs

Configuration block for the provider for the ECS auto scaling group. Detailed below.

Name string

Name of the capacity provider.

Tags map[string]string

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

autoScalingGroupProvider CapacityProviderAutoScalingGroupProviderArgs

Configuration block for the provider for the ECS auto scaling group. Detailed below.

name String

Name of the capacity provider.

tags Map<String,String>

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

autoScalingGroupProvider CapacityProviderAutoScalingGroupProviderArgs

Configuration block for the provider for the ECS auto scaling group. Detailed below.

name string

Name of the capacity provider.

tags {[key: string]: string}

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

auto_scaling_group_provider CapacityProviderAutoScalingGroupProviderArgs

Configuration block for the provider for the ECS auto scaling group. Detailed below.

name str

Name of the capacity provider.

tags Mapping[str, str]

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

autoScalingGroupProvider Property Map

Configuration block for the provider for the ECS auto scaling group. Detailed below.

name String

Name of the capacity provider.

tags Map<String>

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Outputs

All input properties are implicitly available as output properties. Additionally, the CapacityProvider resource produces the following output properties:

Arn string

ARN that identifies the capacity provider.

Id string

The provider-assigned unique ID for this managed resource.

TagsAll Dictionary<string, string>

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Arn string

ARN that identifies the capacity provider.

Id string

The provider-assigned unique ID for this managed resource.

TagsAll map[string]string

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

arn String

ARN that identifies the capacity provider.

id String

The provider-assigned unique ID for this managed resource.

tagsAll Map<String,String>

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

arn string

ARN that identifies the capacity provider.

id string

The provider-assigned unique ID for this managed resource.

tagsAll {[key: string]: string}

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

arn str

ARN that identifies the capacity provider.

id str

The provider-assigned unique ID for this managed resource.

tags_all Mapping[str, str]

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

arn String

ARN that identifies the capacity provider.

id String

The provider-assigned unique ID for this managed resource.

tagsAll Map<String>

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Look up Existing CapacityProvider Resource

Get an existing CapacityProvider resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: CapacityProviderState, opts?: CustomResourceOptions): CapacityProvider
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        auto_scaling_group_provider: Optional[CapacityProviderAutoScalingGroupProviderArgs] = None,
        name: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None) -> CapacityProvider
func GetCapacityProvider(ctx *Context, name string, id IDInput, state *CapacityProviderState, opts ...ResourceOption) (*CapacityProvider, error)
public static CapacityProvider Get(string name, Input<string> id, CapacityProviderState? state, CustomResourceOptions? opts = null)
public static CapacityProvider get(String name, Output<String> id, CapacityProviderState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Arn string

ARN that identifies the capacity provider.

AutoScalingGroupProvider CapacityProviderAutoScalingGroupProviderArgs

Configuration block for the provider for the ECS auto scaling group. Detailed below.

Name string

Name of the capacity provider.

Tags Dictionary<string, string>

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

TagsAll Dictionary<string, string>

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Arn string

ARN that identifies the capacity provider.

AutoScalingGroupProvider CapacityProviderAutoScalingGroupProviderArgs

Configuration block for the provider for the ECS auto scaling group. Detailed below.

Name string

Name of the capacity provider.

Tags map[string]string

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

TagsAll map[string]string

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

arn String

ARN that identifies the capacity provider.

autoScalingGroupProvider CapacityProviderAutoScalingGroupProviderArgs

Configuration block for the provider for the ECS auto scaling group. Detailed below.

name String

Name of the capacity provider.

tags Map<String,String>

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tagsAll Map<String,String>

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

arn string

ARN that identifies the capacity provider.

autoScalingGroupProvider CapacityProviderAutoScalingGroupProviderArgs

Configuration block for the provider for the ECS auto scaling group. Detailed below.

name string

Name of the capacity provider.

tags {[key: string]: string}

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tagsAll {[key: string]: string}

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

arn str

ARN that identifies the capacity provider.

auto_scaling_group_provider CapacityProviderAutoScalingGroupProviderArgs

Configuration block for the provider for the ECS auto scaling group. Detailed below.

name str

Name of the capacity provider.

tags Mapping[str, str]

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tags_all Mapping[str, str]

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

arn String

ARN that identifies the capacity provider.

autoScalingGroupProvider Property Map

Configuration block for the provider for the ECS auto scaling group. Detailed below.

name String

Name of the capacity provider.

tags Map<String>

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tagsAll Map<String>

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Supporting Types

CapacityProviderAutoScalingGroupProvider

AutoScalingGroupArn string
  • ARN of the associated auto scaling group.
ManagedScaling CapacityProviderAutoScalingGroupProviderManagedScaling
  • Configuration block defining the parameters of the auto scaling. Detailed below.
ManagedTerminationProtection string
  • Enables or disables container-aware termination of instances in the auto scaling group when scale-in happens. Valid values are ENABLED and DISABLED.
AutoScalingGroupArn string
  • ARN of the associated auto scaling group.
ManagedScaling CapacityProviderAutoScalingGroupProviderManagedScaling
  • Configuration block defining the parameters of the auto scaling. Detailed below.
ManagedTerminationProtection string
  • Enables or disables container-aware termination of instances in the auto scaling group when scale-in happens. Valid values are ENABLED and DISABLED.
autoScalingGroupArn String
  • ARN of the associated auto scaling group.
managedScaling CapacityProviderAutoScalingGroupProviderManagedScaling
  • Configuration block defining the parameters of the auto scaling. Detailed below.
managedTerminationProtection String
  • Enables or disables container-aware termination of instances in the auto scaling group when scale-in happens. Valid values are ENABLED and DISABLED.
autoScalingGroupArn string
  • ARN of the associated auto scaling group.
managedScaling CapacityProviderAutoScalingGroupProviderManagedScaling
  • Configuration block defining the parameters of the auto scaling. Detailed below.
managedTerminationProtection string
  • Enables or disables container-aware termination of instances in the auto scaling group when scale-in happens. Valid values are ENABLED and DISABLED.
auto_scaling_group_arn str
  • ARN of the associated auto scaling group.
managed_scaling CapacityProviderAutoScalingGroupProviderManagedScaling
  • Configuration block defining the parameters of the auto scaling. Detailed below.
managed_termination_protection str
  • Enables or disables container-aware termination of instances in the auto scaling group when scale-in happens. Valid values are ENABLED and DISABLED.
autoScalingGroupArn String
  • ARN of the associated auto scaling group.
managedScaling Property Map
  • Configuration block defining the parameters of the auto scaling. Detailed below.
managedTerminationProtection String
  • Enables or disables container-aware termination of instances in the auto scaling group when scale-in happens. Valid values are ENABLED and DISABLED.

CapacityProviderAutoScalingGroupProviderManagedScaling

InstanceWarmupPeriod int

Period of time, in seconds, after a newly launched Amazon EC2 instance can contribute to CloudWatch metrics for Auto Scaling group. If this parameter is omitted, the default value of 300 seconds is used.

MaximumScalingStepSize int

Maximum step adjustment size. A number between 1 and 10,000.

MinimumScalingStepSize int

Minimum step adjustment size. A number between 1 and 10,000.

Status string

Whether auto scaling is managed by ECS. Valid values are ENABLED and DISABLED.

TargetCapacity int

Target utilization for the capacity provider. A number between 1 and 100.

InstanceWarmupPeriod int

Period of time, in seconds, after a newly launched Amazon EC2 instance can contribute to CloudWatch metrics for Auto Scaling group. If this parameter is omitted, the default value of 300 seconds is used.

MaximumScalingStepSize int

Maximum step adjustment size. A number between 1 and 10,000.

MinimumScalingStepSize int

Minimum step adjustment size. A number between 1 and 10,000.

Status string

Whether auto scaling is managed by ECS. Valid values are ENABLED and DISABLED.

TargetCapacity int

Target utilization for the capacity provider. A number between 1 and 100.

instanceWarmupPeriod Integer

Period of time, in seconds, after a newly launched Amazon EC2 instance can contribute to CloudWatch metrics for Auto Scaling group. If this parameter is omitted, the default value of 300 seconds is used.

maximumScalingStepSize Integer

Maximum step adjustment size. A number between 1 and 10,000.

minimumScalingStepSize Integer

Minimum step adjustment size. A number between 1 and 10,000.

status String

Whether auto scaling is managed by ECS. Valid values are ENABLED and DISABLED.

targetCapacity Integer

Target utilization for the capacity provider. A number between 1 and 100.

instanceWarmupPeriod number

Period of time, in seconds, after a newly launched Amazon EC2 instance can contribute to CloudWatch metrics for Auto Scaling group. If this parameter is omitted, the default value of 300 seconds is used.

maximumScalingStepSize number

Maximum step adjustment size. A number between 1 and 10,000.

minimumScalingStepSize number

Minimum step adjustment size. A number between 1 and 10,000.

status string

Whether auto scaling is managed by ECS. Valid values are ENABLED and DISABLED.

targetCapacity number

Target utilization for the capacity provider. A number between 1 and 100.

instance_warmup_period int

Period of time, in seconds, after a newly launched Amazon EC2 instance can contribute to CloudWatch metrics for Auto Scaling group. If this parameter is omitted, the default value of 300 seconds is used.

maximum_scaling_step_size int

Maximum step adjustment size. A number between 1 and 10,000.

minimum_scaling_step_size int

Minimum step adjustment size. A number between 1 and 10,000.

status str

Whether auto scaling is managed by ECS. Valid values are ENABLED and DISABLED.

target_capacity int

Target utilization for the capacity provider. A number between 1 and 100.

instanceWarmupPeriod Number

Period of time, in seconds, after a newly launched Amazon EC2 instance can contribute to CloudWatch metrics for Auto Scaling group. If this parameter is omitted, the default value of 300 seconds is used.

maximumScalingStepSize Number

Maximum step adjustment size. A number between 1 and 10,000.

minimumScalingStepSize Number

Minimum step adjustment size. A number between 1 and 10,000.

status String

Whether auto scaling is managed by ECS. Valid values are ENABLED and DISABLED.

targetCapacity Number

Target utilization for the capacity provider. A number between 1 and 100.

Import

ECS Capacity Providers can be imported using the name, e.g.,

 $ pulumi import aws:ecs/capacityProvider:CapacityProvider example example

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.