Welcome to Pulumi Registry, your window into the cloud. Read the announcement.

AWS Classic

v4.29.0 published on Monday, Nov 22, 2021 by Pulumi

Cluster

Provides an ECS cluster.

Example Usage

Basic Example

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var foo = new Aws.Ecs.Cluster("foo", new Aws.Ecs.ClusterArgs
        {
            Settings = 
            {
                new Aws.Ecs.Inputs.ClusterSettingArgs
                {
                    Name = "containerInsights",
                    Value = "enabled",
                },
            },
        });
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ecs.NewCluster(ctx, "foo", &ecs.ClusterArgs{
			Settings: ecs.ClusterSettingArray{
				&ecs.ClusterSettingArgs{
					Name:  pulumi.String("containerInsights"),
					Value: pulumi.String("enabled"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

foo = aws.ecs.Cluster("foo", settings=[aws.ecs.ClusterSettingArgs(
    name="containerInsights",
    value="enabled",
)])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const foo = new aws.ecs.Cluster("foo", {
    settings: [{
        name: "containerInsights",
        value: "enabled",
    }],
});

Example W/Log Configuration

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleKey = new Aws.Kms.Key("exampleKey", new Aws.Kms.KeyArgs
        {
            Description = "example",
            DeletionWindowInDays = 7,
        });
        var exampleLogGroup = new Aws.CloudWatch.LogGroup("exampleLogGroup", new Aws.CloudWatch.LogGroupArgs
        {
        });
        var test = new Aws.Ecs.Cluster("test", new Aws.Ecs.ClusterArgs
        {
            Configuration = new Aws.Ecs.Inputs.ClusterConfigurationArgs
            {
                ExecuteCommandConfiguration = new Aws.Ecs.Inputs.ClusterConfigurationExecuteCommandConfigurationArgs
                {
                    KmsKeyId = exampleKey.Arn,
                    Logging = "OVERRIDE",
                    LogConfiguration = new Aws.Ecs.Inputs.ClusterConfigurationExecuteCommandConfigurationLogConfigurationArgs
                    {
                        CloudWatchEncryptionEnabled = true,
                        CloudWatchLogGroupName = exampleLogGroup.Name,
                    },
                },
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/cloudwatch"
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ecs"
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/kms"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleKey, err := kms.NewKey(ctx, "exampleKey", &kms.KeyArgs{
			Description:          pulumi.String("example"),
			DeletionWindowInDays: pulumi.Int(7),
		})
		if err != nil {
			return err
		}
		exampleLogGroup, err := cloudwatch.NewLogGroup(ctx, "exampleLogGroup", nil)
		if err != nil {
			return err
		}
		_, err = ecs.NewCluster(ctx, "test", &ecs.ClusterArgs{
			Configuration: &ecs.ClusterConfigurationArgs{
				ExecuteCommandConfiguration: &ecs.ClusterConfigurationExecuteCommandConfigurationArgs{
					KmsKeyId: exampleKey.Arn,
					Logging:  pulumi.String("OVERRIDE"),
					LogConfiguration: &ecs.ClusterConfigurationExecuteCommandConfigurationLogConfigurationArgs{
						CloudWatchEncryptionEnabled: pulumi.Bool(true),
						CloudWatchLogGroupName:      exampleLogGroup.Name,
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

example_key = aws.kms.Key("exampleKey",
    description="example",
    deletion_window_in_days=7)
example_log_group = aws.cloudwatch.LogGroup("exampleLogGroup")
test = aws.ecs.Cluster("test", configuration=aws.ecs.ClusterConfigurationArgs(
    execute_command_configuration=aws.ecs.ClusterConfigurationExecuteCommandConfigurationArgs(
        kms_key_id=example_key.arn,
        logging="OVERRIDE",
        log_configuration=aws.ecs.ClusterConfigurationExecuteCommandConfigurationLogConfigurationArgs(
            cloud_watch_encryption_enabled=True,
            cloud_watch_log_group_name=example_log_group.name,
        ),
    ),
))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleKey = new aws.kms.Key("exampleKey", {
    description: "example",
    deletionWindowInDays: 7,
});
const exampleLogGroup = new aws.cloudwatch.LogGroup("exampleLogGroup", {});
const test = new aws.ecs.Cluster("test", {configuration: {
    executeCommandConfiguration: {
        kmsKeyId: exampleKey.arn,
        logging: "OVERRIDE",
        logConfiguration: {
            cloudWatchEncryptionEnabled: true,
            cloudWatchLogGroupName: exampleLogGroup.name,
        },
    },
}});

Create a Cluster Resource

new Cluster(name: string, args?: ClusterArgs, opts?: CustomResourceOptions);
@overload
def Cluster(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            capacity_providers: Optional[Sequence[str]] = None,
            configuration: Optional[ClusterConfigurationArgs] = None,
            default_capacity_provider_strategies: Optional[Sequence[ClusterDefaultCapacityProviderStrategyArgs]] = None,
            name: Optional[str] = None,
            settings: Optional[Sequence[ClusterSettingArgs]] = None,
            tags: Optional[Mapping[str, str]] = None)
@overload
def Cluster(resource_name: str,
            args: Optional[ClusterArgs] = None,
            opts: Optional[ResourceOptions] = None)
func NewCluster(ctx *Context, name string, args *ClusterArgs, opts ...ResourceOption) (*Cluster, error)
public Cluster(string name, ClusterArgs? args = null, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args ClusterArgs
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 ClusterArgs
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 ClusterArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ClusterArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Cluster 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 Cluster resource accepts the following input properties:

CapacityProviders List<string>
List of short names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
Configuration ClusterConfigurationArgs
The execute command configuration for the cluster. Detailed below.
DefaultCapacityProviderStrategies List<ClusterDefaultCapacityProviderStrategyArgs>
Configuration block for capacity provider strategy to use by default for the cluster. Can be one or more. Detailed below.
Name string
Name of the setting to manage. Valid values: containerInsights.
Settings List<ClusterSettingArgs>
Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below.
Tags Dictionary<string, string>
CapacityProviders []string
List of short names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
Configuration ClusterConfigurationArgs
The execute command configuration for the cluster. Detailed below.
DefaultCapacityProviderStrategies []ClusterDefaultCapacityProviderStrategyArgs
Configuration block for capacity provider strategy to use by default for the cluster. Can be one or more. Detailed below.
Name string
Name of the setting to manage. Valid values: containerInsights.
Settings []ClusterSettingArgs
Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below.
Tags map[string]string
capacityProviders string[]
List of short names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
configuration ClusterConfigurationArgs
The execute command configuration for the cluster. Detailed below.
defaultCapacityProviderStrategies ClusterDefaultCapacityProviderStrategyArgs[]
Configuration block for capacity provider strategy to use by default for the cluster. Can be one or more. Detailed below.
name string
Name of the setting to manage. Valid values: containerInsights.
settings ClusterSettingArgs[]
Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below.
tags {[key: string]: string}
capacity_providers Sequence[str]
List of short names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
configuration ClusterConfigurationArgs
The execute command configuration for the cluster. Detailed below.
default_capacity_provider_strategies Sequence[ClusterDefaultCapacityProviderStrategyArgs]
Configuration block for capacity provider strategy to use by default for the cluster. Can be one or more. Detailed below.
name str
Name of the setting to manage. Valid values: containerInsights.
settings Sequence[ClusterSettingArgs]
Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below.
tags Mapping[str, str]

Outputs

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

Arn string
ARN that identifies the cluster.
Id string
The provider-assigned unique ID for this managed resource.
TagsAll Dictionary<string, string>
Arn string
ARN that identifies the cluster.
Id string
The provider-assigned unique ID for this managed resource.
TagsAll map[string]string
arn string
ARN that identifies the cluster.
id string
The provider-assigned unique ID for this managed resource.
tagsAll {[key: string]: string}
arn str
ARN that identifies the cluster.
id str
The provider-assigned unique ID for this managed resource.
tags_all Mapping[str, str]

Look up an Existing Cluster Resource

Get an existing Cluster 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?: ClusterState, opts?: CustomResourceOptions): Cluster
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        capacity_providers: Optional[Sequence[str]] = None,
        configuration: Optional[ClusterConfigurationArgs] = None,
        default_capacity_provider_strategies: Optional[Sequence[ClusterDefaultCapacityProviderStrategyArgs]] = None,
        name: Optional[str] = None,
        settings: Optional[Sequence[ClusterSettingArgs]] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None) -> Cluster
func GetCluster(ctx *Context, name string, id IDInput, state *ClusterState, opts ...ResourceOption) (*Cluster, error)
public static Cluster Get(string name, Input<string> id, ClusterState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

Arn string
ARN that identifies the cluster.
CapacityProviders List<string>
List of short names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
Configuration ClusterConfigurationArgs
The execute command configuration for the cluster. Detailed below.
DefaultCapacityProviderStrategies List<ClusterDefaultCapacityProviderStrategyArgs>
Configuration block for capacity provider strategy to use by default for the cluster. Can be one or more. Detailed below.
Name string
Name of the setting to manage. Valid values: containerInsights.
Settings List<ClusterSettingArgs>
Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below.
Tags Dictionary<string, string>
TagsAll Dictionary<string, string>
Arn string
ARN that identifies the cluster.
CapacityProviders []string
List of short names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
Configuration ClusterConfigurationArgs
The execute command configuration for the cluster. Detailed below.
DefaultCapacityProviderStrategies []ClusterDefaultCapacityProviderStrategyArgs
Configuration block for capacity provider strategy to use by default for the cluster. Can be one or more. Detailed below.
Name string
Name of the setting to manage. Valid values: containerInsights.
Settings []ClusterSettingArgs
Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below.
Tags map[string]string
TagsAll map[string]string
arn string
ARN that identifies the cluster.
capacityProviders string[]
List of short names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
configuration ClusterConfigurationArgs
The execute command configuration for the cluster. Detailed below.
defaultCapacityProviderStrategies ClusterDefaultCapacityProviderStrategyArgs[]
Configuration block for capacity provider strategy to use by default for the cluster. Can be one or more. Detailed below.
name string
Name of the setting to manage. Valid values: containerInsights.
settings ClusterSettingArgs[]
Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below.
tags {[key: string]: string}
tagsAll {[key: string]: string}
arn str
ARN that identifies the cluster.
capacity_providers Sequence[str]
List of short names of one or more capacity providers to associate with the cluster. Valid values also include FARGATE and FARGATE_SPOT.
configuration ClusterConfigurationArgs
The execute command configuration for the cluster. Detailed below.
default_capacity_provider_strategies Sequence[ClusterDefaultCapacityProviderStrategyArgs]
Configuration block for capacity provider strategy to use by default for the cluster. Can be one or more. Detailed below.
name str
Name of the setting to manage. Valid values: containerInsights.
settings Sequence[ClusterSettingArgs]
Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. Detailed below.
tags Mapping[str, str]
tags_all Mapping[str, str]

Supporting Types

ClusterConfiguration

ExecuteCommandConfiguration ClusterConfigurationExecuteCommandConfiguration
The details of the execute command configuration. Detailed below.
ExecuteCommandConfiguration ClusterConfigurationExecuteCommandConfiguration
The details of the execute command configuration. Detailed below.
executeCommandConfiguration ClusterConfigurationExecuteCommandConfiguration
The details of the execute command configuration. Detailed below.
execute_command_configuration ClusterConfigurationExecuteCommandConfiguration
The details of the execute command configuration. Detailed below.

ClusterConfigurationExecuteCommandConfiguration

KmsKeyId string
The AWS Key Management Service key ID to encrypt the data between the local client and the container.
LogConfiguration ClusterConfigurationExecuteCommandConfigurationLogConfiguration
The log configuration for the results of the execute command actions Required when logging is OVERRIDE. Detailed below.
Logging string
The log setting to use for redirecting logs for your execute command results. Valid values are NONE, DEFAULT, and OVERRIDE.
KmsKeyId string
The AWS Key Management Service key ID to encrypt the data between the local client and the container.
LogConfiguration ClusterConfigurationExecuteCommandConfigurationLogConfiguration
The log configuration for the results of the execute command actions Required when logging is OVERRIDE. Detailed below.
Logging string
The log setting to use for redirecting logs for your execute command results. Valid values are NONE, DEFAULT, and OVERRIDE.
kmsKeyId string
The AWS Key Management Service key ID to encrypt the data between the local client and the container.
logConfiguration ClusterConfigurationExecuteCommandConfigurationLogConfiguration
The log configuration for the results of the execute command actions Required when logging is OVERRIDE. Detailed below.
logging string
The log setting to use for redirecting logs for your execute command results. Valid values are NONE, DEFAULT, and OVERRIDE.
kms_key_id str
The AWS Key Management Service key ID to encrypt the data between the local client and the container.
log_configuration ClusterConfigurationExecuteCommandConfigurationLogConfiguration
The log configuration for the results of the execute command actions Required when logging is OVERRIDE. Detailed below.
logging str
The log setting to use for redirecting logs for your execute command results. Valid values are NONE, DEFAULT, and OVERRIDE.

ClusterConfigurationExecuteCommandConfigurationLogConfiguration

CloudWatchEncryptionEnabled bool
Whether or not to enable encryption on the CloudWatch logs. If not specified, encryption will be disabled.
CloudWatchLogGroupName string
The name of the CloudWatch log group to send logs to.
S3BucketEncryptionEnabled bool
Whether or not to enable encryption on the logs sent to S3. If not specified, encryption will be disabled.
S3BucketName string
The name of the S3 bucket to send logs to.
S3KeyPrefix string
An optional folder in the S3 bucket to place logs in.
CloudWatchEncryptionEnabled bool
Whether or not to enable encryption on the CloudWatch logs. If not specified, encryption will be disabled.
CloudWatchLogGroupName string
The name of the CloudWatch log group to send logs to.
S3BucketEncryptionEnabled bool
Whether or not to enable encryption on the logs sent to S3. If not specified, encryption will be disabled.
S3BucketName string
The name of the S3 bucket to send logs to.
S3KeyPrefix string
An optional folder in the S3 bucket to place logs in.
cloudWatchEncryptionEnabled boolean
Whether or not to enable encryption on the CloudWatch logs. If not specified, encryption will be disabled.
cloudWatchLogGroupName string
The name of the CloudWatch log group to send logs to.
s3BucketEncryptionEnabled boolean
Whether or not to enable encryption on the logs sent to S3. If not specified, encryption will be disabled.
s3BucketName string
The name of the S3 bucket to send logs to.
s3KeyPrefix string
An optional folder in the S3 bucket to place logs in.
cloud_watch_encryption_enabled bool
Whether or not to enable encryption on the CloudWatch logs. If not specified, encryption will be disabled.
cloud_watch_log_group_name str
The name of the CloudWatch log group to send logs to.
s3_bucket_encryption_enabled bool
Whether or not to enable encryption on the logs sent to S3. If not specified, encryption will be disabled.
s3_bucket_name str
The name of the S3 bucket to send logs to.
s3_key_prefix str
An optional folder in the S3 bucket to place logs in.

ClusterDefaultCapacityProviderStrategy

CapacityProvider string
The short 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.
Weight int
The relative percentage of the total number of launched tasks that should use the specified capacity provider.
CapacityProvider string
The short 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.
Weight int
The relative percentage of the total number of launched tasks that should use the specified capacity provider.
capacityProvider string
The short 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.
weight number
The relative percentage of the total number of launched tasks that should use the specified capacity provider.
capacity_provider str
The short 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.
weight int
The relative percentage of the total number of launched tasks that should use the specified capacity provider.

ClusterSetting

Name string
Name of the setting to manage. Valid values: containerInsights.
Value string
The value to assign to the setting. Value values are enabled and disabled.
Name string
Name of the setting to manage. Valid values: containerInsights.
Value string
The value to assign to the setting. Value values are enabled and disabled.
name string
Name of the setting to manage. Valid values: containerInsights.
value string
The value to assign to the setting. Value values are enabled and disabled.
name str
Name of the setting to manage. Valid values: containerInsights.
value str
The value to assign to the setting. Value values are enabled and disabled.

Import

ECS clusters can be imported using the name, e.g.,

 $ pulumi import aws:ecs/cluster:Cluster stateless stateless-app

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.