Interface ClusterProps
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
ClusterProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.118.0 (build 02eec31)",
date="2025-11-04T09:27:40.877Z")
@Stability(Stable)
public interface ClusterProps
extends software.amazon.jsii.JsiiSerializable
The properties used to define an ECS cluster.
Example:
Vpc vpc;
Cluster cluster = Cluster.Builder.create(this, "Cluster")
.vpc(vpc)
.build();
AutoScalingGroup autoScalingGroup = AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(new InstanceType("t2.micro"))
.machineImage(EcsOptimizedImage.amazonLinux2())
.minCapacity(0)
.maxCapacity(100)
.build();
AsgCapacityProvider capacityProvider = AsgCapacityProvider.Builder.create(this, "AsgCapacityProvider")
.autoScalingGroup(autoScalingGroup)
.instanceWarmupPeriod(300)
.build();
cluster.addAsgCapacityProvider(capacityProvider);
Ec2TaskDefinition taskDefinition = new Ec2TaskDefinition(this, "TaskDef");
taskDefinition.addContainer("web", ContainerDefinitionOptions.builder()
.image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
.memoryReservationMiB(256)
.build());
Ec2Service.Builder.create(this, "EC2Service")
.cluster(cluster)
.taskDefinition(taskDefinition)
.minHealthyPercent(100)
.capacityProviderStrategies(List.of(CapacityProviderStrategy.builder()
.capacityProvider(capacityProvider.getCapacityProviderName())
.weight(1)
.build()))
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forClusterPropsstatic final classAn implementation forClusterProps -
Method Summary
Modifier and TypeMethodDescriptionstatic ClusterProps.Builderbuilder()default AddCapacityOptionsThe ec2 capacity to add to the cluster.default StringThe name for the cluster.default BooleanDeprecated.default ContainerInsightsThe CloudWatch Container Insights configuration for the cluster.default CloudMapNamespaceOptionsThe service discovery namespace created in this cluster.default BooleanWhether to enable Fargate Capacity Providers.default ExecuteCommandConfigurationThe execute command configuration for the cluster.default ManagedStorageConfigurationEncryption configuration for ECS Managed storage.default IVpcgetVpc()The VPC where your ECS instances will be running or your ENIs will be deployed.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getCapacity
The ec2 capacity to add to the cluster.Default: - no EC2 capacity will be added, you can use `addCapacity` to add capacity later.
-
getClusterName
The name for the cluster.Default: CloudFormation-generated name
-
getContainerInsights
Deprecated.Seeinvalid reference
containerInsightsV2(deprecated) If true CloudWatch Container Insights will be enabled for the cluster.Default: - Container Insights will be disabled for this cluster.
-
getContainerInsightsV2
The CloudWatch Container Insights configuration for the cluster.Default:
This may be overridden by ECS account level settings.invalid reference
ContainerInsights.DISABLED -
getDefaultCloudMapNamespace
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.
-
getEnableFargateCapacityProviders
Whether to enable Fargate Capacity Providers.Default: false
-
getExecuteCommandConfiguration
The execute command configuration for the cluster.Default: - no configuration will be provided.
-
getManagedStorageConfiguration
Encryption configuration for ECS Managed storage.Default: - no encryption will be applied.
-
getVpc
The VPC where your ECS instances will be running or your ENIs will be deployed.Default: - creates a new VPC with two AZs
-
builder
- Returns:
- a
ClusterProps.BuilderofClusterProps
-
invalid reference