aws-cdk-lib.aws_ecs.ClusterProps

interface ClusterProps

LanguageType name
.NETAmazon.CDK.AWS.ECS.ClusterProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsecs#ClusterProps
Javasoftware.amazon.awscdk.services.ecs.ClusterProps
Pythonaws_cdk.aws_ecs.ClusterProps
TypeScript (source)aws-cdk-lib » 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(),
  propagatedTagSource: ecs.PropagatedTagSource.TASK_DEFINITION,
});

Properties

NameTypeDescription
capacity?AddCapacityOptionsThe ec2 capacity to add to the cluster.
clusterName?stringThe name for the cluster.
containerInsights?booleanIf true CloudWatch Container Insights will be enabled for the cluster.
defaultCloudMapNamespace?CloudMapNamespaceOptionsThe service discovery namespace created in this cluster.
enableFargateCapacityProviders?booleanWhether to enable Fargate Capacity Providers.
executeCommandConfiguration?ExecuteCommandConfigurationThe execute command configuration for the cluster.
vpc?IVpcThe VPC where your ECS instances will be running or your ENIs will be deployed.

capacity?

Type: AddCapacityOptions (optional, default: no EC2 capacity will be added, you can use addCapacity to add capacity later.)

The ec2 capacity 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 cluster.)

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


defaultCloudMapNamespace?

Type: CloudMapNamespaceOptions (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: ExecuteCommandConfiguration (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.