ClusterProps

class aws_cdk.aws_ecs.ClusterProps(*, capacity=None, cluster_name=None, container_insights=None, container_insights_v2=None, default_cloud_map_namespace=None, enable_fargate_capacity_providers=None, execute_command_configuration=None, managed_storage_configuration=None, vpc=None)

Bases: object

The properties used to define an ECS cluster.

Parameters:
  • capacity (Union[AddCapacityOptions, Dict[str, Any], None]) – The ec2 capacity to add to the cluster. Default: - no EC2 capacity will be added, you can use addCapacity to add capacity later.

  • cluster_name (Optional[str]) – The name for the cluster. Default: CloudFormation-generated name

  • container_insights (Optional[bool]) – (deprecated) If true CloudWatch Container Insights will be enabled for the cluster. Default: - Container Insights will be disabled for this cluster.

  • container_insights_v2 (Optional[ContainerInsights]) – The CloudWatch Container Insights configuration for the cluster. Default: {@link ContainerInsights.DISABLED } This may be overridden by ECS account level settings.

  • default_cloud_map_namespace (Union[CloudMapNamespaceOptions, Dict[str, Any], None]) – The service discovery namespace created in this cluster. Default: - no service discovery namespace created, you can use addDefaultCloudMapNamespace to add a default service discovery namespace later.

  • enable_fargate_capacity_providers (Optional[bool]) – Whether to enable Fargate Capacity Providers. Default: false

  • execute_command_configuration (Union[ExecuteCommandConfiguration, Dict[str, Any], None]) – The execute command configuration for the cluster. Default: - no configuration will be provided.

  • managed_storage_configuration (Union[ManagedStorageConfiguration, Dict[str, Any], None]) – Encryption configuration for ECS Managed storage. Default: - no encryption will be applied.

  • vpc (Optional[IVpc]) – The VPC where your ECS instances will be running or your ENIs will be deployed. Default: - creates a new VPC with two AZs

ExampleMetadata:

infused

Example:

vpc = ec2.Vpc.from_lookup(self, "Vpc",
    is_default=True
)
cluster = ecs.Cluster(self, "ECSCluster", vpc=vpc)

task_definition = ecs.TaskDefinition(self, "TD",
    compatibility=ecs.Compatibility.FARGATE,
    cpu="256",
    memory_mi_b="512"
)

task_definition.add_container("TheContainer",
    image=ecs.ContainerImage.from_registry("foo/bar")
)

run_task = tasks.EcsRunTask(self, "Run",
    integration_pattern=sfn.IntegrationPattern.RUN_JOB,
    cluster=cluster,
    task_definition=task_definition,
    launch_target=tasks.EcsFargateLaunchTarget(),
    cpu="1024",
    memory_mi_b="1048"
)

Attributes

capacity

The ec2 capacity to add to the cluster.

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

cluster_name

The name for the cluster.

Default:

CloudFormation-generated name

container_insights

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

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

Deprecated:

See {@link containerInsightsV2 }

Stability:

deprecated

container_insights_v2

The CloudWatch Container Insights configuration for the cluster.

Default:

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

default_cloud_map_namespace

The service discovery namespace created in this cluster.

Default:

  • no service discovery namespace created, you can use addDefaultCloudMapNamespace to add a

default service discovery namespace later.

enable_fargate_capacity_providers

Whether to enable Fargate Capacity Providers.

Default:

false

execute_command_configuration

The execute command configuration for the cluster.

Default:
  • no configuration will be provided.

managed_storage_configuration

Encryption configuration for ECS Managed storage.

Default:
  • no encryption will be applied.

vpc

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

Default:
  • creates a new VPC with two AZs