1. Packages
  2. AWS
  3. API Docs
  4. ecs
  5. ClusterCapacityProviders
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.ecs.ClusterCapacityProviders

Explore with Pulumi AI

Manages the capacity providers of an ECS Cluster.

More information about capacity providers can be found in the ECS User Guide.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.ecs.Cluster("example", {name: "my-cluster"});
const exampleClusterCapacityProviders = new aws.ecs.ClusterCapacityProviders("example", {
    clusterName: example.name,
    capacityProviders: ["FARGATE"],
    defaultCapacityProviderStrategies: [{
        base: 1,
        weight: 100,
        capacityProvider: "FARGATE",
    }],
});
Copy
import pulumi
import pulumi_aws as aws

example = aws.ecs.Cluster("example", name="my-cluster")
example_cluster_capacity_providers = aws.ecs.ClusterCapacityProviders("example",
    cluster_name=example.name,
    capacity_providers=["FARGATE"],
    default_capacity_provider_strategies=[{
        "base": 1,
        "weight": 100,
        "capacity_provider": "FARGATE",
    }])
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := ecs.NewCluster(ctx, "example", &ecs.ClusterArgs{
			Name: pulumi.String("my-cluster"),
		})
		if err != nil {
			return err
		}
		_, err = ecs.NewClusterCapacityProviders(ctx, "example", &ecs.ClusterCapacityProvidersArgs{
			ClusterName: example.Name,
			CapacityProviders: pulumi.StringArray{
				pulumi.String("FARGATE"),
			},
			DefaultCapacityProviderStrategies: ecs.ClusterCapacityProvidersDefaultCapacityProviderStrategyArray{
				&ecs.ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs{
					Base:             pulumi.Int(1),
					Weight:           pulumi.Int(100),
					CapacityProvider: pulumi.String("FARGATE"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.Ecs.Cluster("example", new()
    {
        Name = "my-cluster",
    });

    var exampleClusterCapacityProviders = new Aws.Ecs.ClusterCapacityProviders("example", new()
    {
        ClusterName = example.Name,
        CapacityProviders = new[]
        {
            "FARGATE",
        },
        DefaultCapacityProviderStrategies = new[]
        {
            new Aws.Ecs.Inputs.ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs
            {
                Base = 1,
                Weight = 100,
                CapacityProvider = "FARGATE",
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ecs.Cluster;
import com.pulumi.aws.ecs.ClusterArgs;
import com.pulumi.aws.ecs.ClusterCapacityProviders;
import com.pulumi.aws.ecs.ClusterCapacityProvidersArgs;
import com.pulumi.aws.ecs.inputs.ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs;
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 example = new Cluster("example", ClusterArgs.builder()
            .name("my-cluster")
            .build());

        var exampleClusterCapacityProviders = new ClusterCapacityProviders("exampleClusterCapacityProviders", ClusterCapacityProvidersArgs.builder()
            .clusterName(example.name())
            .capacityProviders("FARGATE")
            .defaultCapacityProviderStrategies(ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs.builder()
                .base(1)
                .weight(100)
                .capacityProvider("FARGATE")
                .build())
            .build());

    }
}
Copy
resources:
  example:
    type: aws:ecs:Cluster
    properties:
      name: my-cluster
  exampleClusterCapacityProviders:
    type: aws:ecs:ClusterCapacityProviders
    name: example
    properties:
      clusterName: ${example.name}
      capacityProviders:
        - FARGATE
      defaultCapacityProviderStrategies:
        - base: 1
          weight: 100
          capacityProvider: FARGATE
Copy

Create ClusterCapacityProviders Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ClusterCapacityProviders(name: string, args: ClusterCapacityProvidersArgs, opts?: CustomResourceOptions);
@overload
def ClusterCapacityProviders(resource_name: str,
                             args: ClusterCapacityProvidersArgs,
                             opts: Optional[ResourceOptions] = None)

@overload
def ClusterCapacityProviders(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             cluster_name: Optional[str] = None,
                             capacity_providers: Optional[Sequence[str]] = None,
                             default_capacity_provider_strategies: Optional[Sequence[ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs]] = None)
func NewClusterCapacityProviders(ctx *Context, name string, args ClusterCapacityProvidersArgs, opts ...ResourceOption) (*ClusterCapacityProviders, error)
public ClusterCapacityProviders(string name, ClusterCapacityProvidersArgs args, CustomResourceOptions? opts = null)
public ClusterCapacityProviders(String name, ClusterCapacityProvidersArgs args)
public ClusterCapacityProviders(String name, ClusterCapacityProvidersArgs args, CustomResourceOptions options)
type: aws:ecs:ClusterCapacityProviders
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

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

Constructor example

The following reference example uses placeholder values for all input properties.

var clusterCapacityProvidersResource = new Aws.Ecs.ClusterCapacityProviders("clusterCapacityProvidersResource", new()
{
    ClusterName = "string",
    CapacityProviders = new[]
    {
        "string",
    },
    DefaultCapacityProviderStrategies = new[]
    {
        new Aws.Ecs.Inputs.ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs
        {
            CapacityProvider = "string",
            Base = 0,
            Weight = 0,
        },
    },
});
Copy
example, err := ecs.NewClusterCapacityProviders(ctx, "clusterCapacityProvidersResource", &ecs.ClusterCapacityProvidersArgs{
	ClusterName: pulumi.String("string"),
	CapacityProviders: pulumi.StringArray{
		pulumi.String("string"),
	},
	DefaultCapacityProviderStrategies: ecs.ClusterCapacityProvidersDefaultCapacityProviderStrategyArray{
		&ecs.ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs{
			CapacityProvider: pulumi.String("string"),
			Base:             pulumi.Int(0),
			Weight:           pulumi.Int(0),
		},
	},
})
Copy
var clusterCapacityProvidersResource = new ClusterCapacityProviders("clusterCapacityProvidersResource", ClusterCapacityProvidersArgs.builder()
    .clusterName("string")
    .capacityProviders("string")
    .defaultCapacityProviderStrategies(ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs.builder()
        .capacityProvider("string")
        .base(0)
        .weight(0)
        .build())
    .build());
Copy
cluster_capacity_providers_resource = aws.ecs.ClusterCapacityProviders("clusterCapacityProvidersResource",
    cluster_name="string",
    capacity_providers=["string"],
    default_capacity_provider_strategies=[{
        "capacity_provider": "string",
        "base": 0,
        "weight": 0,
    }])
Copy
const clusterCapacityProvidersResource = new aws.ecs.ClusterCapacityProviders("clusterCapacityProvidersResource", {
    clusterName: "string",
    capacityProviders: ["string"],
    defaultCapacityProviderStrategies: [{
        capacityProvider: "string",
        base: 0,
        weight: 0,
    }],
});
Copy
type: aws:ecs:ClusterCapacityProviders
properties:
    capacityProviders:
        - string
    clusterName: string
    defaultCapacityProviderStrategies:
        - base: 0
          capacityProvider: string
          weight: 0
Copy

ClusterCapacityProviders Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ClusterCapacityProviders resource accepts the following input properties:

ClusterName
This property is required.
Changes to this property will trigger replacement.
string
Name of the ECS cluster to manage capacity providers for.
CapacityProviders List<string>
Set of names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
DefaultCapacityProviderStrategies List<ClusterCapacityProvidersDefaultCapacityProviderStrategy>
Set of capacity provider strategies to use by default for the cluster. Detailed below.
ClusterName
This property is required.
Changes to this property will trigger replacement.
string
Name of the ECS cluster to manage capacity providers for.
CapacityProviders []string
Set of names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
DefaultCapacityProviderStrategies []ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs
Set of capacity provider strategies to use by default for the cluster. Detailed below.
clusterName
This property is required.
Changes to this property will trigger replacement.
String
Name of the ECS cluster to manage capacity providers for.
capacityProviders List<String>
Set of names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
defaultCapacityProviderStrategies List<ClusterCapacityProvidersDefaultCapacityProviderStrategy>
Set of capacity provider strategies to use by default for the cluster. Detailed below.
clusterName
This property is required.
Changes to this property will trigger replacement.
string
Name of the ECS cluster to manage capacity providers for.
capacityProviders string[]
Set of names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
defaultCapacityProviderStrategies ClusterCapacityProvidersDefaultCapacityProviderStrategy[]
Set of capacity provider strategies to use by default for the cluster. Detailed below.
cluster_name
This property is required.
Changes to this property will trigger replacement.
str
Name of the ECS cluster to manage capacity providers for.
capacity_providers Sequence[str]
Set of names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
default_capacity_provider_strategies Sequence[ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs]
Set of capacity provider strategies to use by default for the cluster. Detailed below.
clusterName
This property is required.
Changes to this property will trigger replacement.
String
Name of the ECS cluster to manage capacity providers for.
capacityProviders List<String>
Set of names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
defaultCapacityProviderStrategies List<Property Map>
Set of capacity provider strategies to use by default for the cluster. Detailed below.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ClusterCapacityProviders Resource

Get an existing ClusterCapacityProviders 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?: ClusterCapacityProvidersState, opts?: CustomResourceOptions): ClusterCapacityProviders
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        capacity_providers: Optional[Sequence[str]] = None,
        cluster_name: Optional[str] = None,
        default_capacity_provider_strategies: Optional[Sequence[ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs]] = None) -> ClusterCapacityProviders
func GetClusterCapacityProviders(ctx *Context, name string, id IDInput, state *ClusterCapacityProvidersState, opts ...ResourceOption) (*ClusterCapacityProviders, error)
public static ClusterCapacityProviders Get(string name, Input<string> id, ClusterCapacityProvidersState? state, CustomResourceOptions? opts = null)
public static ClusterCapacityProviders get(String name, Output<String> id, ClusterCapacityProvidersState state, CustomResourceOptions options)
resources:  _:    type: aws:ecs:ClusterCapacityProviders    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
CapacityProviders List<string>
Set of names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
ClusterName Changes to this property will trigger replacement. string
Name of the ECS cluster to manage capacity providers for.
DefaultCapacityProviderStrategies List<ClusterCapacityProvidersDefaultCapacityProviderStrategy>
Set of capacity provider strategies to use by default for the cluster. Detailed below.
CapacityProviders []string
Set of names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
ClusterName Changes to this property will trigger replacement. string
Name of the ECS cluster to manage capacity providers for.
DefaultCapacityProviderStrategies []ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs
Set of capacity provider strategies to use by default for the cluster. Detailed below.
capacityProviders List<String>
Set of names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
clusterName Changes to this property will trigger replacement. String
Name of the ECS cluster to manage capacity providers for.
defaultCapacityProviderStrategies List<ClusterCapacityProvidersDefaultCapacityProviderStrategy>
Set of capacity provider strategies to use by default for the cluster. Detailed below.
capacityProviders string[]
Set of names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
clusterName Changes to this property will trigger replacement. string
Name of the ECS cluster to manage capacity providers for.
defaultCapacityProviderStrategies ClusterCapacityProvidersDefaultCapacityProviderStrategy[]
Set of capacity provider strategies to use by default for the cluster. Detailed below.
capacity_providers Sequence[str]
Set of names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
cluster_name Changes to this property will trigger replacement. str
Name of the ECS cluster to manage capacity providers for.
default_capacity_provider_strategies Sequence[ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs]
Set of capacity provider strategies to use by default for the cluster. Detailed below.
capacityProviders List<String>
Set of names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
clusterName Changes to this property will trigger replacement. String
Name of the ECS cluster to manage capacity providers for.
defaultCapacityProviderStrategies List<Property Map>
Set of capacity provider strategies to use by default for the cluster. Detailed below.

Supporting Types

ClusterCapacityProvidersDefaultCapacityProviderStrategy
, ClusterCapacityProvidersDefaultCapacityProviderStrategyArgs

CapacityProvider This property is required. string
Name of the capacity provider.
Base int
The number of tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. Defaults to 0.
Weight int
The relative percentage of the total number of launched tasks that should use the specified capacity provider. The weight value is taken into consideration after the base count of tasks has been satisfied. Defaults to 0.
CapacityProvider This property is required. string
Name of the capacity provider.
Base int
The number of tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. Defaults to 0.
Weight int
The relative percentage of the total number of launched tasks that should use the specified capacity provider. The weight value is taken into consideration after the base count of tasks has been satisfied. Defaults to 0.
capacityProvider This property is required. String
Name of the capacity provider.
base Integer
The number of tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. Defaults to 0.
weight Integer
The relative percentage of the total number of launched tasks that should use the specified capacity provider. The weight value is taken into consideration after the base count of tasks has been satisfied. Defaults to 0.
capacityProvider This property is required. string
Name of the capacity provider.
base number
The number of tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. Defaults to 0.
weight number
The relative percentage of the total number of launched tasks that should use the specified capacity provider. The weight value is taken into consideration after the base count of tasks has been satisfied. Defaults to 0.
capacity_provider This property is required. str
Name of the capacity provider.
base int
The number of tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. Defaults to 0.
weight int
The relative percentage of the total number of launched tasks that should use the specified capacity provider. The weight value is taken into consideration after the base count of tasks has been satisfied. Defaults to 0.
capacityProvider This property is required. String
Name of the capacity provider.
base Number
The number of tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. Defaults to 0.
weight Number
The relative percentage of the total number of launched tasks that should use the specified capacity provider. The weight value is taken into consideration after the base count of tasks has been satisfied. Defaults to 0.

Import

Using pulumi import, import ECS cluster capacity providers using the cluster_name attribute. For example:

$ pulumi import aws:ecs/clusterCapacityProviders:ClusterCapacityProviders example my-cluster
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.