Show / Hide Table of Contents

Interface IClusterProps

The properties used to define an ECS cluster.

Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface IClusterProps
Syntax (vb)
Public Interface IClusterProps
Remarks

ExampleMetadata: infused

Examples
Vpc vpc;


            var cluster = new Cluster(this, "Cluster", new ClusterProps {
                Vpc = vpc
            });

            var autoScalingGroup = new AutoScalingGroup(this, "ASG", new AutoScalingGroupProps {
                Vpc = vpc,
                InstanceType = new InstanceType("t2.micro"),
                MachineImage = EcsOptimizedImage.AmazonLinux2(),
                MinCapacity = 0,
                MaxCapacity = 100
            });

            var capacityProvider = new AsgCapacityProvider(this, "AsgCapacityProvider", new AsgCapacityProviderProps {
                AutoScalingGroup = autoScalingGroup,
                InstanceWarmupPeriod = 300
            });
            cluster.AddAsgCapacityProvider(capacityProvider);

            var taskDefinition = new Ec2TaskDefinition(this, "TaskDef");

            taskDefinition.AddContainer("web", new ContainerDefinitionOptions {
                Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample"),
                MemoryReservationMiB = 256
            });

            new Ec2Service(this, "EC2Service", new Ec2ServiceProps {
                Cluster = cluster,
                TaskDefinition = taskDefinition,
                MinHealthyPercent = 100,
                CapacityProviderStrategies = new [] { new CapacityProviderStrategy {
                    CapacityProvider = capacityProvider.CapacityProviderName,
                    Weight = 1
                } }
            });

Synopsis

Properties

Capacity

The ec2 capacity to add to the cluster.

ClusterName

The name for the cluster.

ContainerInsights

(deprecated) If true CloudWatch Container Insights will be enabled for the cluster.

ContainerInsightsV2

The CloudWatch Container Insights configuration for the cluster.

DefaultCloudMapNamespace

The service discovery namespace created in this cluster.

EnableFargateCapacityProviders

Whether to enable Fargate Capacity Providers.

ExecuteCommandConfiguration

The execute command configuration for the cluster.

ManagedStorageConfiguration

Encryption configuration for ECS Managed storage.

Vpc

The VPC where your ECS instances will be running or your ENIs will be deployed.

Properties

Capacity

The ec2 capacity to add to the cluster.

IAddCapacityOptions? Capacity { get; }
Property Value

IAddCapacityOptions

Remarks

Default: - no EC2 capacity will be added, you can use addCapacity to add capacity later.

ClusterName

The name for the cluster.

string? ClusterName { get; }
Property Value

string

Remarks

Default: CloudFormation-generated name

ContainerInsights

(deprecated) If true CloudWatch Container Insights will be enabled for the cluster.

[Obsolete("See {@link containerInsightsV2 }")]
bool? ContainerInsights { get; }
Property Value

bool?

Remarks

Default: - Container Insights will be disabled for this cluster.

Stability: Deprecated

ContainerInsightsV2

The CloudWatch Container Insights configuration for the cluster.

ContainerInsights? ContainerInsightsV2 { get; }
Property Value

ContainerInsights?

Remarks

Default: {@link ContainerInsights.DISABLED } This may be overridden by ECS account level settings.

DefaultCloudMapNamespace

The service discovery namespace created in this cluster.

ICloudMapNamespaceOptions? DefaultCloudMapNamespace { get; }
Property Value

ICloudMapNamespaceOptions

Remarks

Default: - no service discovery namespace created, you can use addDefaultCloudMapNamespace to add a default service discovery namespace later.

EnableFargateCapacityProviders

Whether to enable Fargate Capacity Providers.

bool? EnableFargateCapacityProviders { get; }
Property Value

bool?

Remarks

Default: false

ExecuteCommandConfiguration

The execute command configuration for the cluster.

IExecuteCommandConfiguration? ExecuteCommandConfiguration { get; }
Property Value

IExecuteCommandConfiguration

Remarks

Default: - no configuration will be provided.

ManagedStorageConfiguration

Encryption configuration for ECS Managed storage.

IManagedStorageConfiguration? ManagedStorageConfiguration { get; }
Property Value

IManagedStorageConfiguration

Remarks

Default: - no encryption will be applied.

Vpc

The VPC where your ECS instances will be running or your ENIs will be deployed.

IVpc? Vpc { get; }
Property Value

IVpc

Remarks

Default: - creates a new VPC with two AZs

Back to top Generated by DocFX