ClusterProps
- class aws_cdk.aws_ecs.ClusterProps(*, capacity=None, capacity_providers=None, cluster_name=None, container_insights=None, default_cloud_map_namespace=None, enable_fargate_capacity_providers=None, execute_command_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 useaddCapacity
to add capacity later.capacity_providers (
Optional
[Sequence
[str
]]) – (deprecated) The capacity providers to add to the cluster. Default: - None. Currently only FARGATE and FARGATE_SPOT are supported.cluster_name (
Optional
[str
]) – The name for the cluster. Default: CloudFormation-generated namecontainer_insights (
Optional
[bool
]) – If true CloudWatch Container Insights will be enabled for the cluster. Default: - Container Insights will be disabled for this cluser.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 useaddDefaultCloudMapNamespace
to add a default service discovery namespace later.enable_fargate_capacity_providers (
Optional
[bool
]) – Whether to enable Fargate Capacity Providers. Default: falseexecute_command_configuration (
Union
[ExecuteCommandConfiguration
,Dict
[str
,Any
],None
]) – The execute command configuration for the cluster. Default: - no configuration will be provided.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, "FargateCluster", vpc=vpc) task_definition = ecs.TaskDefinition(self, "TD", memory_mi_b="512", cpu="256", compatibility=ecs.Compatibility.FARGATE ) container_definition = task_definition.add_container("TheContainer", image=ecs.ContainerImage.from_registry("foo/bar"), memory_limit_mi_b=256 ) run_task = tasks.EcsRunTask(self, "RunFargate", integration_pattern=sfn.IntegrationPattern.RUN_JOB, cluster=cluster, task_definition=task_definition, assign_public_ip=True, container_overrides=[tasks.ContainerOverride( container_definition=container_definition, environment=[tasks.TaskEnvironmentVariable(name="SOME_KEY", value=sfn.JsonPath.string_at("$.SomeKey"))] )], launch_target=tasks.EcsFargateLaunchTarget() )
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.
- capacity_providers
(deprecated) The capacity providers to add to the cluster.
- Default:
None. Currently only FARGATE and FARGATE_SPOT are supported.
- Deprecated:
Use {@link ClusterProps.enableFargateCapacityProviders} instead.
- Stability:
deprecated
- cluster_name
The name for the cluster.
- Default:
CloudFormation-generated name
- container_insights
If true CloudWatch Container Insights will be enabled for the cluster.
- Default:
Container Insights will be disabled for this cluser.
- 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.
- vpc
The VPC where your ECS instances will be running or your ENIs will be deployed.
- Default:
creates a new VPC with two AZs