Class CfnWarmPool
- All Implemented Interfaces:
IConstruct,IDependable,IInspectable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct
AWS::AutoScaling::WarmPool.
The AWS::AutoScaling::WarmPool resource creates a pool of pre-initialized EC2 instances that sits alongside the Auto Scaling group. Whenever your application needs to scale out, the Auto Scaling group can draw on the warm pool to meet its new desired capacity.
When you create a warm pool, you can define a minimum size. When your Auto Scaling group scales out and the size of the warm pool shrinks, Amazon EC2 Auto Scaling launches new instances into the warm pool to maintain its minimum size.
For more information, see Warm pools for Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide .
CloudFormation supports the
UpdatePolicyattribute for Auto Scaling groups. During an update, ifUpdatePolicyis set toAutoScalingRollingUpdate, CloudFormation replacesInServiceinstances only. Instances in the warm pool are not replaced. The difference in which instances are replaced can potentially result in different instance configurations after the stack update completes. IfUpdatePolicyis set toAutoScalingReplacingUpdate, you do not encounter this issue because CloudFormation replaces both the Auto Scaling group and the warm pool.
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.autoscaling.*;
CfnWarmPool cfnWarmPool = CfnWarmPool.Builder.create(this, "MyCfnWarmPool")
.autoScalingGroupName("autoScalingGroupName")
// the properties below are optional
.instanceReusePolicy(InstanceReusePolicyProperty.builder()
.reuseOnScaleIn(false)
.build())
.maxGroupPreparedCapacity(123)
.minSize(123)
.poolState("poolState")
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA fluent builder forCfnWarmPool.static interfaceA structure that specifies an instance reuse policy for theInstanceReusePolicyproperty of the AWS::AutoScaling::WarmPool resource.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.core.IConstruct
IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionCfnWarmPool(Construct scope, String id, CfnWarmPoolProps props) Create a newAWS::AutoScaling::WarmPool.protectedCfnWarmPool(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnWarmPool(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionThe name of the Auto Scaling group.Indicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in.Specifies the maximum number of instances that are allowed to be in the warm pool or in any state exceptTerminatedfor the Auto Scaling group.Specifies the minimum number of instances to maintain in the warm pool.Sets the instance state to transition to after the lifecycle actions are complete.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties(Map<String, Object> props) voidsetAutoScalingGroupName(String value) The name of the Auto Scaling group.voidIndicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in.voidIndicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in.voidSpecifies the maximum number of instances that are allowed to be in the warm pool or in any state exceptTerminatedfor the Auto Scaling group.voidsetMinSize(Number value) Specifies the minimum number of instances to maintain in the warm pool.voidsetPoolState(String value) Sets the instance state to transition to after the lifecycle actions are complete.Methods inherited from class software.amazon.awscdk.core.CfnResource
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.core.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validateMethods 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.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnWarmPool
protected CfnWarmPool(software.amazon.jsii.JsiiObjectRef objRef) -
CfnWarmPool
protected CfnWarmPool(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnWarmPool
@Stability(Stable) public CfnWarmPool(@NotNull Construct scope, @NotNull String id, @NotNull CfnWarmPoolProps props) Create a newAWS::AutoScaling::WarmPool.- Parameters:
scope-- scope in which this resource is defined.
id-- scoped id of the resource.
props-- resource properties.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector-- tree inspector to collect and process attributes.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getAutoScalingGroupName
The name of the Auto Scaling group. -
setAutoScalingGroupName
The name of the Auto Scaling group. -
getInstanceReusePolicy
Indicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in.The default is to terminate instances in the Auto Scaling group when the group scales in.
-
setInstanceReusePolicy
Indicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in.The default is to terminate instances in the Auto Scaling group when the group scales in.
-
setInstanceReusePolicy
@Stability(Stable) public void setInstanceReusePolicy(@Nullable CfnWarmPool.InstanceReusePolicyProperty value) Indicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in.The default is to terminate instances in the Auto Scaling group when the group scales in.
-
getMaxGroupPreparedCapacity
Specifies the maximum number of instances that are allowed to be in the warm pool or in any state exceptTerminatedfor the Auto Scaling group.This is an optional property. Specify it only if you do not want the warm pool size to be determined by the difference between the group's maximum capacity and its desired capacity.
If a value for
MaxGroupPreparedCapacityis not specified, Amazon EC2 Auto Scaling launches and maintains the difference between the group's maximum capacity and its desired capacity. If you specify a value forMaxGroupPreparedCapacity, Amazon EC2 Auto Scaling uses the difference between theMaxGroupPreparedCapacityand the desired capacity instead.The size of the warm pool is dynamic. Only when
MaxGroupPreparedCapacityandMinSizeare set to the same value does the warm pool have an absolute size.If the desired capacity of the Auto Scaling group is higher than the
MaxGroupPreparedCapacity, the capacity of the warm pool is 0, unless you specify a value forMinSize. To remove a value that you previously set, include the property but specify -1 for the value. -
setMaxGroupPreparedCapacity
Specifies the maximum number of instances that are allowed to be in the warm pool or in any state exceptTerminatedfor the Auto Scaling group.This is an optional property. Specify it only if you do not want the warm pool size to be determined by the difference between the group's maximum capacity and its desired capacity.
If a value for
MaxGroupPreparedCapacityis not specified, Amazon EC2 Auto Scaling launches and maintains the difference between the group's maximum capacity and its desired capacity. If you specify a value forMaxGroupPreparedCapacity, Amazon EC2 Auto Scaling uses the difference between theMaxGroupPreparedCapacityand the desired capacity instead.The size of the warm pool is dynamic. Only when
MaxGroupPreparedCapacityandMinSizeare set to the same value does the warm pool have an absolute size.If the desired capacity of the Auto Scaling group is higher than the
MaxGroupPreparedCapacity, the capacity of the warm pool is 0, unless you specify a value forMinSize. To remove a value that you previously set, include the property but specify -1 for the value. -
getMinSize
Specifies the minimum number of instances to maintain in the warm pool.This helps you to ensure that there is always a certain number of warmed instances available to handle traffic spikes. Defaults to 0 if not specified.
-
setMinSize
Specifies the minimum number of instances to maintain in the warm pool.This helps you to ensure that there is always a certain number of warmed instances available to handle traffic spikes. Defaults to 0 if not specified.
-
getPoolState
Sets the instance state to transition to after the lifecycle actions are complete.Default is
Stopped. -
setPoolState
Sets the instance state to transition to after the lifecycle actions are complete.Default is
Stopped.
-