Class ManagedInstancesCapacityProvider
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.services.ecs.ManagedInstancesCapacityProvider
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.113.0 (build fc68b25)",
date="2025-10-01T17:46:53.000Z")
@Stability(Stable)
public class ManagedInstancesCapacityProvider
extends software.constructs.Construct
A Managed Instances Capacity Provider.
This allows an ECS cluster to use Managed Instances for task placement with managed infrastructure.
Example:
Vpc vpc; Role infrastructureRole; InstanceProfile instanceProfile; Cluster cluster = Cluster.Builder.create(this, "Cluster").vpc(vpc).build(); // Create a Managed Instances Capacity Provider ManagedInstancesCapacityProvider miCapacityProvider = ManagedInstancesCapacityProvider.Builder.create(this, "MICapacityProvider") .infrastructureRole(infrastructureRole) .ec2InstanceProfile(instanceProfile) .subnets(vpc.getPrivateSubnets()) .securityGroups(List.of(SecurityGroup.Builder.create(this, "MISecurityGroup").vpc(vpc).build())) .instanceRequirements(InstanceRequirementsConfig.builder() .vCpuCountMin(1) .memoryMin(Size.gibibytes(2)) .cpuManufacturers(List.of(CpuManufacturer.INTEL)) .acceleratorManufacturers(List.of(AcceleratorManufacturer.NVIDIA)) .build()) .propagateTags(PropagateManagedInstancesTags.CAPACITY_PROVIDER) .build(); // Add the capacity provider to the cluster cluster.addManagedInstancesCapacityProvider(miCapacityProvider); 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(miCapacityProvider.getCapacityProviderName()) .weight(1) .build())) .build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
A fluent builder forManagedInstancesCapacityProvider
.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default, software.constructs.IConstruct.Jsii$Proxy
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
ManagedInstancesCapacityProvider
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
ManagedInstancesCapacityProvider
(software.amazon.jsii.JsiiObjectRef objRef) ManagedInstancesCapacityProvider
(software.constructs.Construct scope, String id, ManagedInstancesCapacityProviderProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Associates the capacity provider with the specified cluster.Capacity provider name.Methods inherited from class software.constructs.Construct
getNode, isConstruct, toString
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
ManagedInstancesCapacityProvider
protected ManagedInstancesCapacityProvider(software.amazon.jsii.JsiiObjectRef objRef) -
ManagedInstancesCapacityProvider
protected ManagedInstancesCapacityProvider(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
ManagedInstancesCapacityProvider
@Stability(Stable) public ManagedInstancesCapacityProvider(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull ManagedInstancesCapacityProviderProps props) - Parameters:
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.
-
-
Method Details
-
bind
Associates the capacity provider with the specified cluster.This method is called by the cluster when adding the capacity provider.
- Parameters:
cluster
- This parameter is required.
-
getCapacityProviderName
Capacity provider name.
-