interface ClusterProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.ECS.ClusterProps |
![]() | software.amazon.awscdk.services.ecs.ClusterProps |
![]() | aws_cdk.aws_ecs.ClusterProps |
![]() | @aws-cdk/aws-ecs » ClusterProps |
The properties used to define an ECS cluster.
Example
const vpc = ec2.Vpc.fromLookup(this, 'Vpc', {
isDefault: true,
});
const cluster = new ecs.Cluster(this, 'FargateCluster', { vpc });
const taskDefinition = new ecs.TaskDefinition(this, 'TD', {
memoryMiB: '512',
cpu: '256',
compatibility: ecs.Compatibility.FARGATE,
});
const containerDefinition = taskDefinition.addContainer('TheContainer', {
image: ecs.ContainerImage.fromRegistry('foo/bar'),
memoryLimitMiB: 256,
});
const runTask = new tasks.EcsRunTask(this, 'RunFargate', {
integrationPattern: sfn.IntegrationPattern.RUN_JOB,
cluster,
taskDefinition,
assignPublicIp: true,
containerOverrides: [{
containerDefinition,
environment: [{ name: 'SOME_KEY', value: sfn.JsonPath.stringAt('$.SomeKey') }],
}],
launchTarget: new tasks.EcsFargateLaunchTarget(),
});
Properties
Name | Type | Description |
---|---|---|
capacity? | Add | The ec2 capacity to add to the cluster. |
capacity | string[] | The capacity providers to add to the cluster. |
cluster | string | The name for the cluster. |
container | boolean | If true CloudWatch Container Insights will be enabled for the cluster. |
default | Cloud | The service discovery namespace created in this cluster. |
enable | boolean | Whether to enable Fargate Capacity Providers. |
execute | Execute | The execute command configuration for the cluster. |
vpc? | IVpc | The VPC where your ECS instances will be running or your ENIs will be deployed. |
capacity?
Type:
Add
(optional, default: no EC2 capacity will be added, you can use addCapacity
to add capacity later.)
The ec2 capacity to add to the cluster.
capacityProviders?
⚠️ Deprecated: Use {@link ClusterProps.enableFargateCapacityProviders} instead.
Type:
string[]
(optional, default: None. Currently only FARGATE and FARGATE_SPOT are supported.)
The capacity providers to add to the cluster.
clusterName?
Type:
string
(optional, default: CloudFormation-generated name)
The name for the cluster.
containerInsights?
Type:
boolean
(optional, default: Container Insights will be disabled for this cluser.)
If true CloudWatch Container Insights will be enabled for the cluster.
defaultCloudMapNamespace?
Type:
Cloud
(optional, default: no service discovery namespace created, you can use addDefaultCloudMapNamespace
to add a
default service discovery namespace later.)
The service discovery namespace created in this cluster.
enableFargateCapacityProviders?
Type:
boolean
(optional, default: false)
Whether to enable Fargate Capacity Providers.
executeCommandConfiguration?
Type:
Execute
(optional, default: no configuration will be provided.)
The execute command configuration for the cluster.
vpc?
Type:
IVpc
(optional, default: creates a new VPC with two AZs)
The VPC where your ECS instances will be running or your ENIs will be deployed.