Interface IClusterProps
The properties used to define an ECS cluster.
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.AWS.ECS.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()
});
Synopsis
Properties
Capacity | The ec2 capacity to add to the cluster. |
CapacityProviders | (deprecated) The capacity providers to add to the cluster. |
ClusterName | The name for the cluster. |
ContainerInsights | If true CloudWatch Container Insights will be enabled 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. |
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.
virtual IAddCapacityOptions Capacity { get; }
Property Value
Remarks
Default: - no EC2 capacity will be added, you can use addCapacity
to add capacity later.
CapacityProviders
(deprecated) The capacity providers to add to the cluster.
virtual string[] CapacityProviders { get; }
Property Value
System.String[]
Remarks
Default: - None. Currently only FARGATE and FARGATE_SPOT are supported.
Stability: Deprecated
ClusterName
The name for the cluster.
virtual string ClusterName { get; }
Property Value
System.String
Remarks
Default: CloudFormation-generated name
ContainerInsights
If true CloudWatch Container Insights will be enabled for the cluster.
virtual Nullable<bool> ContainerInsights { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: - Container Insights will be disabled for this cluser.
DefaultCloudMapNamespace
The service discovery namespace created in this cluster.
virtual 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.
virtual Nullable<bool> EnableFargateCapacityProviders { get; }
Property Value
System.Nullable<System.Boolean>
Remarks
Default: false
ExecuteCommandConfiguration
The execute command configuration for the cluster.
virtual IExecuteCommandConfiguration ExecuteCommandConfiguration { get; }
Property Value
Remarks
Default: - no configuration will be provided.
Vpc
The VPC where your ECS instances will be running or your ENIs will be deployed.
virtual IVpc Vpc { get; }
Property Value
Remarks
Default: - creates a new VPC with two AZs