Class CfnCapacityProvider
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.ecs.CfnCapacityProvider
- All Implemented Interfaces:
IInspectable,ITaggable,ICapacityProviderRef,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
date="2025-10-29T11:15:38.975Z")
@Stability(Stable)
public class CfnCapacityProvider
extends CfnResource
implements IInspectable, ICapacityProviderRef, ITaggable
Creates a capacity provider.
Capacity providers are associated with a cluster and are used in capacity provider strategies to facilitate cluster auto scaling. You can create capacity providers for Amazon ECS Managed Instances and EC2 instances. AWS Fargate has the predefined FARGATE and FARGATE_SPOT capacity providers.
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ecs.*;
CfnCapacityProvider cfnCapacityProvider = CfnCapacityProvider.Builder.create(this, "MyCfnCapacityProvider")
.autoScalingGroupProvider(AutoScalingGroupProviderProperty.builder()
.autoScalingGroupArn("autoScalingGroupArn")
// the properties below are optional
.managedDraining("managedDraining")
.managedScaling(ManagedScalingProperty.builder()
.instanceWarmupPeriod(123)
.maximumScalingStepSize(123)
.minimumScalingStepSize(123)
.status("status")
.targetCapacity(123)
.build())
.managedTerminationProtection("managedTerminationProtection")
.build())
.clusterName("clusterName")
.managedInstancesProvider(ManagedInstancesProviderProperty.builder()
.infrastructureRoleArn("infrastructureRoleArn")
.instanceLaunchTemplate(InstanceLaunchTemplateProperty.builder()
.ec2InstanceProfileArn("ec2InstanceProfileArn")
.networkConfiguration(ManagedInstancesNetworkConfigurationProperty.builder()
.subnets(List.of("subnets"))
// the properties below are optional
.securityGroups(List.of("securityGroups"))
.build())
// the properties below are optional
.instanceRequirements(InstanceRequirementsRequestProperty.builder()
.memoryMiB(MemoryMiBRequestProperty.builder()
.min(123)
// the properties below are optional
.max(123)
.build())
.vCpuCount(VCpuCountRangeRequestProperty.builder()
.min(123)
// the properties below are optional
.max(123)
.build())
// the properties below are optional
.acceleratorCount(AcceleratorCountRequestProperty.builder()
.max(123)
.min(123)
.build())
.acceleratorManufacturers(List.of("acceleratorManufacturers"))
.acceleratorNames(List.of("acceleratorNames"))
.acceleratorTotalMemoryMiB(AcceleratorTotalMemoryMiBRequestProperty.builder()
.max(123)
.min(123)
.build())
.acceleratorTypes(List.of("acceleratorTypes"))
.allowedInstanceTypes(List.of("allowedInstanceTypes"))
.bareMetal("bareMetal")
.baselineEbsBandwidthMbps(BaselineEbsBandwidthMbpsRequestProperty.builder()
.max(123)
.min(123)
.build())
.burstablePerformance("burstablePerformance")
.cpuManufacturers(List.of("cpuManufacturers"))
.excludedInstanceTypes(List.of("excludedInstanceTypes"))
.instanceGenerations(List.of("instanceGenerations"))
.localStorage("localStorage")
.localStorageTypes(List.of("localStorageTypes"))
.maxSpotPriceAsPercentageOfOptimalOnDemandPrice(123)
.memoryGiBPerVCpu(MemoryGiBPerVCpuRequestProperty.builder()
.max(123)
.min(123)
.build())
.networkBandwidthGbps(NetworkBandwidthGbpsRequestProperty.builder()
.max(123)
.min(123)
.build())
.networkInterfaceCount(NetworkInterfaceCountRequestProperty.builder()
.max(123)
.min(123)
.build())
.onDemandMaxPricePercentageOverLowestPrice(123)
.requireHibernateSupport(false)
.spotMaxPricePercentageOverLowestPrice(123)
.totalLocalStorageGb(TotalLocalStorageGBRequestProperty.builder()
.max(123)
.min(123)
.build())
.build())
.monitoring("monitoring")
.storageConfiguration(ManagedInstancesStorageConfigurationProperty.builder()
.storageSizeGiB(123)
.build())
.build())
// the properties below are optional
.propagateTags("propagateTags")
.build())
.name("name")
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceThe minimum and maximum number of accelerators (such as GPUs) for instance type selection.static interfaceThe minimum and maximum total accelerator memory in mebibytes (MiB) for instance type selection.static interfaceThe details of the Auto Scaling group for the capacity provider.static interfaceThe minimum and maximum baseline Amazon EBS bandwidth in megabits per second (Mbps) for instance type selection.static final classA fluent builder forCfnCapacityProvider.static interfaceThe launch template configuration for Amazon ECS Managed Instances.static interfaceThe instance requirements for attribute-based instance type selection.static interfaceThe network configuration for Amazon ECS Managed Instances.static interfaceThe configuration for a Amazon ECS Managed Instances provider.static interfaceThe storage configuration for Amazon ECS Managed Instances.static interfaceThe managed scaling settings for the Auto Scaling group capacity provider.static interfaceThe minimum and maximum amount of memory per vCPU in gibibytes (GiB).static interfaceThe minimum and maximum amount of memory in mebibytes (MiB) for instance type selection.static interfaceThe minimum and maximum network bandwidth in gigabits per second (Gbps) for instance type selection.static interfaceThe minimum and maximum number of network interfaces for instance type selection.static interfaceThe minimum and maximum total local storage in gigabytes (GB) for instance types with local storage.static interfaceThe minimum and maximum number of vCPUs for instance type selection.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.ecs.ICapacityProviderRef
ICapacityProviderRef.Jsii$Default, ICapacityProviderRef.Jsii$ProxyNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnCapacityProvider(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnCapacityProvider(software.amazon.jsii.JsiiObjectRef objRef) CfnCapacityProvider(software.constructs.Construct scope, String id) CfnCapacityProvider(software.constructs.Construct scope, String id, CfnCapacityProviderProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic ICapacityProviderReffromCapacityProviderName(software.constructs.Construct scope, String id, String capacityProviderName) Creates a new ICapacityProviderRef from a capacityProviderName.The Auto Scaling group settings for the capacity provider.A reference to a CapacityProvider resource.The cluster that this capacity provider is associated with.The configuration for the Amazon ECS Managed Instances provider.getName()The name of the capacity provider.getTags()Tag Manager which manages the tags for this resource.The metadata that you apply to the capacity provider to help you categorize and organize it.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidThe Auto Scaling group settings for the capacity provider.voidThe Auto Scaling group settings for the capacity provider.voidsetClusterName(String value) The cluster that this capacity provider is associated with.voidThe configuration for the Amazon ECS Managed Instances provider.voidThe configuration for the Amazon ECS Managed Instances provider.voidThe name of the capacity provider.voidsetTagsRaw(List<CfnTag> value) The metadata that you apply to the capacity provider to help you categorize and organize it.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnCapacityProvider
protected CfnCapacityProvider(software.amazon.jsii.JsiiObjectRef objRef) -
CfnCapacityProvider
protected CfnCapacityProvider(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnCapacityProvider
@Stability(Stable) public CfnCapacityProvider(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnCapacityProviderProps props) - Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties.
-
CfnCapacityProvider
@Stability(Stable) public CfnCapacityProvider(@NotNull software.constructs.Construct scope, @NotNull String id) - Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.
-
-
Method Details
-
fromCapacityProviderName
@Stability(Stable) @NotNull public static ICapacityProviderRef fromCapacityProviderName(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String capacityProviderName) Creates a new ICapacityProviderRef from a capacityProviderName.- Parameters:
scope- This parameter is required.id- This parameter is required.capacityProviderName- This parameter is required.
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getCapacityProviderRef
A reference to a CapacityProvider resource.- Specified by:
getCapacityProviderRefin interfaceICapacityProviderRef
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getTags
Tag Manager which manages the tags for this resource. -
getAutoScalingGroupProvider
The Auto Scaling group settings for the capacity provider.Returns union: either
IResolvableorCfnCapacityProvider.AutoScalingGroupProviderProperty -
setAutoScalingGroupProvider
The Auto Scaling group settings for the capacity provider. -
setAutoScalingGroupProvider
@Stability(Stable) public void setAutoScalingGroupProvider(@Nullable CfnCapacityProvider.AutoScalingGroupProviderProperty value) The Auto Scaling group settings for the capacity provider. -
getClusterName
The cluster that this capacity provider is associated with. -
setClusterName
The cluster that this capacity provider is associated with. -
getManagedInstancesProvider
The configuration for the Amazon ECS Managed Instances provider.Returns union: either
IResolvableorCfnCapacityProvider.ManagedInstancesProviderProperty -
setManagedInstancesProvider
The configuration for the Amazon ECS Managed Instances provider. -
setManagedInstancesProvider
@Stability(Stable) public void setManagedInstancesProvider(@Nullable CfnCapacityProvider.ManagedInstancesProviderProperty value) The configuration for the Amazon ECS Managed Instances provider. -
getName
The name of the capacity provider. -
setName
The name of the capacity provider. -
getTagsRaw
The metadata that you apply to the capacity provider to help you categorize and organize it. -
setTagsRaw
The metadata that you apply to the capacity provider to help you categorize and organize it.
-