Cluster class

Provides an ECS cluster.

Example Usage

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

const foo = new aws.ecs.Cluster("foo", {
    settings: [{
        name: "containerInsights",
        value: "enabled",
    }],
    name: "white-hart",
});
import pulumi
import pulumi_aws as aws

foo = aws.ecs.Cluster("foo",
    settings=[{
        "name": "containerInsights",
        "value": "enabled",
    }],
    name="white-hart")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var foo = new Aws.Ecs.Cluster("foo", new()
    {
        Settings = new[]
        {
            new Aws.Ecs.Inputs.ClusterSettingArgs
            {
                Name = "containerInsights",
                Value = "enabled",
            },
        },
        Name = "white-hart",
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/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"),
				},
			},
			Name: pulumi.String("white-hart"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_ecs_cluster" "foo" {
  settings {
    name  = "containerInsights"
    value = "enabled"
  }
  name = "white-hart"
}
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.inputs.ClusterSettingArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 foo = new Cluster("foo", ClusterArgs.builder()
            .settings(ClusterSettingArgs.builder()
                .name("containerInsights")
                .value("enabled")
                .build())
            .name("white-hart")
            .build());

    }
}
resources:
  foo:
    type: aws:ecs:Cluster
    properties:
      settings:
        - name: containerInsights
          value: enabled
      name: white-hart

Execute Command Configuration with Override Logging

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

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

example = aws.kms.Key("example",
    description="example",
    deletion_window_in_days=7)
example_log_group = aws.cloudwatch.LogGroup("example", name="example")
test = aws.ecs.Cluster("test",
    configuration={
        "execute_command_configuration": {
            "log_configuration": {
                "cloud_watch_encryption_enabled": True,
                "cloud_watch_log_group_name": example_log_group.name,
            },
            "kms_key_id": example.arn,
            "logging": "OVERRIDE",
        },
    },
    name="example")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Kms.Key("example", new()
    {
        Description = "example",
        DeletionWindowInDays = 7,
    });

    var exampleLogGroup = new Aws.CloudWatch.LogGroup("example", new()
    {
        Name = "example",
    });

    var test = new Aws.Ecs.Cluster("test", new()
    {
        Configuration = new Aws.Ecs.Inputs.ClusterConfigurationArgs
        {
            ExecuteCommandConfiguration = new Aws.Ecs.Inputs.ClusterConfigurationExecuteCommandConfigurationArgs
            {
                LogConfiguration = new Aws.Ecs.Inputs.ClusterConfigurationExecuteCommandConfigurationLogConfigurationArgs
                {
                    CloudWatchEncryptionEnabled = true,
                    CloudWatchLogGroupName = exampleLogGroup.Name,
                },
                KmsKeyId = example.Arn,
                Logging = "OVERRIDE",
            },
        },
        Name = "example",
    });

});
package main

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

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

resource "aws_kms_key" "example" {
  description             = "example"
  deletion_window_in_days = 7
}
resource "aws_cloudwatch_loggroup" "example" {
  name = "example"
}
resource "aws_ecs_cluster" "test" {
  configuration = {
    execute_command_configuration = {
      log_configuration = {
        cloud_watch_encryption_enabled = true
        cloud_watch_log_group_name     = aws_cloudwatch_loggroup.example.name
      }
      kms_key_id = aws_kms_key.example.arn
      logging    = "OVERRIDE"
    }
  }
  name = "example"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.kms.Key;
import com.pulumi.aws.kms.KeyArgs;
import com.pulumi.aws.cloudwatch.LogGroup;
import com.pulumi.aws.cloudwatch.LogGroupArgs;
import com.pulumi.aws.ecs.Cluster;
import com.pulumi.aws.ecs.ClusterArgs;
import com.pulumi.aws.ecs.inputs.ClusterConfigurationArgs;
import com.pulumi.aws.ecs.inputs.ClusterConfigurationExecuteCommandConfigurationArgs;
import com.pulumi.aws.ecs.inputs.ClusterConfigurationExecuteCommandConfigurationLogConfigurationArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 Key("example", KeyArgs.builder()
            .description("example")
            .deletionWindowInDays(7)
            .build());

        var exampleLogGroup = new LogGroup("exampleLogGroup", LogGroupArgs.builder()
            .name("example")
            .build());

        var test = new Cluster("test", ClusterArgs.builder()
            .configuration(ClusterConfigurationArgs.builder()
                .executeCommandConfiguration(ClusterConfigurationExecuteCommandConfigurationArgs.builder()
                    .logConfiguration(ClusterConfigurationExecuteCommandConfigurationLogConfigurationArgs.builder()
                        .cloudWatchEncryptionEnabled(true)
                        .cloudWatchLogGroupName(exampleLogGroup.name())
                        .build())
                    .kmsKeyId(example.arn())
                    .logging("OVERRIDE")
                    .build())
                .build())
            .name("example")
            .build());

    }
}
resources:
  example:
    type: aws:kms:Key
    properties:
      description: example
      deletionWindowInDays: 7
  exampleLogGroup:
    type: aws:cloudwatch:LogGroup
    name: example
    properties:
      name: example
  test:
    type: aws:ecs:Cluster
    properties:
      configuration:
        executeCommandConfiguration:
          logConfiguration:
            cloudWatchEncryptionEnabled: true
            cloudWatchLogGroupName: ${exampleLogGroup.name}
          kmsKeyId: ${example.arn}
          logging: OVERRIDE
      name: example

Fargate Ephemeral Storage Encryption with Customer-Managed KMS Key

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

const current = aws.getCallerIdentity({});
const example = new aws.kms.Key("example", {
    description: "example",
    deletionWindowInDays: 7,
});
const exampleKeyPolicy = new aws.kms.KeyPolicy("example", {
    keyId: example.id,
    policy: JSON.stringify({
        Id: "ECSClusterFargatePolicy",
        Statement: [
            {
                Sid: "Enable IAM User Permissions",
                Effect: "Allow",
                Principal: {
                    AWS: "*",
                },
                Action: "kms:*",
                Resource: "*",
            },
            {
                Sid: "Allow generate data key access for Fargate tasks.",
                Effect: "Allow",
                Principal: {
                    Service: "fargate.amazonaws.com",
                },
                Action: ["kms:GenerateDataKeyWithoutPlaintext"],
                Condition: {
                    StringEquals: {
                        "kms:EncryptionContext:aws:ecs:clusterAccount": [current.then(current => current.accountId)],
                        "kms:EncryptionContext:aws:ecs:clusterName": ["example"],
                    },
                },
                Resource: "*",
            },
            {
                Sid: "Allow grant creation permission for Fargate tasks.",
                Effect: "Allow",
                Principal: {
                    Service: "fargate.amazonaws.com",
                },
                Action: ["kms:CreateGrant"],
                Condition: {
                    StringEquals: {
                        "kms:EncryptionContext:aws:ecs:clusterAccount": [current.then(current => current.accountId)],
                        "kms:EncryptionContext:aws:ecs:clusterName": ["example"],
                    },
                    "ForAllValues:StringEquals": {
                        "kms:GrantOperations": ["Decrypt"],
                    },
                },
                Resource: "*",
            },
        ],
        Version: "2012-10-17",
    }),
});
const test = new aws.ecs.Cluster("test", {
    configuration: {
        managedStorageConfiguration: {
            fargateEphemeralStorageKmsKeyId: example.arn,
        },
    },
    name: "example",
}, {
    dependsOn: [exampleKeyPolicy],
});
import pulumi
import json
import pulumi_aws as aws

current = aws.get_caller_identity()
example = aws.kms.Key("example",
    description="example",
    deletion_window_in_days=7)
example_key_policy = aws.kms.KeyPolicy("example",
    key_id=example.id,
    policy=json.dumps({
        "Id": "ECSClusterFargatePolicy",
        "Statement": [
            {
                "Sid": "Enable IAM User Permissions",
                "Effect": "Allow",
                "Principal": {
                    "AWS": "*",
                },
                "Action": "kms:*",
                "Resource": "*",
            },
            {
                "Sid": "Allow generate data key access for Fargate tasks.",
                "Effect": "Allow",
                "Principal": {
                    "Service": "fargate.amazonaws.com",
                },
                "Action": ["kms:GenerateDataKeyWithoutPlaintext"],
                "Condition": {
                    "StringEquals": {
                        "kms:EncryptionContext:aws:ecs:clusterAccount": [current.account_id],
                        "kms:EncryptionContext:aws:ecs:clusterName": ["example"],
                    },
                },
                "Resource": "*",
            },
            {
                "Sid": "Allow grant creation permission for Fargate tasks.",
                "Effect": "Allow",
                "Principal": {
                    "Service": "fargate.amazonaws.com",
                },
                "Action": ["kms:CreateGrant"],
                "Condition": {
                    "StringEquals": {
                        "kms:EncryptionContext:aws:ecs:clusterAccount": [current.account_id],
                        "kms:EncryptionContext:aws:ecs:clusterName": ["example"],
                    },
                    "ForAllValues:StringEquals": {
                        "kms:GrantOperations": ["Decrypt"],
                    },
                },
                "Resource": "*",
            },
        ],
        "Version": "2012-10-17",
    }))
test = aws.ecs.Cluster("test",
    configuration={
        "managed_storage_configuration": {
            "fargate_ephemeral_storage_kms_key_id": example.arn,
        },
    },
    name="example",
    opts = pulumi.ResourceOptions(depends_on=[example_key_policy]))
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var current = Aws.GetCallerIdentity.Invoke();

    var example = new Aws.Kms.Key("example", new()
    {
        Description = "example",
        DeletionWindowInDays = 7,
    });

    var exampleKeyPolicy = new Aws.Kms.KeyPolicy("example", new()
    {
        KeyId = example.Id,
        Policy = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["Id"] = "ECSClusterFargatePolicy",
            ["Statement"] = new[]
            {
                new Dictionary<string, object?>
                {
                    ["Sid"] = "Enable IAM User Permissions",
                    ["Effect"] = "Allow",
                    ["Principal"] = new Dictionary<string, object?>
                    {
                        ["AWS"] = "*",
                    },
                    ["Action"] = "kms:*",
                    ["Resource"] = "*",
                },
                new Dictionary<string, object?>
                {
                    ["Sid"] = "Allow generate data key access for Fargate tasks.",
                    ["Effect"] = "Allow",
                    ["Principal"] = new Dictionary<string, object?>
                    {
                        ["Service"] = "fargate.amazonaws.com",
                    },
                    ["Action"] = new[]
                    {
                        "kms:GenerateDataKeyWithoutPlaintext",
                    },
                    ["Condition"] = new Dictionary<string, object?>
                    {
                        ["StringEquals"] = new Dictionary<string, object?>
                        {
                            ["kms:EncryptionContext:aws:ecs:clusterAccount"] = new[]
                            {
                                current.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId),
                            },
                            ["kms:EncryptionContext:aws:ecs:clusterName"] = new[]
                            {
                                "example",
                            },
                        },
                    },
                    ["Resource"] = "*",
                },
                new Dictionary<string, object?>
                {
                    ["Sid"] = "Allow grant creation permission for Fargate tasks.",
                    ["Effect"] = "Allow",
                    ["Principal"] = new Dictionary<string, object?>
                    {
                        ["Service"] = "fargate.amazonaws.com",
                    },
                    ["Action"] = new[]
                    {
                        "kms:CreateGrant",
                    },
                    ["Condition"] = new Dictionary<string, object?>
                    {
                        ["StringEquals"] = new Dictionary<string, object?>
                        {
                            ["kms:EncryptionContext:aws:ecs:clusterAccount"] = new[]
                            {
                                current.Apply(getCallerIdentityResult => getCallerIdentityResult.AccountId),
                            },
                            ["kms:EncryptionContext:aws:ecs:clusterName"] = new[]
                            {
                                "example",
                            },
                        },
                        ["ForAllValues:StringEquals"] = new Dictionary<string, object?>
                        {
                            ["kms:GrantOperations"] = new[]
                            {
                                "Decrypt",
                            },
                        },
                    },
                    ["Resource"] = "*",
                },
            },
            ["Version"] = "2012-10-17",
        }),
    });

    var test = new Aws.Ecs.Cluster("test", new()
    {
        Configuration = new Aws.Ecs.Inputs.ClusterConfigurationArgs
        {
            ManagedStorageConfiguration = new Aws.Ecs.Inputs.ClusterConfigurationManagedStorageConfigurationArgs
            {
                FargateEphemeralStorageKmsKeyId = example.Arn,
            },
        },
        Name = "example",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            exampleKeyPolicy,
        },
    });

});
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ecs"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/kms"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		current, err := aws.GetCallerIdentity(ctx, &aws.GetCallerIdentityArgs{}, nil)
		if err != nil {
			return err
		}
		example, err := kms.NewKey(ctx, "example", &kms.KeyArgs{
			Description:          pulumi.String("example"),
			DeletionWindowInDays: pulumi.Int(7),
		})
		if err != nil {
			return err
		}
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"Id": "ECSClusterFargatePolicy",
			"Statement": []interface{}{
				map[string]interface{}{
					"Sid":    "Enable IAM User Permissions",
					"Effect": "Allow",
					"Principal": map[string]string{
						"AWS": "*",
					},
					"Action":   "kms:*",
					"Resource": "*",
				},
				map[string]interface{}{
					"Sid":    "Allow generate data key access for Fargate tasks.",
					"Effect": "Allow",
					"Principal": map[string]string{
						"Service": "fargate.amazonaws.com",
					},
					"Action": []string{
						"kms:GenerateDataKeyWithoutPlaintext",
					},
					"Condition": map[string]map[string]interface{}{
						"StringEquals": map[string]interface{}{
							"kms:EncryptionContext:aws:ecs:clusterAccount": []*string{
								current.AccountId,
							},
							"kms:EncryptionContext:aws:ecs:clusterName": []string{
								"example",
							},
						},
					},
					"Resource": "*",
				},
				map[string]interface{}{
					"Sid":    "Allow grant creation permission for Fargate tasks.",
					"Effect": "Allow",
					"Principal": map[string]string{
						"Service": "fargate.amazonaws.com",
					},
					"Action": []string{
						"kms:CreateGrant",
					},
					"Condition": map[string]interface{}{
						"StringEquals": map[string]interface{}{
							"kms:EncryptionContext:aws:ecs:clusterAccount": []*string{
								current.AccountId,
							},
							"kms:EncryptionContext:aws:ecs:clusterName": []string{
								"example",
							},
						},
						"ForAllValues:StringEquals": map[string][]string{
							"kms:GrantOperations": []string{
								"Decrypt",
							},
						},
					},
					"Resource": "*",
				},
			},
			"Version": "2012-10-17",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		exampleKeyPolicy, err := kms.NewKeyPolicy(ctx, "example", &kms.KeyPolicyArgs{
			KeyId:  example.ID().ToIDOutput().ToStringOutput(),
			Policy: json0,
		})
		if err != nil {
			return err
		}
		_, err = ecs.NewCluster(ctx, "test", &ecs.ClusterArgs{
			Configuration: &ecs.ClusterConfigurationArgs{
				ManagedStorageConfiguration: &ecs.ClusterConfigurationManagedStorageConfigurationArgs{
					FargateEphemeralStorageKmsKeyId: example.Arn,
				},
			},
			Name: pulumi.String("example"),
		}, pulumi.DependsOn([]pulumi.Resource{
			exampleKeyPolicy,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_getcalleridentity" "current" {
}

resource "aws_kms_key" "example" {
  description             = "example"
  deletion_window_in_days = 7
}
resource "aws_kms_keypolicy" "example" {
  key_id = aws_kms_key.example.id
  policy = jsonencode({
    "Id" = "ECSClusterFargatePolicy"
    "Statement" = [{
      "Sid"    = "Enable IAM User Permissions"
      "Effect" = "Allow"
      "Principal" = {
        "AWS" = "*"
      }
      "Action"   = "kms:*"
      "Resource" = "*"
      }, {
      "Sid"    = "Allow generate data key access for Fargate tasks."
      "Effect" = "Allow"
      "Principal" = {
        "Service" = "fargate.amazonaws.com"
      }
      "Action" = ["kms:GenerateDataKeyWithoutPlaintext"]
      "Condition" = {
        "StringEquals" = {
          "kms:EncryptionContext:aws:ecs:clusterAccount" = [data.aws_getcalleridentity.current.account_id]
          "kms:EncryptionContext:aws:ecs:clusterName"    = ["example"]
        }
      }
      "Resource" = "*"
      }, {
      "Sid"    = "Allow grant creation permission for Fargate tasks."
      "Effect" = "Allow"
      "Principal" = {
        "Service" = "fargate.amazonaws.com"
      }
      "Action" = ["kms:CreateGrant"]
      "Condition" = {
        "StringEquals" = {
          "kms:EncryptionContext:aws:ecs:clusterAccount" = [data.aws_getcalleridentity.current.account_id]
          "kms:EncryptionContext:aws:ecs:clusterName"    = ["example"]
        }
        "ForAllValues:StringEquals" = {
          "kms:GrantOperations" = ["Decrypt"]
        }
      }
      "Resource" = "*"
    }]
    "Version" = "2012-10-17"
  })
}
resource "aws_ecs_cluster" "test" {
  depends_on = [aws_kms_keypolicy.example]
  configuration = {
    managed_storage_configuration = {
      fargate_ephemeral_storage_kms_key_id = aws_kms_key.example.arn
    }
  }
  name = "example"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetCallerIdentityArgs;
import com.pulumi.aws.kms.Key;
import com.pulumi.aws.kms.KeyArgs;
import com.pulumi.aws.kms.KeyPolicy;
import com.pulumi.aws.kms.KeyPolicyArgs;
import com.pulumi.aws.ecs.Cluster;
import com.pulumi.aws.ecs.ClusterArgs;
import com.pulumi.aws.ecs.inputs.ClusterConfigurationArgs;
import com.pulumi.aws.ecs.inputs.ClusterConfigurationManagedStorageConfigurationArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
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) {
        final var current = AwsFunctions.getCallerIdentity(GetCallerIdentityArgs.builder()
            .build());

        var example = new Key("example", KeyArgs.builder()
            .description("example")
            .deletionWindowInDays(7)
            .build());

        var exampleKeyPolicy = new KeyPolicy("exampleKeyPolicy", KeyPolicyArgs.builder()
            .keyId(example.id())
            .policy(serializeJson(
                jsonObject(
                    jsonProperty("Id", "ECSClusterFargatePolicy"),
                    jsonProperty("Statement", jsonArray(
                        jsonObject(
                            jsonProperty("Sid", "Enable IAM User Permissions"),
                            jsonProperty("Effect", "Allow"),
                            jsonProperty("Principal", jsonObject(
                                jsonProperty("AWS", "*")
                            )),
                            jsonProperty("Action", "kms:*"),
                            jsonProperty("Resource", "*")
                        ),
                        jsonObject(
                            jsonProperty("Sid", "Allow generate data key access for Fargate tasks."),
                            jsonProperty("Effect", "Allow"),
                            jsonProperty("Principal", jsonObject(
                                jsonProperty("Service", "fargate.amazonaws.com")
                            )),
                            jsonProperty("Action", jsonArray("kms:GenerateDataKeyWithoutPlaintext")),
                            jsonProperty("Condition", jsonObject(
                                jsonProperty("StringEquals", jsonObject(
                                    jsonProperty("kms:EncryptionContext:aws:ecs:clusterAccount", jsonArray(current.accountId())),
                                    jsonProperty("kms:EncryptionContext:aws:ecs:clusterName", jsonArray("example"))
                                ))
                            )),
                            jsonProperty("Resource", "*")
                        ),
                        jsonObject(
                            jsonProperty("Sid", "Allow grant creation permission for Fargate tasks."),
                            jsonProperty("Effect", "Allow"),
                            jsonProperty("Principal", jsonObject(
                                jsonProperty("Service", "fargate.amazonaws.com")
                            )),
                            jsonProperty("Action", jsonArray("kms:CreateGrant")),
                            jsonProperty("Condition", jsonObject(
                                jsonProperty("StringEquals", jsonObject(
                                    jsonProperty("kms:EncryptionContext:aws:ecs:clusterAccount", jsonArray(current.accountId())),
                                    jsonProperty("kms:EncryptionContext:aws:ecs:clusterName", jsonArray("example"))
                                )),
                                jsonProperty("ForAllValues:StringEquals", jsonObject(
                                    jsonProperty("kms:GrantOperations", jsonArray("Decrypt"))
                                ))
                            )),
                            jsonProperty("Resource", "*")
                        )
                    )),
                    jsonProperty("Version", "2012-10-17")
                )))
            .build());

        var test = new Cluster("test", ClusterArgs.builder()
            .configuration(ClusterConfigurationArgs.builder()
                .managedStorageConfiguration(ClusterConfigurationManagedStorageConfigurationArgs.builder()
                    .fargateEphemeralStorageKmsKeyId(example.arn())
                    .build())
                .build())
            .name("example")
            .build(), CustomResourceOptions.builder()
                .dependsOn(exampleKeyPolicy)
                .build());

    }
}
resources:
  example:
    type: aws:kms:Key
    properties:
      description: example
      deletionWindowInDays: 7
  exampleKeyPolicy:
    type: aws:kms:KeyPolicy
    name: example
    properties:
      keyId: ${example.id}
      policy:
        fn::toJSON:
          Id: ECSClusterFargatePolicy
          Statement:
            - Sid: Enable IAM User Permissions
              Effect: Allow
              Principal:
                AWS: '*'
              Action: kms:*
              Resource: '*'
            - Sid: Allow generate data key access for Fargate tasks.
              Effect: Allow
              Principal:
                Service: fargate.amazonaws.com
              Action:
                - kms:GenerateDataKeyWithoutPlaintext
              Condition:
                StringEquals:
                  kms:EncryptionContext:aws:ecs:clusterAccount:
                    - ${current.accountId}
                  kms:EncryptionContext:aws:ecs:clusterName:
                    - example
              Resource: '*'
            - Sid: Allow grant creation permission for Fargate tasks.
              Effect: Allow
              Principal:
                Service: fargate.amazonaws.com
              Action:
                - kms:CreateGrant
              Condition:
                StringEquals:
                  kms:EncryptionContext:aws:ecs:clusterAccount:
                    - ${current.accountId}
                  kms:EncryptionContext:aws:ecs:clusterName:
                    - example
                ForAllValues:StringEquals:
                  kms:GrantOperations:
                    - Decrypt
              Resource: '*'
          Version: 2012-10-17
  test:
    type: aws:ecs:Cluster
    properties:
      configuration:
        managedStorageConfiguration:
          fargateEphemeralStorageKmsKeyId: ${example.arn}
      name: example
    options:
      dependsOn:
        - ${exampleKeyPolicy}
variables:
  current:
    fn::invoke:
      function: aws:getCallerIdentity
      arguments: {}

Import

Identity Schema

Required

  • name (String) Name of the cluster.

Optional

  • accountId (String) AWS Account where this resource is managed.
  • region (String) Region where this resource is managed.

Using pulumi import, import ECS clusters using the cluster name. For example:

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

Constructors

Cluster(String name, {ClusterArgs? args, CustomResourceOptions? options})
Creates a new Cluster. name The Pulumi resource name. args Arguments used to configure this Cluster. The set of arguments for Cluster. options Resource options controlling this resource's behavior.
Cluster.reference(String urn)
Creates a typed reference to an existing Cluster resource.

Properties

arn ↔ Output<String>
ARN that identifies the cluster.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
configuration ↔ Output<ClusterConfiguration?>
Execute command configuration for the cluster. See configuration Block for details.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
name ↔ Output<String>
Name of the cluster (up to 255 letters, numbers, hyphens, and underscores)
latefinal
region ↔ Output<String>
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serviceConnectDefaults ↔ Output<ClusterServiceConnectDefaults?>
Default Service Connect namespace. See serviceConnectDefaults Block for details.
latefinal
settings ↔ Output<List<ClusterSetting>>
Configuration block(s) with cluster settings. For example, this can be used to enable CloudWatch Container Insights for a cluster. See setting Block for details.
latefinal
tags ↔ Output<Map<String, String>?>
Key-value map of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.
latefinal
tagsAll ↔ Output<Map<String, String>>
Map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {ClusterState? state, CustomResourceOptions? options}) → Cluster
Gets an existing Cluster resource's state with the given name and id.