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
var vpc = Vpc.FromLookup(this, "Vpc", new VpcLookupOptions {
IsDefault = true
});
var cluster = new Cluster(this, "FargateCluster", new ClusterProps { Vpc = vpc });
var taskDefinition = new TaskDefinition(this, "TD", new TaskDefinitionProps {
MemoryMiB = "512",
Cpu = "256",
Compatibility = Compatibility.FARGATE
});
var containerDefinition = taskDefinition.AddContainer("TheContainer", new ContainerDefinitionOptions {
Image = ContainerImage.FromRegistry("foo/bar"),
MemoryLimitMiB = 256
});
var runTask = new EcsRunTask(this, "RunFargate", new EcsRunTaskProps {
IntegrationPattern = IntegrationPattern.RUN_JOB,
Cluster = cluster,
TaskDefinition = taskDefinition,
AssignPublicIp = true,
ContainerOverrides = new [] { new ContainerOverride {
ContainerDefinition = containerDefinition,
Environment = new [] { new TaskEnvironmentVariable { Name = "SOME_KEY", Value = JsonPath.StringAt("$.SomeKey") } }
} },
LaunchTarget = new EcsFargateLaunchTarget(),
PropagatedTagSource = PropagatedTagSource.TASK_DEFINITION
});
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
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
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
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
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
Remarks
Default: - no configuration will be provided.
ManagedStorageConfiguration
Encryption configuration for ECS Managed storage.
IManagedStorageConfiguration? ManagedStorageConfiguration { get; }
Property Value
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
Remarks
Default: - creates a new VPC with two AZs