Documentation ¶
Index ¶
- func AutoScalingGroup_IsConstruct(x interface{}) *bool
- func AutoScalingGroup_IsOwnedResource(construct constructs.IConstruct) *bool
- func AutoScalingGroup_IsResource(construct constructs.IConstruct) *bool
- func CfnAutoScalingGroup_CFN_RESOURCE_TYPE_NAME() *string
- func CfnAutoScalingGroup_IsCfnElement(x interface{}) *bool
- func CfnAutoScalingGroup_IsCfnResource(construct constructs.IConstruct) *bool
- func CfnAutoScalingGroup_IsConstruct(x interface{}) *bool
- func CfnLaunchConfiguration_CFN_RESOURCE_TYPE_NAME() *string
- func CfnLaunchConfiguration_IsCfnElement(x interface{}) *bool
- func CfnLaunchConfiguration_IsCfnResource(construct constructs.IConstruct) *bool
- func CfnLaunchConfiguration_IsConstruct(x interface{}) *bool
- func CfnLifecycleHook_CFN_RESOURCE_TYPE_NAME() *string
- func CfnLifecycleHook_IsCfnElement(x interface{}) *bool
- func CfnLifecycleHook_IsCfnResource(construct constructs.IConstruct) *bool
- func CfnLifecycleHook_IsConstruct(x interface{}) *bool
- func CfnScalingPolicy_CFN_RESOURCE_TYPE_NAME() *string
- func CfnScalingPolicy_IsCfnElement(x interface{}) *bool
- func CfnScalingPolicy_IsCfnResource(construct constructs.IConstruct) *bool
- func CfnScalingPolicy_IsConstruct(x interface{}) *bool
- func CfnScheduledAction_CFN_RESOURCE_TYPE_NAME() *string
- func CfnScheduledAction_IsCfnElement(x interface{}) *bool
- func CfnScheduledAction_IsCfnResource(construct constructs.IConstruct) *bool
- func CfnScheduledAction_IsConstruct(x interface{}) *bool
- func CfnWarmPool_CFN_RESOURCE_TYPE_NAME() *string
- func CfnWarmPool_IsCfnElement(x interface{}) *bool
- func CfnWarmPool_IsCfnResource(construct constructs.IConstruct) *bool
- func CfnWarmPool_IsConstruct(x interface{}) *bool
- func LifecycleHook_IsConstruct(x interface{}) *bool
- func LifecycleHook_IsOwnedResource(construct constructs.IConstruct) *bool
- func LifecycleHook_IsResource(construct constructs.IConstruct) *bool
- func NewAutoScalingGroupRequireImdsv2Aspect_Override(a AutoScalingGroupRequireImdsv2Aspect)
- func NewAutoScalingGroup_Override(a AutoScalingGroup, scope constructs.Construct, id *string, ...)
- func NewBlockDeviceVolume_Override(b BlockDeviceVolume, ebsDevice *EbsDeviceProps, virtualName *string)
- func NewCfnAutoScalingGroup_Override(c CfnAutoScalingGroup, scope constructs.Construct, id *string, ...)
- func NewCfnLaunchConfiguration_Override(c CfnLaunchConfiguration, scope constructs.Construct, id *string, ...)
- func NewCfnLifecycleHook_Override(c CfnLifecycleHook, scope constructs.Construct, id *string, ...)
- func NewCfnScalingPolicy_Override(c CfnScalingPolicy, scope constructs.Construct, id *string, ...)
- func NewCfnScheduledAction_Override(c CfnScheduledAction, scope constructs.Construct, id *string, ...)
- func NewCfnWarmPool_Override(c CfnWarmPool, scope constructs.Construct, id *string, props *CfnWarmPoolProps)
- func NewGroupMetric_Override(g GroupMetric, name *string)
- func NewGroupMetrics_Override(g GroupMetrics, metrics ...GroupMetric)
- func NewLifecycleHook_Override(l LifecycleHook, scope constructs.Construct, id *string, ...)
- func NewScalingEvents_Override(s ScalingEvents, types ...ScalingEvent)
- func NewSchedule_Override(s Schedule)
- func NewScheduledAction_Override(s ScheduledAction, scope constructs.Construct, id *string, ...)
- func NewSignals_Override(s Signals)
- func NewStepScalingAction_Override(s StepScalingAction, scope constructs.Construct, id *string, ...)
- func NewStepScalingPolicy_Override(s StepScalingPolicy, scope constructs.Construct, id *string, ...)
- func NewTargetTrackingScalingPolicy_Override(t TargetTrackingScalingPolicy, scope constructs.Construct, id *string, ...)
- func NewUpdatePolicy_Override(u UpdatePolicy)
- func NewWarmPool_Override(w WarmPool, scope constructs.Construct, id *string, props *WarmPoolProps)
- func ScheduledAction_IsConstruct(x interface{}) *bool
- func ScheduledAction_IsOwnedResource(construct constructs.IConstruct) *bool
- func ScheduledAction_IsResource(construct constructs.IConstruct) *bool
- func StepScalingAction_IsConstruct(x interface{}) *bool
- func StepScalingPolicy_IsConstruct(x interface{}) *bool
- func TargetTrackingScalingPolicy_IsConstruct(x interface{}) *bool
- func WarmPool_IsConstruct(x interface{}) *bool
- func WarmPool_IsOwnedResource(construct constructs.IConstruct) *bool
- func WarmPool_IsResource(construct constructs.IConstruct) *bool
- type AdjustmentTier
- type AdjustmentType
- type ApplyCloudFormationInitOptions
- type AutoScalingGroup
- type AutoScalingGroupProps
- type AutoScalingGroupRequireImdsv2Aspect
- type BaseTargetTrackingProps
- type BasicLifecycleHookProps
- type BasicScheduledActionProps
- type BasicStepScalingPolicyProps
- type BasicTargetTrackingScalingPolicyProps
- type BindHookTargetOptions
- type BlockDevice
- type BlockDeviceVolume
- func BlockDeviceVolume_Ebs(volumeSize *float64, options *EbsDeviceOptions) BlockDeviceVolume
- func BlockDeviceVolume_EbsFromSnapshot(snapshotId *string, options *EbsDeviceSnapshotOptions) BlockDeviceVolume
- func BlockDeviceVolume_Ephemeral(volumeIndex *float64) BlockDeviceVolume
- func BlockDeviceVolume_NoDevice() BlockDeviceVolume
- func NewBlockDeviceVolume(ebsDevice *EbsDeviceProps, virtualName *string) BlockDeviceVolume
- type CfnAutoScalingGroup
- type CfnAutoScalingGroupProps
- type CfnAutoScalingGroup_AcceleratorCountRequestProperty
- type CfnAutoScalingGroup_AcceleratorTotalMemoryMiBRequestProperty
- type CfnAutoScalingGroup_BaselineEbsBandwidthMbpsRequestProperty
- type CfnAutoScalingGroup_InstanceRequirementsProperty
- type CfnAutoScalingGroup_InstancesDistributionProperty
- type CfnAutoScalingGroup_LaunchTemplateOverridesProperty
- type CfnAutoScalingGroup_LaunchTemplateProperty
- type CfnAutoScalingGroup_LaunchTemplateSpecificationProperty
- type CfnAutoScalingGroup_LifecycleHookSpecificationProperty
- type CfnAutoScalingGroup_MemoryGiBPerVCpuRequestProperty
- type CfnAutoScalingGroup_MemoryMiBRequestProperty
- type CfnAutoScalingGroup_MetricsCollectionProperty
- type CfnAutoScalingGroup_MixedInstancesPolicyProperty
- type CfnAutoScalingGroup_NetworkBandwidthGbpsRequestProperty
- type CfnAutoScalingGroup_NetworkInterfaceCountRequestProperty
- type CfnAutoScalingGroup_NotificationConfigurationProperty
- type CfnAutoScalingGroup_TagPropertyProperty
- type CfnAutoScalingGroup_TotalLocalStorageGBRequestProperty
- type CfnAutoScalingGroup_VCpuCountRequestProperty
- type CfnLaunchConfiguration
- type CfnLaunchConfigurationProps
- type CfnLaunchConfiguration_BlockDeviceMappingProperty
- type CfnLaunchConfiguration_BlockDeviceProperty
- type CfnLaunchConfiguration_MetadataOptionsProperty
- type CfnLifecycleHook
- type CfnLifecycleHookProps
- type CfnScalingPolicy
- type CfnScalingPolicyProps
- type CfnScalingPolicy_CustomizedMetricSpecificationProperty
- type CfnScalingPolicy_MetricDataQueryProperty
- type CfnScalingPolicy_MetricDimensionProperty
- type CfnScalingPolicy_MetricProperty
- type CfnScalingPolicy_MetricStatProperty
- type CfnScalingPolicy_PredefinedMetricSpecificationProperty
- type CfnScalingPolicy_PredictiveScalingConfigurationProperty
- type CfnScalingPolicy_PredictiveScalingCustomizedCapacityMetricProperty
- type CfnScalingPolicy_PredictiveScalingCustomizedLoadMetricProperty
- type CfnScalingPolicy_PredictiveScalingCustomizedScalingMetricProperty
- type CfnScalingPolicy_PredictiveScalingMetricSpecificationProperty
- type CfnScalingPolicy_PredictiveScalingPredefinedLoadMetricProperty
- type CfnScalingPolicy_PredictiveScalingPredefinedMetricPairProperty
- type CfnScalingPolicy_PredictiveScalingPredefinedScalingMetricProperty
- type CfnScalingPolicy_StepAdjustmentProperty
- type CfnScalingPolicy_TargetTrackingConfigurationProperty
- type CfnScheduledAction
- type CfnScheduledActionProps
- type CfnWarmPool
- type CfnWarmPoolProps
- type CfnWarmPool_InstanceReusePolicyProperty
- type CommonAutoScalingGroupProps
- type CpuUtilizationScalingProps
- type CronOptions
- type DefaultResult
- type EbsDeviceOptions
- type EbsDeviceOptionsBase
- type EbsDeviceProps
- type EbsDeviceSnapshotOptions
- type EbsDeviceVolumeType
- type Ec2HealthCheckOptions
- type ElbHealthCheckOptions
- type GroupMetric
- func GroupMetric_DESIRED_CAPACITY() GroupMetric
- func GroupMetric_IN_SERVICE_INSTANCES() GroupMetric
- func GroupMetric_MAX_SIZE() GroupMetric
- func GroupMetric_MIN_SIZE() GroupMetric
- func GroupMetric_PENDING_INSTANCES() GroupMetric
- func GroupMetric_STANDBY_INSTANCES() GroupMetric
- func GroupMetric_TERMINATING_INSTANCES() GroupMetric
- func GroupMetric_TOTAL_INSTANCES() GroupMetric
- func NewGroupMetric(name *string) GroupMetric
- type GroupMetrics
- type HealthCheck
- type IAutoScalingGroup
- type ILifecycleHook
- type ILifecycleHookTarget
- type InstancesDistribution
- type LaunchTemplateOverrides
- type LifecycleHook
- type LifecycleHookProps
- type LifecycleHookTargetConfig
- type LifecycleTransition
- type MetricAggregationType
- type MetricTargetTrackingProps
- type MixedInstancesPolicy
- type Monitoring
- type NetworkUtilizationScalingProps
- type NotificationConfiguration
- type OnDemandAllocationStrategy
- type PoolState
- type PredefinedMetric
- type RenderSignalsOptions
- type RequestCountScalingProps
- type RollingUpdateOptions
- type ScalingEvent
- type ScalingEvents
- type ScalingInterval
- type ScalingProcess
- type Schedule
- type ScheduledAction
- type ScheduledActionProps
- type Signals
- type SignalsOptions
- type SpotAllocationStrategy
- type StepScalingAction
- type StepScalingActionProps
- type StepScalingPolicy
- type StepScalingPolicyProps
- type TargetTrackingScalingPolicy
- type TargetTrackingScalingPolicyProps
- type TerminationPolicy
- type UpdatePolicy
- type WarmPool
- type WarmPoolOptions
- type WarmPoolProps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoScalingGroup_IsConstruct ¶
func AutoScalingGroup_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func AutoScalingGroup_IsOwnedResource ¶ added in v2.32.0
func AutoScalingGroup_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise.
func AutoScalingGroup_IsResource ¶
func AutoScalingGroup_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource.
func CfnAutoScalingGroup_CFN_RESOURCE_TYPE_NAME ¶
func CfnAutoScalingGroup_CFN_RESOURCE_TYPE_NAME() *string
func CfnAutoScalingGroup_IsCfnElement ¶
func CfnAutoScalingGroup_IsCfnElement(x interface{}) *bool
Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).
Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.
Returns: The construct as a stack element or undefined if it is not a stack element.
func CfnAutoScalingGroup_IsCfnResource ¶
func CfnAutoScalingGroup_IsCfnResource(construct constructs.IConstruct) *bool
Check whether the given construct is a CfnResource.
func CfnAutoScalingGroup_IsConstruct ¶
func CfnAutoScalingGroup_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func CfnLaunchConfiguration_CFN_RESOURCE_TYPE_NAME ¶
func CfnLaunchConfiguration_CFN_RESOURCE_TYPE_NAME() *string
func CfnLaunchConfiguration_IsCfnElement ¶
func CfnLaunchConfiguration_IsCfnElement(x interface{}) *bool
Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).
Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.
Returns: The construct as a stack element or undefined if it is not a stack element.
func CfnLaunchConfiguration_IsCfnResource ¶
func CfnLaunchConfiguration_IsCfnResource(construct constructs.IConstruct) *bool
Check whether the given construct is a CfnResource.
func CfnLaunchConfiguration_IsConstruct ¶
func CfnLaunchConfiguration_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func CfnLifecycleHook_CFN_RESOURCE_TYPE_NAME ¶
func CfnLifecycleHook_CFN_RESOURCE_TYPE_NAME() *string
func CfnLifecycleHook_IsCfnElement ¶
func CfnLifecycleHook_IsCfnElement(x interface{}) *bool
Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).
Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.
Returns: The construct as a stack element or undefined if it is not a stack element.
func CfnLifecycleHook_IsCfnResource ¶
func CfnLifecycleHook_IsCfnResource(construct constructs.IConstruct) *bool
Check whether the given construct is a CfnResource.
func CfnLifecycleHook_IsConstruct ¶
func CfnLifecycleHook_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func CfnScalingPolicy_CFN_RESOURCE_TYPE_NAME ¶
func CfnScalingPolicy_CFN_RESOURCE_TYPE_NAME() *string
func CfnScalingPolicy_IsCfnElement ¶
func CfnScalingPolicy_IsCfnElement(x interface{}) *bool
Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).
Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.
Returns: The construct as a stack element or undefined if it is not a stack element.
func CfnScalingPolicy_IsCfnResource ¶
func CfnScalingPolicy_IsCfnResource(construct constructs.IConstruct) *bool
Check whether the given construct is a CfnResource.
func CfnScalingPolicy_IsConstruct ¶
func CfnScalingPolicy_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func CfnScheduledAction_CFN_RESOURCE_TYPE_NAME ¶
func CfnScheduledAction_CFN_RESOURCE_TYPE_NAME() *string
func CfnScheduledAction_IsCfnElement ¶
func CfnScheduledAction_IsCfnElement(x interface{}) *bool
Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).
Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.
Returns: The construct as a stack element or undefined if it is not a stack element.
func CfnScheduledAction_IsCfnResource ¶
func CfnScheduledAction_IsCfnResource(construct constructs.IConstruct) *bool
Check whether the given construct is a CfnResource.
func CfnScheduledAction_IsConstruct ¶
func CfnScheduledAction_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func CfnWarmPool_CFN_RESOURCE_TYPE_NAME ¶
func CfnWarmPool_CFN_RESOURCE_TYPE_NAME() *string
func CfnWarmPool_IsCfnElement ¶
func CfnWarmPool_IsCfnElement(x interface{}) *bool
Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).
Uses duck-typing instead of `instanceof` to allow stack elements from different versions of this library to be included in the same stack.
Returns: The construct as a stack element or undefined if it is not a stack element.
func CfnWarmPool_IsCfnResource ¶
func CfnWarmPool_IsCfnResource(construct constructs.IConstruct) *bool
Check whether the given construct is a CfnResource.
func CfnWarmPool_IsConstruct ¶
func CfnWarmPool_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func LifecycleHook_IsConstruct ¶
func LifecycleHook_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func LifecycleHook_IsOwnedResource ¶ added in v2.32.0
func LifecycleHook_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise.
func LifecycleHook_IsResource ¶
func LifecycleHook_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource.
func NewAutoScalingGroupRequireImdsv2Aspect_Override ¶
func NewAutoScalingGroupRequireImdsv2Aspect_Override(a AutoScalingGroupRequireImdsv2Aspect)
func NewAutoScalingGroup_Override ¶
func NewAutoScalingGroup_Override(a AutoScalingGroup, scope constructs.Construct, id *string, props *AutoScalingGroupProps)
func NewBlockDeviceVolume_Override ¶
func NewBlockDeviceVolume_Override(b BlockDeviceVolume, ebsDevice *EbsDeviceProps, virtualName *string)
func NewCfnAutoScalingGroup_Override ¶
func NewCfnAutoScalingGroup_Override(c CfnAutoScalingGroup, scope constructs.Construct, id *string, props *CfnAutoScalingGroupProps)
Create a new `AWS::AutoScaling::AutoScalingGroup`.
func NewCfnLaunchConfiguration_Override ¶
func NewCfnLaunchConfiguration_Override(c CfnLaunchConfiguration, scope constructs.Construct, id *string, props *CfnLaunchConfigurationProps)
Create a new `AWS::AutoScaling::LaunchConfiguration`.
func NewCfnLifecycleHook_Override ¶
func NewCfnLifecycleHook_Override(c CfnLifecycleHook, scope constructs.Construct, id *string, props *CfnLifecycleHookProps)
Create a new `AWS::AutoScaling::LifecycleHook`.
func NewCfnScalingPolicy_Override ¶
func NewCfnScalingPolicy_Override(c CfnScalingPolicy, scope constructs.Construct, id *string, props *CfnScalingPolicyProps)
Create a new `AWS::AutoScaling::ScalingPolicy`.
func NewCfnScheduledAction_Override ¶
func NewCfnScheduledAction_Override(c CfnScheduledAction, scope constructs.Construct, id *string, props *CfnScheduledActionProps)
Create a new `AWS::AutoScaling::ScheduledAction`.
func NewCfnWarmPool_Override ¶
func NewCfnWarmPool_Override(c CfnWarmPool, scope constructs.Construct, id *string, props *CfnWarmPoolProps)
Create a new `AWS::AutoScaling::WarmPool`.
func NewGroupMetric_Override ¶
func NewGroupMetric_Override(g GroupMetric, name *string)
func NewGroupMetrics_Override ¶
func NewGroupMetrics_Override(g GroupMetrics, metrics ...GroupMetric)
func NewLifecycleHook_Override ¶
func NewLifecycleHook_Override(l LifecycleHook, scope constructs.Construct, id *string, props *LifecycleHookProps)
func NewScalingEvents_Override ¶
func NewScalingEvents_Override(s ScalingEvents, types ...ScalingEvent)
func NewSchedule_Override ¶
func NewSchedule_Override(s Schedule)
func NewScheduledAction_Override ¶
func NewScheduledAction_Override(s ScheduledAction, scope constructs.Construct, id *string, props *ScheduledActionProps)
func NewSignals_Override ¶
func NewSignals_Override(s Signals)
func NewStepScalingAction_Override ¶
func NewStepScalingAction_Override(s StepScalingAction, scope constructs.Construct, id *string, props *StepScalingActionProps)
func NewStepScalingPolicy_Override ¶
func NewStepScalingPolicy_Override(s StepScalingPolicy, scope constructs.Construct, id *string, props *StepScalingPolicyProps)
func NewTargetTrackingScalingPolicy_Override ¶
func NewTargetTrackingScalingPolicy_Override(t TargetTrackingScalingPolicy, scope constructs.Construct, id *string, props *TargetTrackingScalingPolicyProps)
func NewUpdatePolicy_Override ¶
func NewUpdatePolicy_Override(u UpdatePolicy)
func NewWarmPool_Override ¶ added in v2.18.0
func NewWarmPool_Override(w WarmPool, scope constructs.Construct, id *string, props *WarmPoolProps)
func ScheduledAction_IsConstruct ¶
func ScheduledAction_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func ScheduledAction_IsOwnedResource ¶ added in v2.32.0
func ScheduledAction_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise.
func ScheduledAction_IsResource ¶
func ScheduledAction_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource.
func StepScalingAction_IsConstruct ¶
func StepScalingAction_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func StepScalingPolicy_IsConstruct ¶
func StepScalingPolicy_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func TargetTrackingScalingPolicy_IsConstruct ¶
func TargetTrackingScalingPolicy_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func WarmPool_IsConstruct ¶ added in v2.18.0
func WarmPool_IsConstruct(x interface{}) *bool
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct` instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on disk are seen as independent, completely different libraries. As a consequence, the class `Construct` in each copy of the `constructs` library is seen as a different class, and an instance of one class will not test as `instanceof` the other class. `npm install` will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the `constructs` library can be accidentally installed, and `instanceof` will behave unpredictably. It is safest to avoid using `instanceof`, and using this type-testing method instead.
Returns: true if `x` is an object created from a class which extends `Construct`.
func WarmPool_IsOwnedResource ¶ added in v2.32.0
func WarmPool_IsOwnedResource(construct constructs.IConstruct) *bool
Returns true if the construct was created by CDK, and false otherwise.
func WarmPool_IsResource ¶ added in v2.18.0
func WarmPool_IsResource(construct constructs.IConstruct) *bool
Check whether the given construct is a Resource.
Types ¶
type AdjustmentTier ¶
type AdjustmentTier struct { // What number to adjust the capacity with. // // The number is interpeted as an added capacity, a new fixed capacity or an // added percentage depending on the AdjustmentType value of the // StepScalingPolicy. // // Can be positive or negative. Adjustment *float64 `field:"required" json:"adjustment" yaml:"adjustment"` // Lower bound where this scaling tier applies. // // The scaling tier applies if the difference between the metric // value and its alarm threshold is higher than this value. LowerBound *float64 `field:"optional" json:"lowerBound" yaml:"lowerBound"` // Upper bound where this scaling tier applies. // // The scaling tier applies if the difference between the metric // value and its alarm threshold is lower than this value. UpperBound *float64 `field:"optional" json:"upperBound" yaml:"upperBound"` }
An adjustment.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" adjustmentTier := &AdjustmentTier{ Adjustment: jsii.Number(123), // the properties below are optional LowerBound: jsii.Number(123), UpperBound: jsii.Number(123), }
type AdjustmentType ¶
type AdjustmentType string
How adjustment numbers are interpreted.
Example:
var autoScalingGroup autoScalingGroup workerUtilizationMetric := cloudwatch.NewMetric(&MetricProps{ Namespace: jsii.String("MyService"), MetricName: jsii.String("WorkerUtilization"), }) autoScalingGroup.scaleOnMetric(jsii.String("ScaleToCPU"), &BasicStepScalingPolicyProps{ Metric: workerUtilizationMetric, ScalingSteps: []scalingInterval{ &scalingInterval{ Upper: jsii.Number(10), Change: -jsii.Number(1), }, &scalingInterval{ Lower: jsii.Number(50), Change: +jsii.Number(1), }, &scalingInterval{ Lower: jsii.Number(70), Change: +jsii.Number(3), }, }, // Change this to AdjustmentType.PERCENT_CHANGE_IN_CAPACITY to interpret the // 'change' numbers before as percentages instead of capacity counts. AdjustmentType: autoscaling.AdjustmentType_CHANGE_IN_CAPACITY, })
const ( // Add the adjustment number to the current capacity. // // A positive number increases capacity, a negative number decreases capacity. AdjustmentType_CHANGE_IN_CAPACITY AdjustmentType = "CHANGE_IN_CAPACITY" // Add this percentage of the current capacity to itself. // // The number must be between -100 and 100; a positive number increases // capacity and a negative number decreases it. AdjustmentType_PERCENT_CHANGE_IN_CAPACITY AdjustmentType = "PERCENT_CHANGE_IN_CAPACITY" // Make the capacity equal to the exact number given. AdjustmentType_EXACT_CAPACITY AdjustmentType = "EXACT_CAPACITY" )
type ApplyCloudFormationInitOptions ¶
type ApplyCloudFormationInitOptions struct { // ConfigSet to activate. ConfigSets *[]*string `field:"optional" json:"configSets" yaml:"configSets"` // Force instance replacement by embedding a config fingerprint. // // If `true` (the default), a hash of the config will be embedded into the // UserData, so that if the config changes, the UserData changes and // instances will be replaced (given an UpdatePolicy has been configured on // the AutoScalingGroup). // // If `false`, no such hash will be embedded, and if the CloudFormation Init // config changes nothing will happen to the running instances. If a // config update introduces errors, you will not notice until after the // CloudFormation deployment successfully finishes and the next instance // fails to launch. EmbedFingerprint *bool `field:"optional" json:"embedFingerprint" yaml:"embedFingerprint"` // Don't fail the instance creation when cfn-init fails. // // You can use this to prevent CloudFormation from rolling back when // instances fail to start up, to help in debugging. IgnoreFailures *bool `field:"optional" json:"ignoreFailures" yaml:"ignoreFailures"` // Include --role argument when running cfn-init and cfn-signal commands. // // This will be the IAM instance profile attached to the EC2 instance. IncludeRole *bool `field:"optional" json:"includeRole" yaml:"includeRole"` // Include --url argument when running cfn-init and cfn-signal commands. // // This will be the cloudformation endpoint in the deployed region // e.g. https://cloudformation.us-east-1.amazonaws.com IncludeUrl *bool `field:"optional" json:"includeUrl" yaml:"includeUrl"` // Print the results of running cfn-init to the Instance System Log. // // By default, the output of running cfn-init is written to a log file // on the instance. Set this to `true` to print it to the System Log // (visible from the EC2 Console), `false` to not print it. // // (Be aware that the system log is refreshed at certain points in // time of the instance life cycle, and successful execution may // not always show up). PrintLog *bool `field:"optional" json:"printLog" yaml:"printLog"` }
Options for applying CloudFormation init to an instance or instance group.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" applyCloudFormationInitOptions := &ApplyCloudFormationInitOptions{ ConfigSets: []*string{ jsii.String("configSets"), }, EmbedFingerprint: jsii.Boolean(false), IgnoreFailures: jsii.Boolean(false), IncludeRole: jsii.Boolean(false), IncludeUrl: jsii.Boolean(false), PrintLog: jsii.Boolean(false), }
type AutoScalingGroup ¶
type AutoScalingGroup interface { awscdk.Resource IAutoScalingGroup awsec2.IConnectable awselasticloadbalancing.ILoadBalancerTarget awselasticloadbalancingv2.IApplicationLoadBalancerTarget awselasticloadbalancingv2.INetworkLoadBalancerTarget AlbTargetGroup() awselasticloadbalancingv2.ApplicationTargetGroup SetAlbTargetGroup(val awselasticloadbalancingv2.ApplicationTargetGroup) // Arn of the AutoScalingGroup. AutoScalingGroupArn() *string // Name of the AutoScalingGroup. AutoScalingGroupName() *string // The network connections associated with this resource. Connections() awsec2.Connections // The environment this resource belongs to. // // For resources that are created and managed by the CDK // (generally, those created by creating new class instances like Role, Bucket, etc.), // this is always the same as the environment of the stack they belong to; // however, for imported resources // (those obtained from static methods like fromRoleArn, fromBucketName, etc.), // that might be different than the stack they were imported into. Env() *awscdk.ResourceEnvironment // The principal to grant permissions to. GrantPrincipal() awsiam.IPrincipal HasCalledScaleOnRequestCount() *bool SetHasCalledScaleOnRequestCount(val *bool) // The maximum amount of time that an instance can be in service. MaxInstanceLifetime() awscdk.Duration NewInstancesProtectedFromScaleIn() *bool SetNewInstancesProtectedFromScaleIn(val *bool) // The tree node. Node() constructs.Node // The type of OS instances of this fleet are running. OsType() awsec2.OperatingSystemType // Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource. // // This value will resolve to one of the following: // - a concrete value (e.g. `"my-awesome-bucket"`) // - `undefined`, when a name should be generated by CloudFormation // - a concrete name generated automatically during synthesis, in // cross-environment scenarios. PhysicalName() *string // The IAM Role in the instance profile. Role() awsiam.IRole // The maximum spot price configured for the autoscaling group. // // `undefined` // indicates that this group uses on-demand capacity. SpotPrice() *string // The stack in which this resource is defined. Stack() awscdk.Stack // The Base64-encoded user data to make available to the launched EC2 instances. UserData() awsec2.UserData // Send a message to either an SQS queue or SNS topic when instances launch or terminate. AddLifecycleHook(id *string, props *BasicLifecycleHookProps) LifecycleHook // Add the security group to all instances via the launch configuration security groups array. AddSecurityGroup(securityGroup awsec2.ISecurityGroup) // Adds a statement to the IAM role assumed by instances of this fleet. AddToRolePolicy(statement awsiam.PolicyStatement) // Add command to the startup script of fleet instances. // // The command must be in the scripting language supported by the fleet's OS (i.e. Linux/Windows). // Does nothing for imported ASGs. AddUserData(commands ...*string) // Add a pool of pre-initialized EC2 instances that sits alongside an Auto Scaling group. AddWarmPool(options *WarmPoolOptions) WarmPool // Use a CloudFormation Init configuration at instance startup. // // This does the following: // // - Attaches the CloudFormation Init metadata to the AutoScalingGroup resource. // - Add commands to the UserData to run `cfn-init` and `cfn-signal`. // - Update the instance's CreationPolicy to wait for `cfn-init` to finish // before reporting success. ApplyCloudFormationInit(init awsec2.CloudFormationInit, options *ApplyCloudFormationInitOptions) // Apply the given removal policy to this resource. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). ApplyRemovalPolicy(policy awscdk.RemovalPolicy) // Returns `true` if newly-launched instances are protected from scale-in. AreNewInstancesProtectedFromScaleIn() *bool // Attach to ELBv2 Application Target Group. AttachToApplicationTargetGroup(targetGroup awselasticloadbalancingv2.IApplicationTargetGroup) *awselasticloadbalancingv2.LoadBalancerTargetProps // Attach to a classic load balancer. AttachToClassicLB(loadBalancer awselasticloadbalancing.LoadBalancer) // Attach to ELBv2 Application Target Group. AttachToNetworkTargetGroup(targetGroup awselasticloadbalancingv2.INetworkTargetGroup) *awselasticloadbalancingv2.LoadBalancerTargetProps GeneratePhysicalName() *string // Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`). // // Normally, this token will resolve to `arnAttr`, but if the resource is // referenced across environments, `arnComponents` will be used to synthesize // a concrete ARN with the resource's physical name. Make sure to reference // `this.physicalName` in `arnComponents`. GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string // Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`). // // Normally, this token will resolve to `nameAttr`, but if the resource is // referenced across environments, it will be resolved to `this.physicalName`, // which will be a concrete name. GetResourceNameAttribute(nameAttr *string) *string // Ensures newly-launched instances are protected from scale-in. ProtectNewInstancesFromScaleIn() // Scale out or in to achieve a target CPU utilization. ScaleOnCpuUtilization(id *string, props *CpuUtilizationScalingProps) TargetTrackingScalingPolicy // Scale out or in to achieve a target network ingress rate. ScaleOnIncomingBytes(id *string, props *NetworkUtilizationScalingProps) TargetTrackingScalingPolicy // Scale out or in, in response to a metric. ScaleOnMetric(id *string, props *BasicStepScalingPolicyProps) StepScalingPolicy // Scale out or in to achieve a target network egress rate. ScaleOnOutgoingBytes(id *string, props *NetworkUtilizationScalingProps) TargetTrackingScalingPolicy // Scale out or in to achieve a target request handling rate. // // The AutoScalingGroup must have been attached to an Application Load Balancer // in order to be able to call this. ScaleOnRequestCount(id *string, props *RequestCountScalingProps) TargetTrackingScalingPolicy // Scale out or in based on time. ScaleOnSchedule(id *string, props *BasicScheduledActionProps) ScheduledAction // Scale out or in in order to keep a metric around a target value. ScaleToTrackMetric(id *string, props *MetricTargetTrackingProps) TargetTrackingScalingPolicy // Returns a string representation of this construct. ToString() *string }
A Fleet represents a managed set of EC2 instances.
The Fleet models a number of AutoScalingGroups, a launch configuration, a security group and an instance role.
It allows adding arbitrary commands to the startup scripts of the instances in the fleet.
The ASG spans the availability zones specified by vpcSubnets, falling back to the Vpc default strategy if not specified.
Example:
var vpc vpc var instanceType instanceType var machineImage iMachineImage autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, InstanceType: InstanceType, MachineImage: MachineImage, // ... Init: ec2.CloudFormationInit_FromElements(ec2.InitFile_FromString(jsii.String("/etc/my_instance"), jsii.String("This got written during instance startup"))), Signals: autoscaling.Signals_WaitForAll(&SignalsOptions{ Timeout: awscdk.Duration_Minutes(jsii.Number(10)), }), })
func NewAutoScalingGroup ¶
func NewAutoScalingGroup(scope constructs.Construct, id *string, props *AutoScalingGroupProps) AutoScalingGroup
type AutoScalingGroupProps ¶
type AutoScalingGroupProps struct { // Whether the instances can initiate connections to anywhere by default. AllowAllOutbound *bool `field:"optional" json:"allowAllOutbound" yaml:"allowAllOutbound"` // Whether instances in the Auto Scaling Group should have public IP addresses associated with them. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. AssociatePublicIpAddress *bool `field:"optional" json:"associatePublicIpAddress" yaml:"associatePublicIpAddress"` // The name of the Auto Scaling group. // // This name must be unique per Region per account. AutoScalingGroupName *string `field:"optional" json:"autoScalingGroupName" yaml:"autoScalingGroupName"` // Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. // // Each instance that is launched has an associated root device volume, // either an Amazon EBS volume or an instance store volume. // You can use block device mappings to specify additional EBS volumes or // instance store volumes to attach to an instance when it is launched. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html // BlockDevices *[]*BlockDevice `field:"optional" json:"blockDevices" yaml:"blockDevices"` // Indicates whether Capacity Rebalancing is enabled. // // When you turn on Capacity Rebalancing, Amazon EC2 Auto Scaling // attempts to launch a Spot Instance whenever Amazon EC2 notifies that a Spot Instance is at an elevated risk of // interruption. After launching a new instance, it then terminates an old instance. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-capacityrebalance // CapacityRebalance *bool `field:"optional" json:"capacityRebalance" yaml:"capacityRebalance"` // Default scaling cooldown for this AutoScalingGroup. Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // The amount of time, in seconds, until a newly launched instance can contribute to the Amazon CloudWatch metrics. // // This delay lets an instance finish initializing before Amazon EC2 Auto Scaling aggregates instance metrics, // resulting in more reliable usage data. Set this value equal to the amount of time that it takes for resource // consumption to become stable after an instance reaches the InService state. // // To optimize the performance of scaling policies that scale continuously, such as target tracking and // step scaling policies, we strongly recommend that you enable the default instance warmup, even if its value is set to 0 seconds // // Default instance warmup will not be added if no value is specified. // See: https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-default-instance-warmup.html // DefaultInstanceWarmup awscdk.Duration `field:"optional" json:"defaultInstanceWarmup" yaml:"defaultInstanceWarmup"` // Initial amount of instances in the fleet. // // If this is set to a number, every deployment will reset the amount of // instances to this number. It is recommended to leave this value blank. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-desiredcapacity // DesiredCapacity *float64 `field:"optional" json:"desiredCapacity" yaml:"desiredCapacity"` // Enable monitoring for group metrics, these metrics describe the group rather than any of its instances. // // To report all group metrics use `GroupMetrics.all()` // Group metrics are reported in a granularity of 1 minute at no additional charge. GroupMetrics *[]GroupMetrics `field:"optional" json:"groupMetrics" yaml:"groupMetrics"` // Configuration for health checks. HealthCheck HealthCheck `field:"optional" json:"healthCheck" yaml:"healthCheck"` // If the ASG has scheduled actions, don't reset unchanged group sizes. // // Only used if the ASG has scheduled actions (which may scale your ASG up // or down regardless of cdk deployments). If true, the size of the group // will only be reset if it has been changed in the CDK app. If false, the // sizes will always be changed back to what they were in the CDK app // on deployment. IgnoreUnmodifiedSizeProperties *bool `field:"optional" json:"ignoreUnmodifiedSizeProperties" yaml:"ignoreUnmodifiedSizeProperties"` // Controls whether instances in this group are launched with detailed or basic monitoring. // // When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account // is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. // See: https://docs.aws.amazon.com/autoscaling/latest/userguide/as-instance-monitoring.html#enable-as-instance-metrics // InstanceMonitoring Monitoring `field:"optional" json:"instanceMonitoring" yaml:"instanceMonitoring"` // Name of SSH keypair to grant access to instances. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. KeyName *string `field:"optional" json:"keyName" yaml:"keyName"` // Maximum number of instances in the fleet. MaxCapacity *float64 `field:"optional" json:"maxCapacity" yaml:"maxCapacity"` // The maximum amount of time that an instance can be in service. // // The maximum duration applies // to all current and future instances in the group. As an instance approaches its maximum duration, // it is terminated and replaced, and cannot be used again. // // You must specify a value of at least 604,800 seconds (7 days). To clear a previously set value, // leave this property undefined. // See: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-max-instance-lifetime.html // MaxInstanceLifetime awscdk.Duration `field:"optional" json:"maxInstanceLifetime" yaml:"maxInstanceLifetime"` // Minimum number of instances in the fleet. MinCapacity *float64 `field:"optional" json:"minCapacity" yaml:"minCapacity"` // Whether newly-launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in. // // By default, Auto Scaling can terminate an instance at any time after launch // when scaling in an Auto Scaling Group, subject to the group's termination // policy. However, you may wish to protect newly-launched instances from // being scaled in if they are going to run critical applications that should // not be prematurely terminated. // // This flag must be enabled if the Auto Scaling Group will be associated with // an ECS Capacity Provider with managed termination protection. NewInstancesProtectedFromScaleIn *bool `field:"optional" json:"newInstancesProtectedFromScaleIn" yaml:"newInstancesProtectedFromScaleIn"` // Configure autoscaling group to send notifications about fleet changes to an SNS topic(s). // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-notificationconfigurations // Notifications *[]*NotificationConfiguration `field:"optional" json:"notifications" yaml:"notifications"` // Configure waiting for signals during deployment. // // Use this to pause the CloudFormation deployment to wait for the instances // in the AutoScalingGroup to report successful startup during // creation and updates. The UserData script needs to invoke `cfn-signal` // with a success or failure code after it is done setting up the instance. // // Without waiting for signals, the CloudFormation deployment will proceed as // soon as the AutoScalingGroup has been created or updated but before the // instances in the group have been started. // // For example, to have instances wait for an Elastic Load Balancing health check before // they signal success, add a health-check verification by using the // cfn-init helper script. For an example, see the verify_instance_health // command in the Auto Scaling rolling updates sample template: // // https://github.com/awslabs/aws-cloudformation-templates/blob/master/aws/services/AutoScaling/AutoScalingRollingUpdates.yaml Signals Signals `field:"optional" json:"signals" yaml:"signals"` // The maximum hourly price (in USD) to be paid for any Spot Instance launched to fulfill the request. // // Spot Instances are // launched when the price you specify exceeds the current Spot market price. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. SpotPrice *string `field:"optional" json:"spotPrice" yaml:"spotPrice"` // Add SSM session permissions to the instance role. // // Setting this to `true` adds the necessary permissions to connect // to the instance using SSM Session Manager. You can do this // from the AWS Console. // // NOTE: Setting this flag to `true` may not be enough by itself. // You must also use an AMI that comes with the SSM Agent, or install // the SSM Agent yourself. See // [Working with SSM Agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent.html) // in the SSM Developer Guide. SsmSessionPermissions *bool `field:"optional" json:"ssmSessionPermissions" yaml:"ssmSessionPermissions"` // A policy or a list of policies that are used to select the instances to terminate. // // The policies are executed in the order that you list them. // See: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html // TerminationPolicies *[]TerminationPolicy `field:"optional" json:"terminationPolicies" yaml:"terminationPolicies"` // What to do when an AutoScalingGroup's instance configuration is changed. // // This is applied when any of the settings on the ASG are changed that // affect how the instances should be created (VPC, instance type, startup // scripts, etc.). It indicates how the existing instances should be // replaced with new instances matching the new config. By default, nothing // is done and only new instances are launched with the new config. UpdatePolicy UpdatePolicy `field:"optional" json:"updatePolicy" yaml:"updatePolicy"` // Where to place instances within the VPC. VpcSubnets *awsec2.SubnetSelection `field:"optional" json:"vpcSubnets" yaml:"vpcSubnets"` // VPC to launch these instances in. Vpc awsec2.IVpc `field:"required" json:"vpc" yaml:"vpc"` // Apply the given CloudFormation Init configuration to the instances in the AutoScalingGroup at startup. // // If you specify `init`, you must also specify `signals` to configure // the number of instances to wait for and the timeout for waiting for the // init process. Init awsec2.CloudFormationInit `field:"optional" json:"init" yaml:"init"` // Use the given options for applying CloudFormation Init. // // Describes the configsets to use and the timeout to wait. InitOptions *ApplyCloudFormationInitOptions `field:"optional" json:"initOptions" yaml:"initOptions"` // Type of instance to launch. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. InstanceType awsec2.InstanceType `field:"optional" json:"instanceType" yaml:"instanceType"` // Launch template to use. // // Launch configuration related settings and MixedInstancesPolicy must not be specified when a // launch template is specified. LaunchTemplate awsec2.ILaunchTemplate `field:"optional" json:"launchTemplate" yaml:"launchTemplate"` // AMI to launch. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. MachineImage awsec2.IMachineImage `field:"optional" json:"machineImage" yaml:"machineImage"` // Mixed Instances Policy to use. // // Launch configuration related settings and Launch Template must not be specified when a // MixedInstancesPolicy is specified. MixedInstancesPolicy *MixedInstancesPolicy `field:"optional" json:"mixedInstancesPolicy" yaml:"mixedInstancesPolicy"` // Whether IMDSv2 should be required on launched instances. RequireImdsv2 *bool `field:"optional" json:"requireImdsv2" yaml:"requireImdsv2"` // An IAM role to associate with the instance profile assigned to this Auto Scaling Group. // // The role must be assumable by the service principal `ec2.amazonaws.com`: // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. // // Example: // role := iam.NewRole(this, jsii.String("MyRole"), &RoleProps{ // AssumedBy: iam.NewServicePrincipal(jsii.String("ec2.amazonaws.com")), // }) // Role awsiam.IRole `field:"optional" json:"role" yaml:"role"` // Security group to launch the instances in. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. SecurityGroup awsec2.ISecurityGroup `field:"optional" json:"securityGroup" yaml:"securityGroup"` // Specific UserData to use. // // The UserData may still be mutated after creation. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. UserData awsec2.UserData `field:"optional" json:"userData" yaml:"userData"` }
Properties of a Fleet.
Example:
var vpc vpc var instanceType instanceType var machineImage iMachineImage autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, InstanceType: InstanceType, MachineImage: MachineImage, // ... Init: ec2.CloudFormationInit_FromElements(ec2.InitFile_FromString(jsii.String("/etc/my_instance"), jsii.String("This got written during instance startup"))), Signals: autoscaling.Signals_WaitForAll(&SignalsOptions{ Timeout: awscdk.Duration_Minutes(jsii.Number(10)), }), })
type AutoScalingGroupRequireImdsv2Aspect ¶
type AutoScalingGroupRequireImdsv2Aspect interface { awscdk.IAspect // All aspects can visit an IConstruct. Visit(node constructs.IConstruct) // Adds a warning annotation to a node. Warn(node constructs.IConstruct, message *string) }
Aspect that makes IMDSv2 required on instances deployed by AutoScalingGroups.
Example:
aspect := autoscaling.NewAutoScalingGroupRequireImdsv2Aspect() awscdk.Aspects_Of(this).Add(aspect)
func NewAutoScalingGroupRequireImdsv2Aspect ¶
func NewAutoScalingGroupRequireImdsv2Aspect() AutoScalingGroupRequireImdsv2Aspect
type BaseTargetTrackingProps ¶
type BaseTargetTrackingProps struct { // Period after a scaling completes before another scaling activity can start. Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // Indicates whether scale in by the target tracking policy is disabled. // // If the value is true, scale in is disabled and the target tracking policy // won't remove capacity from the autoscaling group. Otherwise, scale in is // enabled and the target tracking policy can remove capacity from the // group. DisableScaleIn *bool `field:"optional" json:"disableScaleIn" yaml:"disableScaleIn"` // Estimated time until a newly launched instance can send metrics to CloudWatch. EstimatedInstanceWarmup awscdk.Duration `field:"optional" json:"estimatedInstanceWarmup" yaml:"estimatedInstanceWarmup"` }
Base interface for target tracking props.
Contains the attributes that are common to target tracking policies, except the ones relating to the metric and to the scalable target.
This interface is reused by more specific target tracking props objects.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" baseTargetTrackingProps := &BaseTargetTrackingProps{ Cooldown: cdk.Duration_Minutes(jsii.Number(30)), DisableScaleIn: jsii.Boolean(false), EstimatedInstanceWarmup: cdk.Duration_*Minutes(jsii.Number(30)), }
type BasicLifecycleHookProps ¶
type BasicLifecycleHookProps struct { // The state of the Amazon EC2 instance to which you want to attach the lifecycle hook. LifecycleTransition LifecycleTransition `field:"required" json:"lifecycleTransition" yaml:"lifecycleTransition"` // The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. DefaultResult DefaultResult `field:"optional" json:"defaultResult" yaml:"defaultResult"` // Maximum time between calls to RecordLifecycleActionHeartbeat for the hook. // // If the lifecycle hook times out, perform the action in DefaultResult. HeartbeatTimeout awscdk.Duration `field:"optional" json:"heartbeatTimeout" yaml:"heartbeatTimeout"` // Name of the lifecycle hook. LifecycleHookName *string `field:"optional" json:"lifecycleHookName" yaml:"lifecycleHookName"` // Additional data to pass to the lifecycle hook target. NotificationMetadata *string `field:"optional" json:"notificationMetadata" yaml:"notificationMetadata"` // The target of the lifecycle hook. NotificationTarget ILifecycleHookTarget `field:"optional" json:"notificationTarget" yaml:"notificationTarget"` // The role that allows publishing to the notification target. Role awsiam.IRole `field:"optional" json:"role" yaml:"role"` }
Basic properties for a lifecycle hook.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var lifecycleHookTarget iLifecycleHookTarget var role role basicLifecycleHookProps := &BasicLifecycleHookProps{ LifecycleTransition: awscdk.Aws_autoscaling.LifecycleTransition_INSTANCE_LAUNCHING, // the properties below are optional DefaultResult: awscdk.*Aws_autoscaling.DefaultResult_CONTINUE, HeartbeatTimeout: cdk.Duration_Minutes(jsii.Number(30)), LifecycleHookName: jsii.String("lifecycleHookName"), NotificationMetadata: jsii.String("notificationMetadata"), NotificationTarget: lifecycleHookTarget, Role: role, }
type BasicScheduledActionProps ¶
type BasicScheduledActionProps struct { // When to perform this action. // // Supports cron expressions. // // For more information about cron expressions, see https://en.wikipedia.org/wiki/Cron. Schedule Schedule `field:"required" json:"schedule" yaml:"schedule"` // The new desired capacity. // // At the scheduled time, set the desired capacity to the given capacity. // // At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied. DesiredCapacity *float64 `field:"optional" json:"desiredCapacity" yaml:"desiredCapacity"` // When this scheduled action expires. EndTime *time.Time `field:"optional" json:"endTime" yaml:"endTime"` // The new maximum capacity. // // At the scheduled time, set the maximum capacity to the given capacity. // // At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied. MaxCapacity *float64 `field:"optional" json:"maxCapacity" yaml:"maxCapacity"` // The new minimum capacity. // // At the scheduled time, set the minimum capacity to the given capacity. // // At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied. MinCapacity *float64 `field:"optional" json:"minCapacity" yaml:"minCapacity"` // When this scheduled action becomes active. StartTime *time.Time `field:"optional" json:"startTime" yaml:"startTime"` // Specifies the time zone for a cron expression. // // If a time zone is not provided, UTC is used by default. // // Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as Etc/GMT+9 or Pacific/Tahiti). // // For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. TimeZone *string `field:"optional" json:"timeZone" yaml:"timeZone"` }
Properties for a scheduled scaling action.
Example:
var autoScalingGroup autoScalingGroup autoScalingGroup.scaleOnSchedule(jsii.String("PrescaleInTheMorning"), &BasicScheduledActionProps{ Schedule: autoscaling.Schedule_Cron(&CronOptions{ Hour: jsii.String("8"), Minute: jsii.String("0"), }), MinCapacity: jsii.Number(20), }) autoScalingGroup.scaleOnSchedule(jsii.String("AllowDownscalingAtNight"), &BasicScheduledActionProps{ Schedule: autoscaling.Schedule_*Cron(&CronOptions{ Hour: jsii.String("20"), Minute: jsii.String("0"), }), MinCapacity: jsii.Number(1), })
type BasicStepScalingPolicyProps ¶
type BasicStepScalingPolicyProps struct { // Metric to scale on. Metric awscloudwatch.IMetric `field:"required" json:"metric" yaml:"metric"` // The intervals for scaling. // // Maps a range of metric values to a particular scaling behavior. ScalingSteps *[]*ScalingInterval `field:"required" json:"scalingSteps" yaml:"scalingSteps"` // How the adjustment numbers inside 'intervals' are interpreted. AdjustmentType AdjustmentType `field:"optional" json:"adjustmentType" yaml:"adjustmentType"` // Grace period after scaling activity. Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // Estimated time until a newly launched instance can send metrics to CloudWatch. EstimatedInstanceWarmup awscdk.Duration `field:"optional" json:"estimatedInstanceWarmup" yaml:"estimatedInstanceWarmup"` // How many evaluation periods of the metric to wait before triggering a scaling action. // // Raising this value can be used to smooth out the metric, at the expense // of slower response times. EvaluationPeriods *float64 `field:"optional" json:"evaluationPeriods" yaml:"evaluationPeriods"` // Aggregation to apply to all data points over the evaluation periods. // // Only has meaning if `evaluationPeriods != 1`. MetricAggregationType MetricAggregationType `field:"optional" json:"metricAggregationType" yaml:"metricAggregationType"` // Minimum absolute number to adjust capacity with as result of percentage scaling. // // Only when using AdjustmentType = PercentChangeInCapacity, this number controls // the minimum absolute effect size. MinAdjustmentMagnitude *float64 `field:"optional" json:"minAdjustmentMagnitude" yaml:"minAdjustmentMagnitude"` }
Example:
var autoScalingGroup autoScalingGroup workerUtilizationMetric := cloudwatch.NewMetric(&MetricProps{ Namespace: jsii.String("MyService"), MetricName: jsii.String("WorkerUtilization"), }) autoScalingGroup.scaleOnMetric(jsii.String("ScaleToCPU"), &BasicStepScalingPolicyProps{ Metric: workerUtilizationMetric, ScalingSteps: []scalingInterval{ &scalingInterval{ Upper: jsii.Number(10), Change: -jsii.Number(1), }, &scalingInterval{ Lower: jsii.Number(50), Change: +jsii.Number(1), }, &scalingInterval{ Lower: jsii.Number(70), Change: +jsii.Number(3), }, }, // Change this to AdjustmentType.PERCENT_CHANGE_IN_CAPACITY to interpret the // 'change' numbers before as percentages instead of capacity counts. AdjustmentType: autoscaling.AdjustmentType_CHANGE_IN_CAPACITY, })
type BasicTargetTrackingScalingPolicyProps ¶
type BasicTargetTrackingScalingPolicyProps struct { // Period after a scaling completes before another scaling activity can start. Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // Indicates whether scale in by the target tracking policy is disabled. // // If the value is true, scale in is disabled and the target tracking policy // won't remove capacity from the autoscaling group. Otherwise, scale in is // enabled and the target tracking policy can remove capacity from the // group. DisableScaleIn *bool `field:"optional" json:"disableScaleIn" yaml:"disableScaleIn"` // Estimated time until a newly launched instance can send metrics to CloudWatch. EstimatedInstanceWarmup awscdk.Duration `field:"optional" json:"estimatedInstanceWarmup" yaml:"estimatedInstanceWarmup"` // The target value for the metric. TargetValue *float64 `field:"required" json:"targetValue" yaml:"targetValue"` // A custom metric for application autoscaling. // // The metric must track utilization. Scaling out will happen if the metric is higher than // the target value, scaling in will happen in the metric is lower than the target value. // // Exactly one of customMetric or predefinedMetric must be specified. CustomMetric awscloudwatch.IMetric `field:"optional" json:"customMetric" yaml:"customMetric"` // A predefined metric for application autoscaling. // // The metric must track utilization. Scaling out will happen if the metric is higher than // the target value, scaling in will happen in the metric is lower than the target value. // // Exactly one of customMetric or predefinedMetric must be specified. PredefinedMetric PredefinedMetric `field:"optional" json:"predefinedMetric" yaml:"predefinedMetric"` // The resource label associated with the predefined metric. // // Should be supplied if the predefined metric is ALBRequestCountPerTarget, and the // format should be: // // app/<load-balancer-name>/<load-balancer-id>/targetgroup/<target-group-name>/<target-group-id>. ResourceLabel *string `field:"optional" json:"resourceLabel" yaml:"resourceLabel"` }
Properties for a Target Tracking policy that include the metric but exclude the target.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var metric metric basicTargetTrackingScalingPolicyProps := &BasicTargetTrackingScalingPolicyProps{ TargetValue: jsii.Number(123), // the properties below are optional Cooldown: cdk.Duration_Minutes(jsii.Number(30)), CustomMetric: metric, DisableScaleIn: jsii.Boolean(false), EstimatedInstanceWarmup: cdk.Duration_*Minutes(jsii.Number(30)), PredefinedMetric: awscdk.Aws_autoscaling.PredefinedMetric_ASG_AVERAGE_CPU_UTILIZATION, ResourceLabel: jsii.String("resourceLabel"), }
type BindHookTargetOptions ¶ added in v2.2.0
type BindHookTargetOptions struct { // The lifecycle hook to attach to. // // [disable-awslint:ref-via-interface]. LifecycleHook LifecycleHook `field:"required" json:"lifecycleHook" yaml:"lifecycleHook"` // The role to use when attaching to the lifecycle hook. // // [disable-awslint:ref-via-interface]. Role awsiam.IRole `field:"optional" json:"role" yaml:"role"` }
Options needed to bind a target to a lifecycle hook.
[disable-awslint:ref-via-interface] The lifecycle hook to attach to and an IRole to use.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var lifecycleHook lifecycleHook var role role bindHookTargetOptions := &BindHookTargetOptions{ LifecycleHook: lifecycleHook, // the properties below are optional Role: role, }
type BlockDevice ¶
type BlockDevice struct { // The device name exposed to the EC2 instance. // // Supply a value like `/dev/sdh`, `xvdh`. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html // DeviceName *string `field:"required" json:"deviceName" yaml:"deviceName"` // Defines the block device volume, to be either an Amazon EBS volume or an ephemeral instance store volume. // // Supply a value like `BlockDeviceVolume.ebs(15)`, `BlockDeviceVolume.ephemeral(0)`. Volume BlockDeviceVolume `field:"required" json:"volume" yaml:"volume"` }
Block device.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var blockDeviceVolume blockDeviceVolume blockDevice := &BlockDevice{ DeviceName: jsii.String("deviceName"), Volume: blockDeviceVolume, }
type BlockDeviceVolume ¶
type BlockDeviceVolume interface { // EBS device info. EbsDevice() *EbsDeviceProps // Virtual device name. VirtualName() *string }
Describes a block device mapping for an EC2 instance or Auto Scaling group.
Example:
var vpc vpc var instanceType instanceType var machineImage iMachineImage autoScalingGroup := autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, InstanceType: InstanceType, MachineImage: MachineImage, BlockDevices: []blockDevice{ &blockDevice{ DeviceName: jsii.String("gp3-volume"), Volume: autoscaling.BlockDeviceVolume_Ebs(jsii.Number(15), &EbsDeviceOptions{ VolumeType: autoscaling.EbsDeviceVolumeType_GP3, Throughput: jsii.Number(125), }), }, }, })
func BlockDeviceVolume_Ebs ¶
func BlockDeviceVolume_Ebs(volumeSize *float64, options *EbsDeviceOptions) BlockDeviceVolume
Creates a new Elastic Block Storage device.
func BlockDeviceVolume_EbsFromSnapshot ¶
func BlockDeviceVolume_EbsFromSnapshot(snapshotId *string, options *EbsDeviceSnapshotOptions) BlockDeviceVolume
Creates a new Elastic Block Storage device from an existing snapshot.
func BlockDeviceVolume_Ephemeral ¶
func BlockDeviceVolume_Ephemeral(volumeIndex *float64) BlockDeviceVolume
Creates a virtual, ephemeral device.
The name will be in the form ephemeral{volumeIndex}.
func BlockDeviceVolume_NoDevice ¶
func BlockDeviceVolume_NoDevice() BlockDeviceVolume
Supresses a volume mapping.
func NewBlockDeviceVolume ¶
func NewBlockDeviceVolume(ebsDevice *EbsDeviceProps, virtualName *string) BlockDeviceVolume
type CfnAutoScalingGroup ¶
type CfnAutoScalingGroup interface { awscdk.CfnResource awscdk.IInspectable // The name of the Auto Scaling group. This name must be unique per Region per account. // // The name can contain any ASCII character 33 to 126 including most punctuation characters, digits, and upper and lowercased letters. // // > You cannot use a colon (:) in the name. AutoScalingGroupName() *string SetAutoScalingGroupName(val *string) // A list of Availability Zones where instances in the Auto Scaling group can be created. // // Used for launching into the default VPC subnet in each Availability Zone when not using the `VPCZoneIdentifier` property, or for attaching a network interface when an existing network interface ID is specified in a launch template. AvailabilityZones() *[]*string SetAvailabilityZones(val *[]*string) // Indicates whether Capacity Rebalancing is enabled. // // Otherwise, Capacity Rebalancing is disabled. When you turn on Capacity Rebalancing, Amazon EC2 Auto Scaling attempts to launch a Spot Instance whenever Amazon EC2 notifies that a Spot Instance is at an elevated risk of interruption. After launching a new instance, it then terminates an old instance. For more information, see [Use Capacity Rebalancing to handle Amazon EC2 Spot Interruptions](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-capacity-rebalancing.html) in the in the *Amazon EC2 Auto Scaling User Guide* . CapacityRebalance() interface{} SetCapacityRebalance(val interface{}) // Options for this resource, such as condition, update policy etc. CfnOptions() awscdk.ICfnResourceOptions CfnProperties() *map[string]interface{} // AWS resource type. CfnResourceType() *string // Reserved. Context() *string SetContext(val *string) // *Only needed if you use simple scaling policies.*. // // The amount of time, in seconds, between one scaling activity ending and another one starting due to simple scaling policies. For more information, see [Scaling cooldowns for Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html) in the *Amazon EC2 Auto Scaling User Guide* . // // Default: `300` seconds. Cooldown() *string SetCooldown(val *string) // Returns: the stack trace of the point where this Resource was created from, sourced // from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most // node +internal+ entries filtered. CreationStack() *[]*string // The amount of time, in seconds, until a new instance is considered to have finished initializing and resource consumption to become stable after it enters the `InService` state. // // During an instance refresh, Amazon EC2 Auto Scaling waits for the warm-up period after it replaces an instance before it moves on to replacing the next instance. Amazon EC2 Auto Scaling also waits for the warm-up period before aggregating the metrics for new instances with existing instances in the Amazon CloudWatch metrics that are used for scaling, resulting in more reliable usage data. For more information, see [Set the default instance warmup for an Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-default-instance-warmup.html) in the *Amazon EC2 Auto Scaling User Guide* . // // > To manage various warm-up settings at the group level, we recommend that you set the default instance warmup, *even if it is set to 0 seconds* . To remove a value that you previously set, include the property but specify `-1` for the value. However, we strongly recommend keeping the default instance warmup enabled by specifying a value of `0` or other nominal value. // // Default: None. DefaultInstanceWarmup() *float64 SetDefaultInstanceWarmup(val *float64) // The desired capacity is the initial capacity of the Auto Scaling group at the time of its creation and the capacity it attempts to maintain. // // It can scale beyond this capacity if you configure automatic scaling. // // The number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group. If you do not specify a desired capacity when creating the stack, the default is the minimum size of the group. // // CloudFormation marks the Auto Scaling group as successful (by setting its status to CREATE_COMPLETE) when the desired capacity is reached. However, if a maximum Spot price is set in the launch template or launch configuration that you specified, then desired capacity is not used as a criteria for success. Whether your request is fulfilled depends on Spot Instance capacity and your maximum price. DesiredCapacity() *string SetDesiredCapacity(val *string) // The unit of measurement for the value specified for desired capacity. // // Amazon EC2 Auto Scaling supports `DesiredCapacityType` for attribute-based instance type selection only. For more information, see [Creating an Auto Scaling group using attribute-based instance type selection](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg-instance-type-requirements.html) in the *Amazon EC2 Auto Scaling User Guide* . // // By default, Amazon EC2 Auto Scaling specifies `units` , which translates into number of instances. // // Valid values: `units` | `vcpu` | `memory-mib`. DesiredCapacityType() *string SetDesiredCapacityType(val *string) // The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service and marking it unhealthy due to a failed health check. // // This is useful if your instances do not immediately pass their health checks after they enter the `InService` state. For more information, see [Set the health check grace period for an Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/health-check-grace-period.html) in the *Amazon EC2 Auto Scaling User Guide* . // // Default: `0` seconds. HealthCheckGracePeriod() *float64 SetHealthCheckGracePeriod(val *float64) // A comma-separated value string of one or more health check types. // // The valid values are `EC2` , `ELB` , and `VPC_LATTICE` . `EC2` is the default health check and cannot be disabled. For more information, see [Health checks for Auto Scaling instances](https://docs.aws.amazon.com/autoscaling/ec2/userguide/healthcheck.html) in the *Amazon EC2 Auto Scaling User Guide* . // // Only specify `EC2` if you must clear a value that was previously set. HealthCheckType() *string SetHealthCheckType(val *string) // The ID of the instance used to base the launch configuration on. // // For more information, see [Create an Auto Scaling group using an EC2 instance](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg-from-instance.html) in the *Amazon EC2 Auto Scaling User Guide* . // // If you specify `LaunchTemplate` , `MixedInstancesPolicy` , or `LaunchConfigurationName` , don't specify `InstanceId` . InstanceId() *string SetInstanceId(val *string) // The name of the launch configuration to use to launch instances. // // Required only if you don't specify `LaunchTemplate` , `MixedInstancesPolicy` , or `InstanceId` . LaunchConfigurationName() *string SetLaunchConfigurationName(val *string) // Information used to specify the launch template and version to use to launch instances. // // You can alternatively associate a launch template to the Auto Scaling group by specifying a `MixedInstancesPolicy` . For more information about creating launch templates, see [Create a launch template for an Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-template.html) in the *Amazon EC2 Auto Scaling User Guide* . // // If you omit this property, you must specify `MixedInstancesPolicy` , `LaunchConfigurationName` , or `InstanceId` . LaunchTemplate() interface{} SetLaunchTemplate(val interface{}) // One or more lifecycle hooks to add to the Auto Scaling group before instances are launched. LifecycleHookSpecificationList() interface{} SetLifecycleHookSpecificationList(val interface{}) // A list of Classic Load Balancers associated with this Auto Scaling group. // // For Application Load Balancers, Network Load Balancers, and Gateway Load Balancers, specify the `TargetGroupARNs` property instead. LoadBalancerNames() *[]*string SetLoadBalancerNames(val *[]*string) // The logical ID for this CloudFormation stack element. // // The logical ID of the element // is calculated from the path of the resource node in the construct tree. // // To override this value, use `overrideLogicalId(newLogicalId)`. // // Returns: the logical ID as a stringified token. This value will only get // resolved during synthesis. LogicalId() *string // The maximum amount of time, in seconds, that an instance can be in service. // // The default is null. If specified, the value must be either 0 or a number equal to or greater than 86,400 seconds (1 day). For more information, see [Replacing Auto Scaling instances based on maximum instance lifetime](https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-max-instance-lifetime.html) in the *Amazon EC2 Auto Scaling User Guide* . MaxInstanceLifetime() *float64 SetMaxInstanceLifetime(val *float64) // The maximum size of the group. // // > With a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go above `MaxSize` to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling will never go above `MaxSize` by more than your largest instance weight (weights that define how many units each instance contributes to the desired capacity of the group). MaxSize() *string SetMaxSize(val *string) // Enables the monitoring of group metrics of an Auto Scaling group. // // By default, these metrics are disabled. MetricsCollection() interface{} SetMetricsCollection(val interface{}) // The minimum size of the group. MinSize() *string SetMinSize(val *string) // An embedded object that specifies a mixed instances policy. // // The policy includes properties that not only define the distribution of On-Demand Instances and Spot Instances, the maximum price to pay for Spot Instances (optional), and how the Auto Scaling group allocates instance types to fulfill On-Demand and Spot capacities, but also the properties that specify the instance configuration information—the launch template and instance types. The policy can also include a weight for each instance type and different launch templates for individual instance types. // // For more information, see [Auto Scaling groups with multiple instance types and purchase options](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups.html) in the *Amazon EC2 Auto Scaling User Guide* . MixedInstancesPolicy() interface{} SetMixedInstancesPolicy(val interface{}) // Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in. // // For more information about preventing instances from terminating on scale in, see [Using instance scale-in protection](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-instance-protection.html) in the *Amazon EC2 Auto Scaling User Guide* . NewInstancesProtectedFromScaleIn() interface{} SetNewInstancesProtectedFromScaleIn(val interface{}) // The tree node. Node() constructs.Node // Configures an Auto Scaling group to send notifications when specified events take place. NotificationConfigurations() interface{} SetNotificationConfigurations(val interface{}) // The name of the placement group into which to launch your instances. // // For more information, see [Placement groups](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html) in the *Amazon EC2 User Guide for Linux Instances* . // // > A *cluster* placement group is a logical grouping of instances within a single Availability Zone. You cannot specify multiple Availability Zones and a cluster placement group. PlacementGroup() *string SetPlacementGroup(val *string) // Return a string that will be resolved to a CloudFormation `{ Ref }` for this element. // // If, by any chance, the intrinsic reference of a resource is not a string, you could // coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`. Ref() *string // The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS service on your behalf. // // By default, Amazon EC2 Auto Scaling uses a service-linked role named `AWSServiceRoleForAutoScaling` , which it creates if it does not exist. For more information, see [Service-linked roles](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-service-linked-role.html) in the *Amazon EC2 Auto Scaling User Guide* . ServiceLinkedRoleArn() *string SetServiceLinkedRoleArn(val *string) // The stack in which this element is defined. // // CfnElements must be defined within a stack scope (directly or indirectly). Stack() awscdk.Stack // One or more tags. // // You can tag your Auto Scaling group and propagate the tags to the Amazon EC2 instances it launches. Tags are not propagated to Amazon EBS volumes. To add tags to Amazon EBS volumes, specify the tags in a launch template but use caution. If the launch template specifies an instance tag with a key that is also specified for the Auto Scaling group, Amazon EC2 Auto Scaling overrides the value of that instance tag with the value specified by the Auto Scaling group. For more information, see [Tag Auto Scaling groups and instances](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-tagging.html) in the *Amazon EC2 Auto Scaling User Guide* . Tags() awscdk.TagManager // The Amazon Resource Names (ARN) of the Elastic Load Balancing target groups to associate with the Auto Scaling group. // // Instances are registered as targets with the target groups. The target groups receive incoming traffic and route requests to one or more registered targets. For more information, see [Use Elastic Load Balancing to distribute traffic across the instances in your Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html) in the *Amazon EC2 Auto Scaling User Guide* . TargetGroupArns() *[]*string SetTargetGroupArns(val *[]*string) // A policy or a list of policies that are used to select the instance to terminate. // // These policies are executed in the order that you list them. For more information, see [Work with Amazon EC2 Auto Scaling termination policies](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-termination-policies.html) in the *Amazon EC2 Auto Scaling User Guide* . // // Valid values: `Default` | `AllocationStrategy` | `ClosestToNextInstanceHour` | `NewestInstance` | `OldestInstance` | `OldestLaunchConfiguration` | `OldestLaunchTemplate` | `arn:aws:lambda:region:account-id:function:my-function:my-alias`. TerminationPolicies() *[]*string SetTerminationPolicies(val *[]*string) // Deprecated. // Deprecated: use `updatedProperties` // // Return properties modified after initiation // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperites() *map[string]interface{} // Return properties modified after initiation. // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperties() *map[string]interface{} // A list of subnet IDs for a virtual private cloud (VPC) where instances in the Auto Scaling group can be created. // // If this resource specifies public subnets and is also in a VPC that is defined in the same stack template, you must use the [DependsOn attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html) to declare a dependency on the [VPC-gateway attachment](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html) . // // > When you update `VPCZoneIdentifier` , this retains the same Auto Scaling group and replaces old instances with new ones, according to the specified subnets. You can optionally specify how CloudFormation handles these updates by using an [UpdatePolicy attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html) . // // Required to launch instances into a nondefault VPC. If you specify `VPCZoneIdentifier` with `AvailabilityZones` , the subnets that you specify for this property must reside in those Availability Zones. VpcZoneIdentifier() *[]*string SetVpcZoneIdentifier(val *[]*string) // Syntactic sugar for `addOverride(path, undefined)`. AddDeletionOverride(path *string) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // // This can be used for resources across stacks (or nested stack) boundaries // and the dependency will automatically be transferred to the relevant scope. AddDependency(target awscdk.CfnResource) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // Deprecated: use addDependency. AddDependsOn(target awscdk.CfnResource) // Add a value to the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // AddMetadata(key *string, value interface{}) // Adds an override to the synthesized CloudFormation resource. // // To add a // property override, either use `addPropertyOverride` or prefix `path` with // "Properties." (i.e. `Properties.TopicName`). // // If the override is nested, separate each nested level using a dot (.) in the path parameter. // If there is an array as part of the nesting, specify the index in the path. // // To include a literal `.` in the property name, prefix with a `\`. In most // programming languages you will need to write this as `"\\."` because the // `\` itself will need to be escaped. // // For example, // “`typescript // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']); // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE'); // “` // would add the overrides // “`json // "Properties": { // "GlobalSecondaryIndexes": [ // { // "Projection": { // "NonKeyAttributes": [ "myattribute" ] // ... // } // ... // }, // { // "ProjectionType": "INCLUDE" // ... // }, // ] // ... // } // “` // // The `value` argument to `addOverride` will not be processed or translated // in any way. Pass raw JSON values in here with the correct capitalization // for CloudFormation. If you pass CDK classes or structs, they will be // rendered with lowercased key names, and CloudFormation will reject the // template. AddOverride(path *string, value interface{}) // Adds an override that deletes the value of a property from the resource definition. AddPropertyDeletionOverride(propertyPath *string) // Adds an override to a resource property. // // Syntactic sugar for `addOverride("Properties.<...>", value)`. AddPropertyOverride(propertyPath *string, value interface{}) // Sets the deletion policy of the resource based on the removal policy specified. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some // cases, a snapshot can be taken of the resource prior to deletion // (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy // can be found in the following link:. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options // ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) // Returns a token for an runtime attribute of this resource. // // Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility // in case there is no generated attribute. GetAtt(attributeName *string, typeHint awscdk.ResolutionTypeHint) awscdk.Reference // Retrieve a value value from the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // GetMetadata(key *string) interface{} // Examines the CloudFormation resource and discloses attributes. Inspect(inspector awscdk.TreeInspector) // Retrieves an array of resources this resource depends on. // // This assembles dependencies on resources across stacks (including nested stacks) // automatically. ObtainDependencies() *[]interface{} // Get a shallow copy of dependencies between this resource and other resources in the same stack. ObtainResourceDependencies() *[]awscdk.CfnResource // Overrides the auto-generated logical ID with a specific ID. OverrideLogicalId(newLogicalId *string) // Indicates that this resource no longer depends on another resource. // // This can be used for resources across stacks (including nested stacks) // and the dependency will automatically be removed from the relevant scope. RemoveDependency(target awscdk.CfnResource) RenderProperties(props *map[string]interface{}) *map[string]interface{} // Replaces one dependency with another. ReplaceDependency(target awscdk.CfnResource, newTarget awscdk.CfnResource) // Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template. // // Returns: `true` if the resource should be included or `false` is the resource // should be omitted. ShouldSynthesize() *bool // Returns a string representation of this construct. // // Returns: a string representation of this resource. ToString() *string ValidateProperties(_properties interface{}) }
A CloudFormation `AWS::AutoScaling::AutoScalingGroup`.
The `AWS::AutoScaling::AutoScalingGroup` resource defines an Amazon EC2 Auto Scaling group, which is a collection of Amazon EC2 instances that are treated as a logical grouping for the purposes of automatic scaling and management.
For more information about Amazon EC2 Auto Scaling, see the [Amazon EC2 Auto Scaling User Guide](https://docs.aws.amazon.com/autoscaling/ec2/userguide/what-is-amazon-ec2-auto-scaling.html) .
> Amazon EC2 Auto Scaling configures instances launched as part of an Auto Scaling group using either a [launch template](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html) or a launch configuration. We strongly recommend that you do not use launch configurations. They do not provide full functionality for Amazon EC2 Auto Scaling or Amazon EC2. For more information, see [Launch configurations](https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-configurations.html) and [Migrate AWS CloudFormation stacks from launch configurations to launch templates](https://docs.aws.amazon.com/autoscaling/ec2/userguide/migrate-launch-configurations-with-cloudformation.html) in the *Amazon EC2 Auto Scaling User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" cfnAutoScalingGroup := awscdk.Aws_autoscaling.NewCfnAutoScalingGroup(this, jsii.String("MyCfnAutoScalingGroup"), &CfnAutoScalingGroupProps{ MaxSize: jsii.String("maxSize"), MinSize: jsii.String("minSize"), // the properties below are optional AutoScalingGroupName: jsii.String("autoScalingGroupName"), AvailabilityZones: []*string{ jsii.String("availabilityZones"), }, CapacityRebalance: jsii.Boolean(false), Context: jsii.String("context"), Cooldown: jsii.String("cooldown"), DefaultInstanceWarmup: jsii.Number(123), DesiredCapacity: jsii.String("desiredCapacity"), DesiredCapacityType: jsii.String("desiredCapacityType"), HealthCheckGracePeriod: jsii.Number(123), HealthCheckType: jsii.String("healthCheckType"), InstanceId: jsii.String("instanceId"), LaunchConfigurationName: jsii.String("launchConfigurationName"), LaunchTemplate: &LaunchTemplateSpecificationProperty{ Version: jsii.String("version"), // the properties below are optional LaunchTemplateId: jsii.String("launchTemplateId"), LaunchTemplateName: jsii.String("launchTemplateName"), }, LifecycleHookSpecificationList: []interface{}{ &LifecycleHookSpecificationProperty{ LifecycleHookName: jsii.String("lifecycleHookName"), LifecycleTransition: jsii.String("lifecycleTransition"), // the properties below are optional DefaultResult: jsii.String("defaultResult"), HeartbeatTimeout: jsii.Number(123), NotificationMetadata: jsii.String("notificationMetadata"), NotificationTargetArn: jsii.String("notificationTargetArn"), RoleArn: jsii.String("roleArn"), }, }, LoadBalancerNames: []*string{ jsii.String("loadBalancerNames"), }, MaxInstanceLifetime: jsii.Number(123), MetricsCollection: []interface{}{ &MetricsCollectionProperty{ Granularity: jsii.String("granularity"), // the properties below are optional Metrics: []*string{ jsii.String("metrics"), }, }, }, MixedInstancesPolicy: &MixedInstancesPolicyProperty{ LaunchTemplate: &LaunchTemplateProperty{ LaunchTemplateSpecification: &LaunchTemplateSpecificationProperty{ Version: jsii.String("version"), // the properties below are optional LaunchTemplateId: jsii.String("launchTemplateId"), LaunchTemplateName: jsii.String("launchTemplateName"), }, // the properties below are optional Overrides: []interface{}{ &LaunchTemplateOverridesProperty{ InstanceRequirements: &InstanceRequirementsProperty{ AcceleratorCount: &AcceleratorCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, AcceleratorManufacturers: []*string{ jsii.String("acceleratorManufacturers"), }, AcceleratorNames: []*string{ jsii.String("acceleratorNames"), }, AcceleratorTotalMemoryMiB: &AcceleratorTotalMemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, AcceleratorTypes: []*string{ jsii.String("acceleratorTypes"), }, AllowedInstanceTypes: []*string{ jsii.String("allowedInstanceTypes"), }, BareMetal: jsii.String("bareMetal"), BaselineEbsBandwidthMbps: &BaselineEbsBandwidthMbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, BurstablePerformance: jsii.String("burstablePerformance"), CpuManufacturers: []*string{ jsii.String("cpuManufacturers"), }, ExcludedInstanceTypes: []*string{ jsii.String("excludedInstanceTypes"), }, InstanceGenerations: []*string{ jsii.String("instanceGenerations"), }, LocalStorage: jsii.String("localStorage"), LocalStorageTypes: []*string{ jsii.String("localStorageTypes"), }, MemoryGiBPerVCpu: &MemoryGiBPerVCpuRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, MemoryMiB: &MemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, NetworkBandwidthGbps: &NetworkBandwidthGbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, NetworkInterfaceCount: &NetworkInterfaceCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, OnDemandMaxPricePercentageOverLowestPrice: jsii.Number(123), RequireHibernateSupport: jsii.Boolean(false), SpotMaxPricePercentageOverLowestPrice: jsii.Number(123), TotalLocalStorageGb: &TotalLocalStorageGBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, VCpuCount: &VCpuCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, }, InstanceType: jsii.String("instanceType"), LaunchTemplateSpecification: &LaunchTemplateSpecificationProperty{ Version: jsii.String("version"), // the properties below are optional LaunchTemplateId: jsii.String("launchTemplateId"), LaunchTemplateName: jsii.String("launchTemplateName"), }, WeightedCapacity: jsii.String("weightedCapacity"), }, }, }, // the properties below are optional InstancesDistribution: &InstancesDistributionProperty{ OnDemandAllocationStrategy: jsii.String("onDemandAllocationStrategy"), OnDemandBaseCapacity: jsii.Number(123), OnDemandPercentageAboveBaseCapacity: jsii.Number(123), SpotAllocationStrategy: jsii.String("spotAllocationStrategy"), SpotInstancePools: jsii.Number(123), SpotMaxPrice: jsii.String("spotMaxPrice"), }, }, NewInstancesProtectedFromScaleIn: jsii.Boolean(false), NotificationConfigurations: []interface{}{ &NotificationConfigurationProperty{ TopicArn: jsii.String("topicArn"), // the properties below are optional NotificationTypes: []*string{ jsii.String("notificationTypes"), }, }, }, PlacementGroup: jsii.String("placementGroup"), ServiceLinkedRoleArn: jsii.String("serviceLinkedRoleArn"), Tags: []tagPropertyProperty{ &tagPropertyProperty{ Key: jsii.String("key"), PropagateAtLaunch: jsii.Boolean(false), Value: jsii.String("value"), }, }, TargetGroupArns: []*string{ jsii.String("targetGroupArns"), }, TerminationPolicies: []*string{ jsii.String("terminationPolicies"), }, VpcZoneIdentifier: []*string{ jsii.String("vpcZoneIdentifier"), }, })
func NewCfnAutoScalingGroup ¶
func NewCfnAutoScalingGroup(scope constructs.Construct, id *string, props *CfnAutoScalingGroupProps) CfnAutoScalingGroup
Create a new `AWS::AutoScaling::AutoScalingGroup`.
type CfnAutoScalingGroupProps ¶
type CfnAutoScalingGroupProps struct { // The maximum size of the group. // // > With a mixed instances policy that uses instance weighting, Amazon EC2 Auto Scaling may need to go above `MaxSize` to meet your capacity requirements. In this event, Amazon EC2 Auto Scaling will never go above `MaxSize` by more than your largest instance weight (weights that define how many units each instance contributes to the desired capacity of the group). MaxSize *string `field:"required" json:"maxSize" yaml:"maxSize"` // The minimum size of the group. MinSize *string `field:"required" json:"minSize" yaml:"minSize"` // The name of the Auto Scaling group. This name must be unique per Region per account. // // The name can contain any ASCII character 33 to 126 including most punctuation characters, digits, and upper and lowercased letters. // // > You cannot use a colon (:) in the name. AutoScalingGroupName *string `field:"optional" json:"autoScalingGroupName" yaml:"autoScalingGroupName"` // A list of Availability Zones where instances in the Auto Scaling group can be created. // // Used for launching into the default VPC subnet in each Availability Zone when not using the `VPCZoneIdentifier` property, or for attaching a network interface when an existing network interface ID is specified in a launch template. AvailabilityZones *[]*string `field:"optional" json:"availabilityZones" yaml:"availabilityZones"` // Indicates whether Capacity Rebalancing is enabled. // // Otherwise, Capacity Rebalancing is disabled. When you turn on Capacity Rebalancing, Amazon EC2 Auto Scaling attempts to launch a Spot Instance whenever Amazon EC2 notifies that a Spot Instance is at an elevated risk of interruption. After launching a new instance, it then terminates an old instance. For more information, see [Use Capacity Rebalancing to handle Amazon EC2 Spot Interruptions](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-capacity-rebalancing.html) in the in the *Amazon EC2 Auto Scaling User Guide* . CapacityRebalance interface{} `field:"optional" json:"capacityRebalance" yaml:"capacityRebalance"` // Reserved. Context *string `field:"optional" json:"context" yaml:"context"` // *Only needed if you use simple scaling policies.*. // // The amount of time, in seconds, between one scaling activity ending and another one starting due to simple scaling policies. For more information, see [Scaling cooldowns for Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html) in the *Amazon EC2 Auto Scaling User Guide* . // // Default: `300` seconds. Cooldown *string `field:"optional" json:"cooldown" yaml:"cooldown"` // The amount of time, in seconds, until a new instance is considered to have finished initializing and resource consumption to become stable after it enters the `InService` state. // // During an instance refresh, Amazon EC2 Auto Scaling waits for the warm-up period after it replaces an instance before it moves on to replacing the next instance. Amazon EC2 Auto Scaling also waits for the warm-up period before aggregating the metrics for new instances with existing instances in the Amazon CloudWatch metrics that are used for scaling, resulting in more reliable usage data. For more information, see [Set the default instance warmup for an Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-default-instance-warmup.html) in the *Amazon EC2 Auto Scaling User Guide* . // // > To manage various warm-up settings at the group level, we recommend that you set the default instance warmup, *even if it is set to 0 seconds* . To remove a value that you previously set, include the property but specify `-1` for the value. However, we strongly recommend keeping the default instance warmup enabled by specifying a value of `0` or other nominal value. // // Default: None. DefaultInstanceWarmup *float64 `field:"optional" json:"defaultInstanceWarmup" yaml:"defaultInstanceWarmup"` // The desired capacity is the initial capacity of the Auto Scaling group at the time of its creation and the capacity it attempts to maintain. // // It can scale beyond this capacity if you configure automatic scaling. // // The number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group. If you do not specify a desired capacity when creating the stack, the default is the minimum size of the group. // // CloudFormation marks the Auto Scaling group as successful (by setting its status to CREATE_COMPLETE) when the desired capacity is reached. However, if a maximum Spot price is set in the launch template or launch configuration that you specified, then desired capacity is not used as a criteria for success. Whether your request is fulfilled depends on Spot Instance capacity and your maximum price. DesiredCapacity *string `field:"optional" json:"desiredCapacity" yaml:"desiredCapacity"` // The unit of measurement for the value specified for desired capacity. // // Amazon EC2 Auto Scaling supports `DesiredCapacityType` for attribute-based instance type selection only. For more information, see [Creating an Auto Scaling group using attribute-based instance type selection](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg-instance-type-requirements.html) in the *Amazon EC2 Auto Scaling User Guide* . // // By default, Amazon EC2 Auto Scaling specifies `units` , which translates into number of instances. // // Valid values: `units` | `vcpu` | `memory-mib`. DesiredCapacityType *string `field:"optional" json:"desiredCapacityType" yaml:"desiredCapacityType"` // The amount of time, in seconds, that Amazon EC2 Auto Scaling waits before checking the health status of an EC2 instance that has come into service and marking it unhealthy due to a failed health check. // // This is useful if your instances do not immediately pass their health checks after they enter the `InService` state. For more information, see [Set the health check grace period for an Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/health-check-grace-period.html) in the *Amazon EC2 Auto Scaling User Guide* . // // Default: `0` seconds. HealthCheckGracePeriod *float64 `field:"optional" json:"healthCheckGracePeriod" yaml:"healthCheckGracePeriod"` // A comma-separated value string of one or more health check types. // // The valid values are `EC2` , `ELB` , and `VPC_LATTICE` . `EC2` is the default health check and cannot be disabled. For more information, see [Health checks for Auto Scaling instances](https://docs.aws.amazon.com/autoscaling/ec2/userguide/healthcheck.html) in the *Amazon EC2 Auto Scaling User Guide* . // // Only specify `EC2` if you must clear a value that was previously set. HealthCheckType *string `field:"optional" json:"healthCheckType" yaml:"healthCheckType"` // The ID of the instance used to base the launch configuration on. // // For more information, see [Create an Auto Scaling group using an EC2 instance](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg-from-instance.html) in the *Amazon EC2 Auto Scaling User Guide* . // // If you specify `LaunchTemplate` , `MixedInstancesPolicy` , or `LaunchConfigurationName` , don't specify `InstanceId` . InstanceId *string `field:"optional" json:"instanceId" yaml:"instanceId"` // The name of the launch configuration to use to launch instances. // // Required only if you don't specify `LaunchTemplate` , `MixedInstancesPolicy` , or `InstanceId` . LaunchConfigurationName *string `field:"optional" json:"launchConfigurationName" yaml:"launchConfigurationName"` // Information used to specify the launch template and version to use to launch instances. // // You can alternatively associate a launch template to the Auto Scaling group by specifying a `MixedInstancesPolicy` . For more information about creating launch templates, see [Create a launch template for an Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-template.html) in the *Amazon EC2 Auto Scaling User Guide* . // // If you omit this property, you must specify `MixedInstancesPolicy` , `LaunchConfigurationName` , or `InstanceId` . LaunchTemplate interface{} `field:"optional" json:"launchTemplate" yaml:"launchTemplate"` // One or more lifecycle hooks to add to the Auto Scaling group before instances are launched. LifecycleHookSpecificationList interface{} `field:"optional" json:"lifecycleHookSpecificationList" yaml:"lifecycleHookSpecificationList"` // A list of Classic Load Balancers associated with this Auto Scaling group. // // For Application Load Balancers, Network Load Balancers, and Gateway Load Balancers, specify the `TargetGroupARNs` property instead. LoadBalancerNames *[]*string `field:"optional" json:"loadBalancerNames" yaml:"loadBalancerNames"` // The maximum amount of time, in seconds, that an instance can be in service. // // The default is null. If specified, the value must be either 0 or a number equal to or greater than 86,400 seconds (1 day). For more information, see [Replacing Auto Scaling instances based on maximum instance lifetime](https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-max-instance-lifetime.html) in the *Amazon EC2 Auto Scaling User Guide* . MaxInstanceLifetime *float64 `field:"optional" json:"maxInstanceLifetime" yaml:"maxInstanceLifetime"` // Enables the monitoring of group metrics of an Auto Scaling group. // // By default, these metrics are disabled. MetricsCollection interface{} `field:"optional" json:"metricsCollection" yaml:"metricsCollection"` // An embedded object that specifies a mixed instances policy. // // The policy includes properties that not only define the distribution of On-Demand Instances and Spot Instances, the maximum price to pay for Spot Instances (optional), and how the Auto Scaling group allocates instance types to fulfill On-Demand and Spot capacities, but also the properties that specify the instance configuration information—the launch template and instance types. The policy can also include a weight for each instance type and different launch templates for individual instance types. // // For more information, see [Auto Scaling groups with multiple instance types and purchase options](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups.html) in the *Amazon EC2 Auto Scaling User Guide* . MixedInstancesPolicy interface{} `field:"optional" json:"mixedInstancesPolicy" yaml:"mixedInstancesPolicy"` // Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in. // // For more information about preventing instances from terminating on scale in, see [Using instance scale-in protection](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-instance-protection.html) in the *Amazon EC2 Auto Scaling User Guide* . NewInstancesProtectedFromScaleIn interface{} `field:"optional" json:"newInstancesProtectedFromScaleIn" yaml:"newInstancesProtectedFromScaleIn"` // Configures an Auto Scaling group to send notifications when specified events take place. NotificationConfigurations interface{} `field:"optional" json:"notificationConfigurations" yaml:"notificationConfigurations"` // The name of the placement group into which to launch your instances. // // For more information, see [Placement groups](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html) in the *Amazon EC2 User Guide for Linux Instances* . // // > A *cluster* placement group is a logical grouping of instances within a single Availability Zone. You cannot specify multiple Availability Zones and a cluster placement group. PlacementGroup *string `field:"optional" json:"placementGroup" yaml:"placementGroup"` // The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS service on your behalf. // // By default, Amazon EC2 Auto Scaling uses a service-linked role named `AWSServiceRoleForAutoScaling` , which it creates if it does not exist. For more information, see [Service-linked roles](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-service-linked-role.html) in the *Amazon EC2 Auto Scaling User Guide* . ServiceLinkedRoleArn *string `field:"optional" json:"serviceLinkedRoleArn" yaml:"serviceLinkedRoleArn"` // One or more tags. // // You can tag your Auto Scaling group and propagate the tags to the Amazon EC2 instances it launches. Tags are not propagated to Amazon EBS volumes. To add tags to Amazon EBS volumes, specify the tags in a launch template but use caution. If the launch template specifies an instance tag with a key that is also specified for the Auto Scaling group, Amazon EC2 Auto Scaling overrides the value of that instance tag with the value specified by the Auto Scaling group. For more information, see [Tag Auto Scaling groups and instances](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-tagging.html) in the *Amazon EC2 Auto Scaling User Guide* . Tags *[]*CfnAutoScalingGroup_TagPropertyProperty `field:"optional" json:"tags" yaml:"tags"` // The Amazon Resource Names (ARN) of the Elastic Load Balancing target groups to associate with the Auto Scaling group. // // Instances are registered as targets with the target groups. The target groups receive incoming traffic and route requests to one or more registered targets. For more information, see [Use Elastic Load Balancing to distribute traffic across the instances in your Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-load-balancer.html) in the *Amazon EC2 Auto Scaling User Guide* . TargetGroupArns *[]*string `field:"optional" json:"targetGroupArns" yaml:"targetGroupArns"` // A policy or a list of policies that are used to select the instance to terminate. // // These policies are executed in the order that you list them. For more information, see [Work with Amazon EC2 Auto Scaling termination policies](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-termination-policies.html) in the *Amazon EC2 Auto Scaling User Guide* . // // Valid values: `Default` | `AllocationStrategy` | `ClosestToNextInstanceHour` | `NewestInstance` | `OldestInstance` | `OldestLaunchConfiguration` | `OldestLaunchTemplate` | `arn:aws:lambda:region:account-id:function:my-function:my-alias`. TerminationPolicies *[]*string `field:"optional" json:"terminationPolicies" yaml:"terminationPolicies"` // A list of subnet IDs for a virtual private cloud (VPC) where instances in the Auto Scaling group can be created. // // If this resource specifies public subnets and is also in a VPC that is defined in the same stack template, you must use the [DependsOn attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html) to declare a dependency on the [VPC-gateway attachment](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-vpc-gateway-attachment.html) . // // > When you update `VPCZoneIdentifier` , this retains the same Auto Scaling group and replaces old instances with new ones, according to the specified subnets. You can optionally specify how CloudFormation handles these updates by using an [UpdatePolicy attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html) . // // Required to launch instances into a nondefault VPC. If you specify `VPCZoneIdentifier` with `AvailabilityZones` , the subnets that you specify for this property must reside in those Availability Zones. VpcZoneIdentifier *[]*string `field:"optional" json:"vpcZoneIdentifier" yaml:"vpcZoneIdentifier"` }
Properties for defining a `CfnAutoScalingGroup`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" cfnAutoScalingGroupProps := &CfnAutoScalingGroupProps{ MaxSize: jsii.String("maxSize"), MinSize: jsii.String("minSize"), // the properties below are optional AutoScalingGroupName: jsii.String("autoScalingGroupName"), AvailabilityZones: []*string{ jsii.String("availabilityZones"), }, CapacityRebalance: jsii.Boolean(false), Context: jsii.String("context"), Cooldown: jsii.String("cooldown"), DefaultInstanceWarmup: jsii.Number(123), DesiredCapacity: jsii.String("desiredCapacity"), DesiredCapacityType: jsii.String("desiredCapacityType"), HealthCheckGracePeriod: jsii.Number(123), HealthCheckType: jsii.String("healthCheckType"), InstanceId: jsii.String("instanceId"), LaunchConfigurationName: jsii.String("launchConfigurationName"), LaunchTemplate: &LaunchTemplateSpecificationProperty{ Version: jsii.String("version"), // the properties below are optional LaunchTemplateId: jsii.String("launchTemplateId"), LaunchTemplateName: jsii.String("launchTemplateName"), }, LifecycleHookSpecificationList: []interface{}{ &LifecycleHookSpecificationProperty{ LifecycleHookName: jsii.String("lifecycleHookName"), LifecycleTransition: jsii.String("lifecycleTransition"), // the properties below are optional DefaultResult: jsii.String("defaultResult"), HeartbeatTimeout: jsii.Number(123), NotificationMetadata: jsii.String("notificationMetadata"), NotificationTargetArn: jsii.String("notificationTargetArn"), RoleArn: jsii.String("roleArn"), }, }, LoadBalancerNames: []*string{ jsii.String("loadBalancerNames"), }, MaxInstanceLifetime: jsii.Number(123), MetricsCollection: []interface{}{ &MetricsCollectionProperty{ Granularity: jsii.String("granularity"), // the properties below are optional Metrics: []*string{ jsii.String("metrics"), }, }, }, MixedInstancesPolicy: &MixedInstancesPolicyProperty{ LaunchTemplate: &LaunchTemplateProperty{ LaunchTemplateSpecification: &LaunchTemplateSpecificationProperty{ Version: jsii.String("version"), // the properties below are optional LaunchTemplateId: jsii.String("launchTemplateId"), LaunchTemplateName: jsii.String("launchTemplateName"), }, // the properties below are optional Overrides: []interface{}{ &LaunchTemplateOverridesProperty{ InstanceRequirements: &InstanceRequirementsProperty{ AcceleratorCount: &AcceleratorCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, AcceleratorManufacturers: []*string{ jsii.String("acceleratorManufacturers"), }, AcceleratorNames: []*string{ jsii.String("acceleratorNames"), }, AcceleratorTotalMemoryMiB: &AcceleratorTotalMemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, AcceleratorTypes: []*string{ jsii.String("acceleratorTypes"), }, AllowedInstanceTypes: []*string{ jsii.String("allowedInstanceTypes"), }, BareMetal: jsii.String("bareMetal"), BaselineEbsBandwidthMbps: &BaselineEbsBandwidthMbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, BurstablePerformance: jsii.String("burstablePerformance"), CpuManufacturers: []*string{ jsii.String("cpuManufacturers"), }, ExcludedInstanceTypes: []*string{ jsii.String("excludedInstanceTypes"), }, InstanceGenerations: []*string{ jsii.String("instanceGenerations"), }, LocalStorage: jsii.String("localStorage"), LocalStorageTypes: []*string{ jsii.String("localStorageTypes"), }, MemoryGiBPerVCpu: &MemoryGiBPerVCpuRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, MemoryMiB: &MemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, NetworkBandwidthGbps: &NetworkBandwidthGbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, NetworkInterfaceCount: &NetworkInterfaceCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, OnDemandMaxPricePercentageOverLowestPrice: jsii.Number(123), RequireHibernateSupport: jsii.Boolean(false), SpotMaxPricePercentageOverLowestPrice: jsii.Number(123), TotalLocalStorageGb: &TotalLocalStorageGBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, VCpuCount: &VCpuCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, }, InstanceType: jsii.String("instanceType"), LaunchTemplateSpecification: &LaunchTemplateSpecificationProperty{ Version: jsii.String("version"), // the properties below are optional LaunchTemplateId: jsii.String("launchTemplateId"), LaunchTemplateName: jsii.String("launchTemplateName"), }, WeightedCapacity: jsii.String("weightedCapacity"), }, }, }, // the properties below are optional InstancesDistribution: &InstancesDistributionProperty{ OnDemandAllocationStrategy: jsii.String("onDemandAllocationStrategy"), OnDemandBaseCapacity: jsii.Number(123), OnDemandPercentageAboveBaseCapacity: jsii.Number(123), SpotAllocationStrategy: jsii.String("spotAllocationStrategy"), SpotInstancePools: jsii.Number(123), SpotMaxPrice: jsii.String("spotMaxPrice"), }, }, NewInstancesProtectedFromScaleIn: jsii.Boolean(false), NotificationConfigurations: []interface{}{ &NotificationConfigurationProperty{ TopicArn: jsii.String("topicArn"), // the properties below are optional NotificationTypes: []*string{ jsii.String("notificationTypes"), }, }, }, PlacementGroup: jsii.String("placementGroup"), ServiceLinkedRoleArn: jsii.String("serviceLinkedRoleArn"), Tags: []tagPropertyProperty{ &tagPropertyProperty{ Key: jsii.String("key"), PropagateAtLaunch: jsii.Boolean(false), Value: jsii.String("value"), }, }, TargetGroupArns: []*string{ jsii.String("targetGroupArns"), }, TerminationPolicies: []*string{ jsii.String("terminationPolicies"), }, VpcZoneIdentifier: []*string{ jsii.String("vpcZoneIdentifier"), }, }
type CfnAutoScalingGroup_AcceleratorCountRequestProperty ¶
type CfnAutoScalingGroup_AcceleratorCountRequestProperty struct { // The maximum value. Max *float64 `field:"optional" json:"max" yaml:"max"` // The minimum value. Min *float64 `field:"optional" json:"min" yaml:"min"` }
`AcceleratorCountRequest` is a property of the `InstanceRequirements` property of the [AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplateoverrides.html) property type that describes the minimum and maximum number of accelerators for an instance type.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" acceleratorCountRequestProperty := &AcceleratorCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }
type CfnAutoScalingGroup_AcceleratorTotalMemoryMiBRequestProperty ¶
type CfnAutoScalingGroup_AcceleratorTotalMemoryMiBRequestProperty struct { // The memory maximum in MiB. Max *float64 `field:"optional" json:"max" yaml:"max"` // The memory minimum in MiB. Min *float64 `field:"optional" json:"min" yaml:"min"` }
`AcceleratorTotalMemoryMiBRequest` is a property of the `InstanceRequirements` property of the [AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplateoverrides.html) property type that describes the minimum and maximum total memory size for the accelerators for an instance type, in MiB.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" acceleratorTotalMemoryMiBRequestProperty := &AcceleratorTotalMemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }
type CfnAutoScalingGroup_BaselineEbsBandwidthMbpsRequestProperty ¶
type CfnAutoScalingGroup_BaselineEbsBandwidthMbpsRequestProperty struct { // The maximum value in Mbps. Max *float64 `field:"optional" json:"max" yaml:"max"` // The minimum value in Mbps. Min *float64 `field:"optional" json:"min" yaml:"min"` }
`BaselineEbsBandwidthMbpsRequest` is a property of the `InstanceRequirements` property of the [AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplateoverrides.html) property type that describes the minimum and maximum baseline bandwidth performance for an instance type, in Mbps.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" baselineEbsBandwidthMbpsRequestProperty := &BaselineEbsBandwidthMbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }
type CfnAutoScalingGroup_InstanceRequirementsProperty ¶
type CfnAutoScalingGroup_InstanceRequirementsProperty struct { // The minimum and maximum number of accelerators (GPUs, FPGAs, or AWS Inferentia chips) for an instance type. // // To exclude accelerator-enabled instance types, set `Max` to `0` . // // Default: No minimum or maximum limits. AcceleratorCount interface{} `field:"optional" json:"acceleratorCount" yaml:"acceleratorCount"` // Indicates whether instance types must have accelerators by specific manufacturers. // // - For instance types with NVIDIA devices, specify `nvidia` . // - For instance types with AMD devices, specify `amd` . // - For instance types with AWS devices, specify `amazon-web-services` . // - For instance types with Xilinx devices, specify `xilinx` . // // Default: Any manufacturer. AcceleratorManufacturers *[]*string `field:"optional" json:"acceleratorManufacturers" yaml:"acceleratorManufacturers"` // Lists the accelerators that must be on an instance type. // // - For instance types with NVIDIA A100 GPUs, specify `a100` . // - For instance types with NVIDIA V100 GPUs, specify `v100` . // - For instance types with NVIDIA K80 GPUs, specify `k80` . // - For instance types with NVIDIA T4 GPUs, specify `t4` . // - For instance types with NVIDIA M60 GPUs, specify `m60` . // - For instance types with AMD Radeon Pro V520 GPUs, specify `radeon-pro-v520` . // - For instance types with Xilinx VU9P FPGAs, specify `vu9p` . // // Default: Any accelerator. AcceleratorNames *[]*string `field:"optional" json:"acceleratorNames" yaml:"acceleratorNames"` // The minimum and maximum total memory size for the accelerators on an instance type, in MiB. // // Default: No minimum or maximum limits. AcceleratorTotalMemoryMiB interface{} `field:"optional" json:"acceleratorTotalMemoryMiB" yaml:"acceleratorTotalMemoryMiB"` // Lists the accelerator types that must be on an instance type. // // - For instance types with GPU accelerators, specify `gpu` . // - For instance types with FPGA accelerators, specify `fpga` . // - For instance types with inference accelerators, specify `inference` . // // Default: Any accelerator type. AcceleratorTypes *[]*string `field:"optional" json:"acceleratorTypes" yaml:"acceleratorTypes"` // The instance types to apply your specified attributes against. // // All other instance types are ignored, even if they match your specified attributes. // // You can use strings with one or more wild cards, represented by an asterisk ( `*` ), to allow an instance type, size, or generation. The following are examples: `m5.8xlarge` , `c5*.*` , `m5a.*` , `r*` , `*3*` . // // For example, if you specify `c5*` , Amazon EC2 Auto Scaling will allow the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*` , Amazon EC2 Auto Scaling will allow all the M5a instance types, but not the M5n instance types. // // > If you specify `AllowedInstanceTypes` , you can't specify `ExcludedInstanceTypes` . // // Default: All instance types. AllowedInstanceTypes *[]*string `field:"optional" json:"allowedInstanceTypes" yaml:"allowedInstanceTypes"` // Indicates whether bare metal instance types are included, excluded, or required. // // Default: `excluded`. BareMetal *string `field:"optional" json:"bareMetal" yaml:"bareMetal"` // The minimum and maximum baseline bandwidth performance for an instance type, in Mbps. // // For more information, see [Amazon EBS–optimized instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-optimized.html) in the *Amazon EC2 User Guide for Linux Instances* . // // Default: No minimum or maximum limits. BaselineEbsBandwidthMbps interface{} `field:"optional" json:"baselineEbsBandwidthMbps" yaml:"baselineEbsBandwidthMbps"` // Indicates whether burstable performance instance types are included, excluded, or required. // // For more information, see [Burstable performance instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html) in the *Amazon EC2 User Guide for Linux Instances* . // // Default: `excluded`. BurstablePerformance *string `field:"optional" json:"burstablePerformance" yaml:"burstablePerformance"` // Lists which specific CPU manufacturers to include. // // - For instance types with Intel CPUs, specify `intel` . // - For instance types with AMD CPUs, specify `amd` . // - For instance types with AWS CPUs, specify `amazon-web-services` . // // > Don't confuse the CPU hardware manufacturer with the CPU hardware architecture. Instances will be launched with a compatible CPU architecture based on the Amazon Machine Image (AMI) that you specify in your launch template. // // Default: Any manufacturer. CpuManufacturers *[]*string `field:"optional" json:"cpuManufacturers" yaml:"cpuManufacturers"` // The instance types to exclude. // // You can use strings with one or more wild cards, represented by an asterisk ( `*` ), to exclude an instance family, type, size, or generation. The following are examples: `m5.8xlarge` , `c5*.*` , `m5a.*` , `r*` , `*3*` . // // For example, if you specify `c5*` , you are excluding the entire C5 instance family, which includes all C5a and C5n instance types. If you specify `m5a.*` , Amazon EC2 Auto Scaling will exclude all the M5a instance types, but not the M5n instance types. // // > If you specify `ExcludedInstanceTypes` , you can't specify `AllowedInstanceTypes` . // // Default: No excluded instance types. ExcludedInstanceTypes *[]*string `field:"optional" json:"excludedInstanceTypes" yaml:"excludedInstanceTypes"` // Indicates whether current or previous generation instance types are included. // // - For current generation instance types, specify `current` . The current generation includes EC2 instance types currently recommended for use. This typically includes the latest two to three generations in each instance family. For more information, see [Instance types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) in the *Amazon EC2 User Guide for Linux Instances* . // - For previous generation instance types, specify `previous` . // // Default: Any current or previous generation. InstanceGenerations *[]*string `field:"optional" json:"instanceGenerations" yaml:"instanceGenerations"` // Indicates whether instance types with instance store volumes are included, excluded, or required. // // For more information, see [Amazon EC2 instance store](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html) in the *Amazon EC2 User Guide for Linux Instances* . // // Default: `included`. LocalStorage *string `field:"optional" json:"localStorage" yaml:"localStorage"` // Indicates the type of local storage that is required. // // - For instance types with hard disk drive (HDD) storage, specify `hdd` . // - For instance types with solid state drive (SSD) storage, specify `ssd` . // // Default: Any local storage type. LocalStorageTypes *[]*string `field:"optional" json:"localStorageTypes" yaml:"localStorageTypes"` // The minimum and maximum amount of memory per vCPU for an instance type, in GiB. // // Default: No minimum or maximum limits. MemoryGiBPerVCpu interface{} `field:"optional" json:"memoryGiBPerVCpu" yaml:"memoryGiBPerVCpu"` // The minimum and maximum instance memory size for an instance type, in MiB. MemoryMiB interface{} `field:"optional" json:"memoryMiB" yaml:"memoryMiB"` // The minimum and maximum amount of network bandwidth, in gigabits per second (Gbps). // // Default: No minimum or maximum limits. NetworkBandwidthGbps interface{} `field:"optional" json:"networkBandwidthGbps" yaml:"networkBandwidthGbps"` // The minimum and maximum number of network interfaces for an instance type. // // Default: No minimum or maximum limits. NetworkInterfaceCount interface{} `field:"optional" json:"networkInterfaceCount" yaml:"networkInterfaceCount"` // The price protection threshold for On-Demand Instances. // // This is the maximum you’ll pay for an On-Demand Instance, expressed as a percentage higher than the least expensive current generation M, C, or R instance type with your specified attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price is higher than your threshold. The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage. To turn off price protection, specify a high value, such as `999999` . // // If you set `DesiredCapacityType` to `vcpu` or `memory-mib` , the price protection threshold is applied based on the per vCPU or per memory price instead of the per instance price. // // Default: `20`. OnDemandMaxPricePercentageOverLowestPrice *float64 `field:"optional" json:"onDemandMaxPricePercentageOverLowestPrice" yaml:"onDemandMaxPricePercentageOverLowestPrice"` // Indicates whether instance types must provide On-Demand Instance hibernation support. // // Default: `false`. RequireHibernateSupport interface{} `field:"optional" json:"requireHibernateSupport" yaml:"requireHibernateSupport"` // The price protection threshold for Spot Instances. // // This is the maximum you’ll pay for a Spot Instance, expressed as a percentage higher than the least expensive current generation M, C, or R instance type with your specified attributes. When Amazon EC2 Auto Scaling selects instance types with your attributes, we will exclude instance types whose price is higher than your threshold. The parameter accepts an integer, which Amazon EC2 Auto Scaling interprets as a percentage. To turn off price protection, specify a high value, such as `999999` . // // If you set `DesiredCapacityType` to `vcpu` or `memory-mib` , the price protection threshold is applied based on the per vCPU or per memory price instead of the per instance price. // // Default: `100`. SpotMaxPricePercentageOverLowestPrice *float64 `field:"optional" json:"spotMaxPricePercentageOverLowestPrice" yaml:"spotMaxPricePercentageOverLowestPrice"` // The minimum and maximum total local storage size for an instance type, in GB. // // Default: No minimum or maximum limits. TotalLocalStorageGb interface{} `field:"optional" json:"totalLocalStorageGb" yaml:"totalLocalStorageGb"` // The minimum and maximum number of vCPUs for an instance type. VCpuCount interface{} `field:"optional" json:"vCpuCount" yaml:"vCpuCount"` }
The attributes for the instance types for a mixed instances policy.
Amazon EC2 Auto Scaling uses your specified requirements to identify instance types. Then, it uses your On-Demand and Spot allocation strategies to launch instances from these instance types.
When you specify multiple attributes, you get instance types that satisfy all of the specified attributes. If you specify multiple values for an attribute, you get instance types that satisfy any of the specified values.
To limit the list of instance types from which Amazon EC2 Auto Scaling can identify matching instance types, you can use one of the following parameters, but not both in the same request:
- `AllowedInstanceTypes` - The instance types to include in the list. All other instance types are ignored, even if they match your specified attributes. - `ExcludedInstanceTypes` - The instance types to exclude from the list, even if they match your specified attributes.
> You must specify `VCpuCount` and `MemoryMiB` . All other attributes are optional. Any unspecified optional attribute is set to its default.
For an example template, see [Auto scaling template snippets](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-autoscaling.html) .
For more information, see [Creating an Auto Scaling group using attribute-based instance type selection](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-asg-instance-type-requirements.html) in the *Amazon EC2 Auto Scaling User Guide* . For help determining which instance types match your attributes before you apply them to your Auto Scaling group, see [Preview instance types with specified attributes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-attribute-based-instance-type-selection.html#ec2fleet-get-instance-types-from-instance-requirements) in the *Amazon EC2 User Guide for Linux Instances* .
`InstanceRequirements` is a property of the `LaunchTemplateOverrides` property of the [AWS::AutoScaling::AutoScalingGroup LaunchTemplate](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplate.html) property type.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" instanceRequirementsProperty := &InstanceRequirementsProperty{ AcceleratorCount: &AcceleratorCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, AcceleratorManufacturers: []*string{ jsii.String("acceleratorManufacturers"), }, AcceleratorNames: []*string{ jsii.String("acceleratorNames"), }, AcceleratorTotalMemoryMiB: &AcceleratorTotalMemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, AcceleratorTypes: []*string{ jsii.String("acceleratorTypes"), }, AllowedInstanceTypes: []*string{ jsii.String("allowedInstanceTypes"), }, BareMetal: jsii.String("bareMetal"), BaselineEbsBandwidthMbps: &BaselineEbsBandwidthMbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, BurstablePerformance: jsii.String("burstablePerformance"), CpuManufacturers: []*string{ jsii.String("cpuManufacturers"), }, ExcludedInstanceTypes: []*string{ jsii.String("excludedInstanceTypes"), }, InstanceGenerations: []*string{ jsii.String("instanceGenerations"), }, LocalStorage: jsii.String("localStorage"), LocalStorageTypes: []*string{ jsii.String("localStorageTypes"), }, MemoryGiBPerVCpu: &MemoryGiBPerVCpuRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, MemoryMiB: &MemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, NetworkBandwidthGbps: &NetworkBandwidthGbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, NetworkInterfaceCount: &NetworkInterfaceCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, OnDemandMaxPricePercentageOverLowestPrice: jsii.Number(123), RequireHibernateSupport: jsii.Boolean(false), SpotMaxPricePercentageOverLowestPrice: jsii.Number(123), TotalLocalStorageGb: &TotalLocalStorageGBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, VCpuCount: &VCpuCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, }
type CfnAutoScalingGroup_InstancesDistributionProperty ¶
type CfnAutoScalingGroup_InstancesDistributionProperty struct { // The allocation strategy to apply to your On-Demand Instances when they are launched. // // Possible instance types are determined by the launch template overrides that you specify. // // The following lists the valid values: // // - **lowest-price** - Uses price to determine which instance types are the highest priority, launching the lowest priced instance types within an Availability Zone first. This is the default value for Auto Scaling groups that specify `InstanceRequirements` . // - **prioritized** - You set the order of instance types for the launch template overrides from highest to lowest priority (from first to last in the list). Amazon EC2 Auto Scaling launches your highest priority instance types first. If all your On-Demand capacity cannot be fulfilled using your highest priority instance type, then Amazon EC2 Auto Scaling launches the remaining capacity using the second priority instance type, and so on. This is the default value for Auto Scaling groups that don't specify `InstanceRequirements` and cannot be used for groups that do. OnDemandAllocationStrategy *string `field:"optional" json:"onDemandAllocationStrategy" yaml:"onDemandAllocationStrategy"` // The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. // // This base portion is launched first as your group scales. // // This number has the same unit of measurement as the group's desired capacity. If you change the default unit of measurement (number of instances) by specifying weighted capacity values in your launch template overrides list, or by changing the default desired capacity type setting of the group, you must specify this number using the same unit of measurement. // // Default: 0 // // > An update to this setting means a gradual replacement of instances to adjust the current On-Demand Instance levels. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the previous ones. OnDemandBaseCapacity *float64 `field:"optional" json:"onDemandBaseCapacity" yaml:"onDemandBaseCapacity"` // Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond `OnDemandBaseCapacity` . // // Expressed as a number (for example, 20 specifies 20% On-Demand Instances, 80% Spot Instances). If set to 100, only On-Demand Instances are used. // // Default: 100 // // > An update to this setting means a gradual replacement of instances to adjust the current On-Demand and Spot Instance levels for your additional capacity higher than the base capacity. When replacing instances, Amazon EC2 Auto Scaling launches new instances before terminating the previous ones. OnDemandPercentageAboveBaseCapacity *float64 `field:"optional" json:"onDemandPercentageAboveBaseCapacity" yaml:"onDemandPercentageAboveBaseCapacity"` // The allocation strategy to apply to your Spot Instances when they are launched. // // Possible instance types are determined by the launch template overrides that you specify. // // The following lists the valid values: // // - **capacity-optimized** - Requests Spot Instances using pools that are optimally chosen based on the available Spot capacity. This strategy has the lowest risk of interruption. To give certain instance types a higher chance of launching first, use `capacity-optimized-prioritized` . // - **capacity-optimized-prioritized** - You set the order of instance types for the launch template overrides from highest to lowest priority (from first to last in the list). Amazon EC2 Auto Scaling honors the instance type priorities on a best effort basis but optimizes for capacity first. Note that if the On-Demand allocation strategy is set to `prioritized` , the same priority is applied when fulfilling On-Demand capacity. This is not a valid value for Auto Scaling groups that specify `InstanceRequirements` . // - **lowest-price** - Requests Spot Instances using the lowest priced pools within an Availability Zone, across the number of Spot pools that you specify for the `SpotInstancePools` property. To ensure that your desired capacity is met, you might receive Spot Instances from several pools. This is the default value, but it might lead to high interruption rates because this strategy only considers instance price and not available capacity. // - **price-capacity-optimized (recommended)** - The price and capacity optimized allocation strategy looks at both price and capacity to select the Spot Instance pools that are the least likely to be interrupted and have the lowest possible price. SpotAllocationStrategy *string `field:"optional" json:"spotAllocationStrategy" yaml:"spotAllocationStrategy"` // The number of Spot Instance pools across which to allocate your Spot Instances. // // The Spot pools are determined from the different instance types in the overrides. Valid only when the `SpotAllocationStrategy` is `lowest-price` . Value must be in the range of 1–20. // // Default: 2. SpotInstancePools *float64 `field:"optional" json:"spotInstancePools" yaml:"spotInstancePools"` // The maximum price per unit hour that you are willing to pay for a Spot Instance. // // If your maximum price is lower than the Spot price for the instance types that you selected, your Spot Instances are not launched. We do not recommend specifying a maximum price because it can lead to increased interruptions. When Spot Instances launch, you pay the current Spot price. To remove a maximum price that you previously set, include the property but specify an empty string ("") for the value. // // > If you specify a maximum price, your instances will be interrupted more frequently than if you do not specify one. // // Valid Range: Minimum value of 0.001 SpotMaxPrice *string `field:"optional" json:"spotMaxPrice" yaml:"spotMaxPrice"` }
Use this structure to specify the distribution of On-Demand Instances and Spot Instances and the allocation strategies used to fulfill On-Demand and Spot capacities for a mixed instances policy.
For more information, see [Auto Scaling groups with multiple instance types and purchase options](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups.html) in the *Amazon EC2 Auto Scaling User Guide* .
`InstancesDistribution` is a property of the [AWS::AutoScaling::AutoScalingGroup MixedInstancesPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-mixedinstancespolicy.html) property type.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" instancesDistributionProperty := &InstancesDistributionProperty{ OnDemandAllocationStrategy: jsii.String("onDemandAllocationStrategy"), OnDemandBaseCapacity: jsii.Number(123), OnDemandPercentageAboveBaseCapacity: jsii.Number(123), SpotAllocationStrategy: jsii.String("spotAllocationStrategy"), SpotInstancePools: jsii.Number(123), SpotMaxPrice: jsii.String("spotMaxPrice"), }
type CfnAutoScalingGroup_LaunchTemplateOverridesProperty ¶
type CfnAutoScalingGroup_LaunchTemplateOverridesProperty struct { // The instance requirements. // // Amazon EC2 Auto Scaling uses your specified requirements to identify instance types. Then, it uses your On-Demand and Spot allocation strategies to launch instances from these instance types. // // You can specify up to four separate sets of instance requirements per Auto Scaling group. This is useful for provisioning instances from different Amazon Machine Images (AMIs) in the same Auto Scaling group. To do this, create the AMIs and create a new launch template for each AMI. Then, create a compatible set of instance requirements for each launch template. // // > If you specify `InstanceRequirements` , you can't specify `InstanceType` . InstanceRequirements interface{} `field:"optional" json:"instanceRequirements" yaml:"instanceRequirements"` // The instance type, such as `m3.xlarge` . You must specify an instance type that is supported in your requested Region and Availability Zones. For more information, see [Instance types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) in the *Amazon Elastic Compute Cloud User Guide* . // // You can specify up to 40 instance types per Auto Scaling group. InstanceType *string `field:"optional" json:"instanceType" yaml:"instanceType"` // Provides a launch template for the specified instance type or set of instance requirements. // // For example, some instance types might require a launch template with a different AMI. If not provided, Amazon EC2 Auto Scaling uses the launch template that's specified in the `LaunchTemplate` definition. For more information, see [Specifying a different launch template for an instance type](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups-launch-template-overrides.html) in the *Amazon EC2 Auto Scaling User Guide* . // // You can specify up to 20 launch templates per Auto Scaling group. The launch templates specified in the overrides and in the `LaunchTemplate` definition count towards this limit. LaunchTemplateSpecification interface{} `field:"optional" json:"launchTemplateSpecification" yaml:"launchTemplateSpecification"` // If you provide a list of instance types to use, you can specify the number of capacity units provided by each instance type in terms of virtual CPUs, memory, storage, throughput, or other relative performance characteristic. // // When a Spot or On-Demand Instance is launched, the capacity units count toward the desired capacity. Amazon EC2 Auto Scaling launches instances until the desired capacity is totally fulfilled, even if this results in an overage. For example, if there are two units remaining to fulfill capacity, and Amazon EC2 Auto Scaling can only launch an instance with a `WeightedCapacity` of five units, the instance is launched, and the desired capacity is exceeded by three units. For more information, see [Configure instance weighting for Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups-instance-weighting.html) in the *Amazon EC2 Auto Scaling User Guide* . Value must be in the range of 1-999. // // If you specify a value for `WeightedCapacity` for one instance type, you must specify a value for `WeightedCapacity` for all of them. // // > Every Auto Scaling group has three size parameters ( `DesiredCapacity` , `MaxSize` , and `MinSize` ). Usually, you set these sizes based on a specific number of instances. However, if you configure a mixed instances policy that defines weights for the instance types, you must specify these sizes with the same units that you use for weighting instances. WeightedCapacity *string `field:"optional" json:"weightedCapacity" yaml:"weightedCapacity"` }
Use this structure to let Amazon EC2 Auto Scaling do the following when the Auto Scaling group has a mixed instances policy: - Override the instance type that is specified in the launch template.
- Use multiple instance types.
Specify the instance types that you want, or define your instance requirements instead and let Amazon EC2 Auto Scaling provision the available instance types that meet your requirements. This can provide Amazon EC2 Auto Scaling with a larger selection of instance types to choose from when fulfilling Spot and On-Demand capacities. You can view which instance types are matched before you apply the instance requirements to your Auto Scaling group.
After you define your instance requirements, you don't have to keep updating these settings to get new EC2 instance types automatically. Amazon EC2 Auto Scaling uses the instance requirements of the Auto Scaling group to determine whether a new EC2 instance type can be used.
`LaunchTemplateOverrides` is a property of the [AWS::AutoScaling::AutoScalingGroup LaunchTemplate](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplate.html) property type.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" launchTemplateOverridesProperty := &LaunchTemplateOverridesProperty{ InstanceRequirements: &InstanceRequirementsProperty{ AcceleratorCount: &AcceleratorCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, AcceleratorManufacturers: []*string{ jsii.String("acceleratorManufacturers"), }, AcceleratorNames: []*string{ jsii.String("acceleratorNames"), }, AcceleratorTotalMemoryMiB: &AcceleratorTotalMemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, AcceleratorTypes: []*string{ jsii.String("acceleratorTypes"), }, AllowedInstanceTypes: []*string{ jsii.String("allowedInstanceTypes"), }, BareMetal: jsii.String("bareMetal"), BaselineEbsBandwidthMbps: &BaselineEbsBandwidthMbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, BurstablePerformance: jsii.String("burstablePerformance"), CpuManufacturers: []*string{ jsii.String("cpuManufacturers"), }, ExcludedInstanceTypes: []*string{ jsii.String("excludedInstanceTypes"), }, InstanceGenerations: []*string{ jsii.String("instanceGenerations"), }, LocalStorage: jsii.String("localStorage"), LocalStorageTypes: []*string{ jsii.String("localStorageTypes"), }, MemoryGiBPerVCpu: &MemoryGiBPerVCpuRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, MemoryMiB: &MemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, NetworkBandwidthGbps: &NetworkBandwidthGbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, NetworkInterfaceCount: &NetworkInterfaceCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, OnDemandMaxPricePercentageOverLowestPrice: jsii.Number(123), RequireHibernateSupport: jsii.Boolean(false), SpotMaxPricePercentageOverLowestPrice: jsii.Number(123), TotalLocalStorageGb: &TotalLocalStorageGBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, VCpuCount: &VCpuCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, }, InstanceType: jsii.String("instanceType"), LaunchTemplateSpecification: &LaunchTemplateSpecificationProperty{ Version: jsii.String("version"), // the properties below are optional LaunchTemplateId: jsii.String("launchTemplateId"), LaunchTemplateName: jsii.String("launchTemplateName"), }, WeightedCapacity: jsii.String("weightedCapacity"), }
type CfnAutoScalingGroup_LaunchTemplateProperty ¶
type CfnAutoScalingGroup_LaunchTemplateProperty struct { // The launch template. LaunchTemplateSpecification interface{} `field:"required" json:"launchTemplateSpecification" yaml:"launchTemplateSpecification"` // Any properties that you specify override the same properties in the launch template. Overrides interface{} `field:"optional" json:"overrides" yaml:"overrides"` }
Use this structure to specify the launch templates and instance types (overrides) for a mixed instances policy.
`LaunchTemplate` is a property of the [AWS::AutoScaling::AutoScalingGroup MixedInstancesPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-mixedinstancespolicy.html) property type.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" launchTemplateProperty := &LaunchTemplateProperty{ LaunchTemplateSpecification: &LaunchTemplateSpecificationProperty{ Version: jsii.String("version"), // the properties below are optional LaunchTemplateId: jsii.String("launchTemplateId"), LaunchTemplateName: jsii.String("launchTemplateName"), }, // the properties below are optional Overrides: []interface{}{ &LaunchTemplateOverridesProperty{ InstanceRequirements: &InstanceRequirementsProperty{ AcceleratorCount: &AcceleratorCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, AcceleratorManufacturers: []*string{ jsii.String("acceleratorManufacturers"), }, AcceleratorNames: []*string{ jsii.String("acceleratorNames"), }, AcceleratorTotalMemoryMiB: &AcceleratorTotalMemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, AcceleratorTypes: []*string{ jsii.String("acceleratorTypes"), }, AllowedInstanceTypes: []*string{ jsii.String("allowedInstanceTypes"), }, BareMetal: jsii.String("bareMetal"), BaselineEbsBandwidthMbps: &BaselineEbsBandwidthMbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, BurstablePerformance: jsii.String("burstablePerformance"), CpuManufacturers: []*string{ jsii.String("cpuManufacturers"), }, ExcludedInstanceTypes: []*string{ jsii.String("excludedInstanceTypes"), }, InstanceGenerations: []*string{ jsii.String("instanceGenerations"), }, LocalStorage: jsii.String("localStorage"), LocalStorageTypes: []*string{ jsii.String("localStorageTypes"), }, MemoryGiBPerVCpu: &MemoryGiBPerVCpuRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, MemoryMiB: &MemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, NetworkBandwidthGbps: &NetworkBandwidthGbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, NetworkInterfaceCount: &NetworkInterfaceCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, OnDemandMaxPricePercentageOverLowestPrice: jsii.Number(123), RequireHibernateSupport: jsii.Boolean(false), SpotMaxPricePercentageOverLowestPrice: jsii.Number(123), TotalLocalStorageGb: &TotalLocalStorageGBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, VCpuCount: &VCpuCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, }, InstanceType: jsii.String("instanceType"), LaunchTemplateSpecification: &LaunchTemplateSpecificationProperty{ Version: jsii.String("version"), // the properties below are optional LaunchTemplateId: jsii.String("launchTemplateId"), LaunchTemplateName: jsii.String("launchTemplateName"), }, WeightedCapacity: jsii.String("weightedCapacity"), }, }, }
type CfnAutoScalingGroup_LaunchTemplateSpecificationProperty ¶
type CfnAutoScalingGroup_LaunchTemplateSpecificationProperty struct { // The version number of the launch template. // // Specifying `$Latest` or `$Default` for the template version number is not supported. However, you can specify `LatestVersionNumber` or `DefaultVersionNumber` using the `Fn::GetAtt` intrinsic function. For more information, see [Fn::GetAtt](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html) . // // > For an example of using the `Fn::GetAtt` function, see the [Examples](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#aws-properties-as-group--examples) section of the `AWS::AutoScaling::AutoScalingGroup` resource. Version *string `field:"required" json:"version" yaml:"version"` // The ID of the launch template. // // You must specify the `LaunchTemplateID` or the `LaunchTemplateName` , but not both. LaunchTemplateId *string `field:"optional" json:"launchTemplateId" yaml:"launchTemplateId"` // The name of the launch template. // // You must specify the `LaunchTemplateName` or the `LaunchTemplateID` , but not both. LaunchTemplateName *string `field:"optional" json:"launchTemplateName" yaml:"launchTemplateName"` }
Specifies a launch template to use when provisioning EC2 instances for an Auto Scaling group.
You must specify the following:
- The ID or the name of the launch template, but not both. - The version of the launch template.
`LaunchTemplateSpecification` is property of the [AWS::AutoScaling::AutoScalingGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html) resource. It is also a property of the [AWS::AutoScaling::AutoScalingGroup LaunchTemplate](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplate.html) and [AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplateoverrides.html) property types.
For information about creating a launch template, see [AWS::EC2::LaunchTemplate](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html) and [Create a launch template for an Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-template.html) in the *Amazon EC2 Auto Scaling User Guide* .
For examples of launch templates, see [Auto scaling template snippets](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-autoscaling.html) and the [Examples](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html#aws-resource-ec2-launchtemplate--examples) section in the `AWS::EC2::LaunchTemplate` resource.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" launchTemplateSpecificationProperty := &LaunchTemplateSpecificationProperty{ Version: jsii.String("version"), // the properties below are optional LaunchTemplateId: jsii.String("launchTemplateId"), LaunchTemplateName: jsii.String("launchTemplateName"), }
type CfnAutoScalingGroup_LifecycleHookSpecificationProperty ¶
type CfnAutoScalingGroup_LifecycleHookSpecificationProperty struct { // The name of the lifecycle hook. LifecycleHookName *string `field:"required" json:"lifecycleHookName" yaml:"lifecycleHookName"` // The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions. // // - To create a lifecycle hook for scale-out events, specify `autoscaling:EC2_INSTANCE_LAUNCHING` . // - To create a lifecycle hook for scale-in events, specify `autoscaling:EC2_INSTANCE_TERMINATING` . LifecycleTransition *string `field:"required" json:"lifecycleTransition" yaml:"lifecycleTransition"` // The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. // // The default value is `ABANDON` . // // Valid values: `CONTINUE` | `ABANDON`. DefaultResult *string `field:"optional" json:"defaultResult" yaml:"defaultResult"` // The maximum time, in seconds, that can elapse before the lifecycle hook times out. // // The range is from `30` to `7200` seconds. The default value is `3600` seconds (1 hour). HeartbeatTimeout *float64 `field:"optional" json:"heartbeatTimeout" yaml:"heartbeatTimeout"` // Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target. NotificationMetadata *string `field:"optional" json:"notificationMetadata" yaml:"notificationMetadata"` // The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook. // // You can specify an Amazon SNS topic or an Amazon SQS queue. NotificationTargetArn *string `field:"optional" json:"notificationTargetArn" yaml:"notificationTargetArn"` // The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. // // For information about creating this role, see [Configure a notification target for a lifecycle hook](https://docs.aws.amazon.com/autoscaling/ec2/userguide/prepare-for-lifecycle-notifications.html#lifecycle-hook-notification-target) in the *Amazon EC2 Auto Scaling User Guide* . // // Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue. RoleArn *string `field:"optional" json:"roleArn" yaml:"roleArn"` }
`LifecycleHookSpecification` specifies a lifecycle hook for the `LifecycleHookSpecificationList` property of the [AWS::AutoScaling::AutoScalingGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html) resource. A lifecycle hook specifies actions to perform when Amazon EC2 Auto Scaling launches or terminates instances.
For more information, see [Amazon EC2 Auto Scaling lifecycle hooks](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html) in the *Amazon EC2 Auto Scaling User Guide* . You can find a sample template snippet in the [Examples](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-as-lifecyclehook.html#aws-resource-as-lifecyclehook--examples) section of the `AWS::AutoScaling::LifecycleHook` resource.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" lifecycleHookSpecificationProperty := &LifecycleHookSpecificationProperty{ LifecycleHookName: jsii.String("lifecycleHookName"), LifecycleTransition: jsii.String("lifecycleTransition"), // the properties below are optional DefaultResult: jsii.String("defaultResult"), HeartbeatTimeout: jsii.Number(123), NotificationMetadata: jsii.String("notificationMetadata"), NotificationTargetArn: jsii.String("notificationTargetArn"), RoleArn: jsii.String("roleArn"), }
type CfnAutoScalingGroup_MemoryGiBPerVCpuRequestProperty ¶
type CfnAutoScalingGroup_MemoryGiBPerVCpuRequestProperty struct { // The memory maximum in GiB. Max *float64 `field:"optional" json:"max" yaml:"max"` // The memory minimum in GiB. Min *float64 `field:"optional" json:"min" yaml:"min"` }
`MemoryGiBPerVCpuRequest` is a property of the `InstanceRequirements` property of the [AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplateoverrides.html) property type that describes the minimum and maximum amount of memory per vCPU for an instance type, in GiB.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" memoryGiBPerVCpuRequestProperty := &MemoryGiBPerVCpuRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }
type CfnAutoScalingGroup_MemoryMiBRequestProperty ¶
type CfnAutoScalingGroup_MemoryMiBRequestProperty struct { // The memory maximum in MiB. Max *float64 `field:"optional" json:"max" yaml:"max"` // The memory minimum in MiB. Min *float64 `field:"optional" json:"min" yaml:"min"` }
`MemoryMiBRequest` is a property of the `InstanceRequirements` property of the [AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplateoverrides.html) property type that describes the minimum and maximum instance memory size for an instance type, in MiB.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" memoryMiBRequestProperty := &MemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }
type CfnAutoScalingGroup_MetricsCollectionProperty ¶
type CfnAutoScalingGroup_MetricsCollectionProperty struct { // The frequency at which Amazon EC2 Auto Scaling sends aggregated data to CloudWatch. // // The only valid value is `1Minute` . Granularity *string `field:"required" json:"granularity" yaml:"granularity"` // Identifies the metrics to enable. // // You can specify one or more of the following metrics: // // - `GroupMinSize` // - `GroupMaxSize` // - `GroupDesiredCapacity` // - `GroupInServiceInstances` // - `GroupPendingInstances` // - `GroupStandbyInstances` // - `GroupTerminatingInstances` // - `GroupTotalInstances` // - `GroupInServiceCapacity` // - `GroupPendingCapacity` // - `GroupStandbyCapacity` // - `GroupTerminatingCapacity` // - `GroupTotalCapacity` // - `WarmPoolDesiredCapacity` // - `WarmPoolWarmedCapacity` // - `WarmPoolPendingCapacity` // - `WarmPoolTerminatingCapacity` // - `WarmPoolTotalCapacity` // - `GroupAndWarmPoolDesiredCapacity` // - `GroupAndWarmPoolTotalCapacity` // // If you specify `Granularity` and don't specify any metrics, all metrics are enabled. // // For more information, see [Auto Scaling group metrics](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-cloudwatch-monitoring.html#as-group-metrics) in the *Amazon EC2 Auto Scaling User Guide* . Metrics *[]*string `field:"optional" json:"metrics" yaml:"metrics"` }
`MetricsCollection` is a property of the [AWS::AutoScaling::AutoScalingGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html) resource that describes the group metrics that an Amazon EC2 Auto Scaling group sends to Amazon CloudWatch. These metrics describe the group rather than any of its instances.
For more information, see [Monitor CloudWatch metrics for your Auto Scaling groups and instances](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-monitoring.html) in the *Amazon EC2 Auto Scaling User Guide* . You can find a sample template snippet in the [Examples](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#aws-properties-as-group--examples) section of the `AWS::AutoScaling::AutoScalingGroup` resource.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" metricsCollectionProperty := &MetricsCollectionProperty{ Granularity: jsii.String("granularity"), // the properties below are optional Metrics: []*string{ jsii.String("metrics"), }, }
type CfnAutoScalingGroup_MixedInstancesPolicyProperty ¶
type CfnAutoScalingGroup_MixedInstancesPolicyProperty struct { // One or more launch templates and the instance types (overrides) that are used to launch EC2 instances to fulfill On-Demand and Spot capacities. LaunchTemplate interface{} `field:"required" json:"launchTemplate" yaml:"launchTemplate"` // The instances distribution. InstancesDistribution interface{} `field:"optional" json:"instancesDistribution" yaml:"instancesDistribution"` }
Use this structure to launch multiple instance types and On-Demand Instances and Spot Instances within a single Auto Scaling group.
A mixed instances policy contains information that Amazon EC2 Auto Scaling can use to launch instances and help optimize your costs. For more information, see [Auto Scaling groups with multiple instance types and purchase options](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-mixed-instances-groups.html) in the *Amazon EC2 Auto Scaling User Guide* .
You can create a mixed instances policy for new and existing Auto Scaling groups. You must use a launch template to configure the policy. You cannot use a launch configuration.
There are key differences between Spot Instances and On-Demand Instances:
- The price for Spot Instances varies based on demand - Amazon EC2 can terminate an individual Spot Instance as the availability of, or price for, Spot Instances changes
When a Spot Instance is terminated, Amazon EC2 Auto Scaling group attempts to launch a replacement instance to maintain the desired capacity for the group.
`MixedInstancesPolicy` is a property of the [AWS::AutoScaling::AutoScalingGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html) resource.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" mixedInstancesPolicyProperty := &MixedInstancesPolicyProperty{ LaunchTemplate: &LaunchTemplateProperty{ LaunchTemplateSpecification: &LaunchTemplateSpecificationProperty{ Version: jsii.String("version"), // the properties below are optional LaunchTemplateId: jsii.String("launchTemplateId"), LaunchTemplateName: jsii.String("launchTemplateName"), }, // the properties below are optional Overrides: []interface{}{ &LaunchTemplateOverridesProperty{ InstanceRequirements: &InstanceRequirementsProperty{ AcceleratorCount: &AcceleratorCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, AcceleratorManufacturers: []*string{ jsii.String("acceleratorManufacturers"), }, AcceleratorNames: []*string{ jsii.String("acceleratorNames"), }, AcceleratorTotalMemoryMiB: &AcceleratorTotalMemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, AcceleratorTypes: []*string{ jsii.String("acceleratorTypes"), }, AllowedInstanceTypes: []*string{ jsii.String("allowedInstanceTypes"), }, BareMetal: jsii.String("bareMetal"), BaselineEbsBandwidthMbps: &BaselineEbsBandwidthMbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, BurstablePerformance: jsii.String("burstablePerformance"), CpuManufacturers: []*string{ jsii.String("cpuManufacturers"), }, ExcludedInstanceTypes: []*string{ jsii.String("excludedInstanceTypes"), }, InstanceGenerations: []*string{ jsii.String("instanceGenerations"), }, LocalStorage: jsii.String("localStorage"), LocalStorageTypes: []*string{ jsii.String("localStorageTypes"), }, MemoryGiBPerVCpu: &MemoryGiBPerVCpuRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, MemoryMiB: &MemoryMiBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, NetworkBandwidthGbps: &NetworkBandwidthGbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, NetworkInterfaceCount: &NetworkInterfaceCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, OnDemandMaxPricePercentageOverLowestPrice: jsii.Number(123), RequireHibernateSupport: jsii.Boolean(false), SpotMaxPricePercentageOverLowestPrice: jsii.Number(123), TotalLocalStorageGb: &TotalLocalStorageGBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, VCpuCount: &VCpuCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }, }, InstanceType: jsii.String("instanceType"), LaunchTemplateSpecification: &LaunchTemplateSpecificationProperty{ Version: jsii.String("version"), // the properties below are optional LaunchTemplateId: jsii.String("launchTemplateId"), LaunchTemplateName: jsii.String("launchTemplateName"), }, WeightedCapacity: jsii.String("weightedCapacity"), }, }, }, // the properties below are optional InstancesDistribution: &InstancesDistributionProperty{ OnDemandAllocationStrategy: jsii.String("onDemandAllocationStrategy"), OnDemandBaseCapacity: jsii.Number(123), OnDemandPercentageAboveBaseCapacity: jsii.Number(123), SpotAllocationStrategy: jsii.String("spotAllocationStrategy"), SpotInstancePools: jsii.Number(123), SpotMaxPrice: jsii.String("spotMaxPrice"), }, }
type CfnAutoScalingGroup_NetworkBandwidthGbpsRequestProperty ¶ added in v2.54.0
type CfnAutoScalingGroup_NetworkBandwidthGbpsRequestProperty struct { // The maximum amount of network bandwidth, in gigabits per second (Gbps). Max *float64 `field:"optional" json:"max" yaml:"max"` // The minimum amount of network bandwidth, in gigabits per second (Gbps). Min *float64 `field:"optional" json:"min" yaml:"min"` }
`NetworkBandwidthGbpsRequest` is a property of the `InstanceRequirements` property of the [AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplateoverrides.html) property type that describes the minimum and maximum network bandwidth for an instance type, in Gbps.
> Setting the minimum bandwidth does not guarantee that your instance will achieve the minimum bandwidth. Amazon EC2 will identify instance types that support the specified minimum bandwidth, but the actual bandwidth of your instance might go below the specified minimum at times. For more information, see [Available instance bandwidth](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-network-bandwidth.html#available-instance-bandwidth) in the *Amazon EC2 User Guide for Linux Instances* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" networkBandwidthGbpsRequestProperty := &NetworkBandwidthGbpsRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }
type CfnAutoScalingGroup_NetworkInterfaceCountRequestProperty ¶
type CfnAutoScalingGroup_NetworkInterfaceCountRequestProperty struct { // The maximum number of network interfaces. Max *float64 `field:"optional" json:"max" yaml:"max"` // The minimum number of network interfaces. Min *float64 `field:"optional" json:"min" yaml:"min"` }
`NetworkInterfaceCountRequest` is a property of the `InstanceRequirements` property of the [AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplateoverrides.html) property type that describes the minimum and maximum number of network interfaces for an instance type.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" networkInterfaceCountRequestProperty := &NetworkInterfaceCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }
type CfnAutoScalingGroup_NotificationConfigurationProperty ¶
type CfnAutoScalingGroup_NotificationConfigurationProperty struct { // The Amazon Resource Name (ARN) of the Amazon SNS topic. TopicArn *string `field:"required" json:"topicArn" yaml:"topicArn"` // A list of event types that send a notification. Event types can include any of the following types. // // *Allowed values* : // // - `autoscaling:EC2_INSTANCE_LAUNCH` // - `autoscaling:EC2_INSTANCE_LAUNCH_ERROR` // - `autoscaling:EC2_INSTANCE_TERMINATE` // - `autoscaling:EC2_INSTANCE_TERMINATE_ERROR` // - `autoscaling:TEST_NOTIFICATION`. NotificationTypes *[]*string `field:"optional" json:"notificationTypes" yaml:"notificationTypes"` }
A structure that specifies an Amazon SNS notification configuration for the `NotificationConfigurations` property of the [AWS::AutoScaling::AutoScalingGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html) resource.
For an example template snippet, see [Auto scaling template snippets](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-autoscaling.html) .
For more information, see [Get Amazon SNS notifications when your Auto Scaling group scales](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ASGettingNotifications.html) in the *Amazon EC2 Auto Scaling User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" notificationConfigurationProperty := &NotificationConfigurationProperty{ TopicArn: jsii.String("topicArn"), // the properties below are optional NotificationTypes: []*string{ jsii.String("notificationTypes"), }, }
type CfnAutoScalingGroup_TagPropertyProperty ¶
type CfnAutoScalingGroup_TagPropertyProperty struct { // The tag key. Key *string `field:"required" json:"key" yaml:"key"` // Set to `true` if you want CloudFormation to copy the tag to EC2 instances that are launched as part of the Auto Scaling group. // // Set to `false` if you want the tag attached only to the Auto Scaling group and not copied to any instances launched as part of the Auto Scaling group. PropagateAtLaunch interface{} `field:"required" json:"propagateAtLaunch" yaml:"propagateAtLaunch"` // The tag value. Value *string `field:"required" json:"value" yaml:"value"` }
A structure that specifies a tag for the `Tags` property of [AWS::AutoScaling::AutoScalingGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html) resource.
For more information, see [Tag Auto Scaling groups and instances](https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-tagging.html) in the *Amazon EC2 Auto Scaling User Guide* . You can find a sample template snippet in the [Examples](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#aws-properties-as-group--examples) section of the `AWS::AutoScaling::AutoScalingGroup` resource.
CloudFormation adds the following tags to all Auto Scaling groups and associated instances:
- aws:cloudformation:stack-name - aws:cloudformation:stack-id - aws:cloudformation:logical-id.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" tagPropertyProperty := &TagPropertyProperty{ Key: jsii.String("key"), PropagateAtLaunch: jsii.Boolean(false), Value: jsii.String("value"), }
type CfnAutoScalingGroup_TotalLocalStorageGBRequestProperty ¶
type CfnAutoScalingGroup_TotalLocalStorageGBRequestProperty struct { // The storage maximum in GB. Max *float64 `field:"optional" json:"max" yaml:"max"` // The storage minimum in GB. Min *float64 `field:"optional" json:"min" yaml:"min"` }
`TotalLocalStorageGBRequest` is a property of the `InstanceRequirements` property of the [AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplateoverrides.html) property type that describes the minimum and maximum total local storage size for an instance type, in GB.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" totalLocalStorageGBRequestProperty := &TotalLocalStorageGBRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }
type CfnAutoScalingGroup_VCpuCountRequestProperty ¶
type CfnAutoScalingGroup_VCpuCountRequestProperty struct { // The maximum number of vCPUs. Max *float64 `field:"optional" json:"max" yaml:"max"` // The minimum number of vCPUs. Min *float64 `field:"optional" json:"min" yaml:"min"` }
`VCpuCountRequest` is a property of the `InstanceRequirements` property of the [AWS::AutoScaling::AutoScalingGroup LaunchTemplateOverrides](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-autoscalinggroup-launchtemplateoverrides.html) property type that describes the minimum and maximum number of vCPUs for an instance type.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" vCpuCountRequestProperty := &VCpuCountRequestProperty{ Max: jsii.Number(123), Min: jsii.Number(123), }
type CfnLaunchConfiguration ¶
type CfnLaunchConfiguration interface { awscdk.CfnResource awscdk.IInspectable // Specifies whether to assign a public IPv4 address to the group's instances. // // If the instance is launched into a default subnet, the default is to assign a public IPv4 address, unless you disabled the option to assign a public IPv4 address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IPv4 address, unless you enabled the option to assign a public IPv4 address on the subnet. // // If you specify `true` , each instance in the Auto Scaling group receives a unique public IPv4 address. For more information, see [Launching Auto Scaling instances in a VPC](https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html) in the *Amazon EC2 Auto Scaling User Guide* . // // If you specify this property, you must specify at least one subnet for `VPCZoneIdentifier` when you create your group. AssociatePublicIpAddress() interface{} SetAssociatePublicIpAddress(val interface{}) // The block device mapping entries that define the block devices to attach to the instances at launch. // // By default, the block devices specified in the block device mapping for the AMI are used. For more information, see [Block device mappings](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html) in the *Amazon EC2 User Guide for Linux Instances* . BlockDeviceMappings() interface{} SetBlockDeviceMappings(val interface{}) // Options for this resource, such as condition, update policy etc. CfnOptions() awscdk.ICfnResourceOptions CfnProperties() *map[string]interface{} // AWS resource type. CfnResourceType() *string // Available for backward compatibility. ClassicLinkVpcId() *string SetClassicLinkVpcId(val *string) // Available for backward compatibility. ClassicLinkVpcSecurityGroups() *[]*string SetClassicLinkVpcSecurityGroups(val *[]*string) // Returns: the stack trace of the point where this Resource was created from, sourced // from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most // node +internal+ entries filtered. CreationStack() *[]*string // Specifies whether the launch configuration is optimized for EBS I/O ( `true` ) or not ( `false` ). // // The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional fees are incurred when you enable EBS optimization for an instance type that is not EBS-optimized by default. For more information, see [Amazon EBS-optimized instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html) in the *Amazon EC2 User Guide for Linux Instances* . // // The default value is `false` . EbsOptimized() interface{} SetEbsOptimized(val interface{}) // The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. // // The instance profile contains the IAM role. For more information, see [IAM role for applications that run on Amazon EC2 instances](https://docs.aws.amazon.com/autoscaling/ec2/userguide/us-iam-role.html) in the *Amazon EC2 Auto Scaling User Guide* . IamInstanceProfile() *string SetIamInstanceProfile(val *string) // The ID of the Amazon Machine Image (AMI) that was assigned during registration. // // For more information, see [Finding a Linux AMI](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html) in the *Amazon EC2 User Guide for Linux Instances* . // // If you specify `InstanceId` , an `ImageId` is not required. ImageId() *string SetImageId(val *string) // The ID of the Amazon EC2 instance to use to create the launch configuration. // // When you use an instance to create a launch configuration, all properties are derived from the instance with the exception of `BlockDeviceMapping` and `AssociatePublicIpAddress` . You can override any properties from the instance by specifying them in the launch configuration. InstanceId() *string SetInstanceId(val *string) // Controls whether instances in this group are launched with detailed ( `true` ) or basic ( `false` ) monitoring. // // The default value is `true` (enabled). // // > When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. For more information, see [Configure Monitoring for Auto Scaling Instances](https://docs.aws.amazon.com/autoscaling/latest/userguide/enable-as-instance-metrics.html) in the *Amazon EC2 Auto Scaling User Guide* . InstanceMonitoring() interface{} SetInstanceMonitoring(val interface{}) // Specifies the instance type of the EC2 instance. // // For information about available instance types, see [Available instance types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#AvailableInstanceTypes) in the *Amazon EC2 User Guide for Linux Instances* . // // If you specify `InstanceId` , an `InstanceType` is not required. InstanceType() *string SetInstanceType(val *string) // The ID of the kernel associated with the AMI. // // > We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see [User provided kernels](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html) in the *Amazon EC2 User Guide for Linux Instances* . KernelId() *string SetKernelId(val *string) // The name of the key pair. // // For more information, see [Amazon EC2 key pairs and Linux instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) in the *Amazon EC2 User Guide for Linux Instances* . KeyName() *string SetKeyName(val *string) // The name of the launch configuration. // // This name must be unique per Region per account. LaunchConfigurationName() *string SetLaunchConfigurationName(val *string) // The logical ID for this CloudFormation stack element. // // The logical ID of the element // is calculated from the path of the resource node in the construct tree. // // To override this value, use `overrideLogicalId(newLogicalId)`. // // Returns: the logical ID as a stringified token. This value will only get // resolved during synthesis. LogicalId() *string // The metadata options for the instances. // // For more information, see [Configuring the Instance Metadata Options](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds) in the *Amazon EC2 Auto Scaling User Guide* . MetadataOptions() interface{} SetMetadataOptions(val interface{}) // The tree node. Node() constructs.Node // The tenancy of the instance, either `default` or `dedicated` . // // An instance with `dedicated` tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC. To launch dedicated instances into a shared tenancy VPC (a VPC with the instance placement tenancy attribute set to `default` ), you must set the value of this property to `dedicated` . For more information, see [Configuring instance tenancy with Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-dedicated-instances.html) in the *Amazon EC2 Auto Scaling User Guide* . // // If you specify `PlacementTenancy` , you must specify at least one subnet for `VPCZoneIdentifier` when you create your group. // // Valid values: `default` | `dedicated`. PlacementTenancy() *string SetPlacementTenancy(val *string) // The ID of the RAM disk to select. // // > We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see [User provided kernels](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html) in the *Amazon EC2 User Guide for Linux Instances* . RamDiskId() *string SetRamDiskId(val *string) // Return a string that will be resolved to a CloudFormation `{ Ref }` for this element. // // If, by any chance, the intrinsic reference of a resource is not a string, you could // coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`. Ref() *string // A list that contains the security groups to assign to the instances in the Auto Scaling group. // // The list can contain both the IDs of existing security groups and references to [SecurityGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html) resources created in the template. // // For more information, see [Control traffic to resources using security groups](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) in the *Amazon Virtual Private Cloud User Guide* . SecurityGroups() *[]*string SetSecurityGroups(val *[]*string) // The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. // // Spot Instances are launched when the price you specify exceeds the current Spot price. For more information, see [Request Spot Instances for fault-tolerant and flexible applications](https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-template-spot-instances.html) in the *Amazon EC2 Auto Scaling User Guide* . // // Valid Range: Minimum value of 0.001 // // > When you change your maximum price by creating a new launch configuration, running instances will continue to run as long as the maximum price for those running instances is higher than the current Spot price. SpotPrice() *string SetSpotPrice(val *string) // The stack in which this element is defined. // // CfnElements must be defined within a stack scope (directly or indirectly). Stack() awscdk.Stack // Deprecated. // Deprecated: use `updatedProperties` // // Return properties modified after initiation // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperites() *map[string]interface{} // Return properties modified after initiation. // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperties() *map[string]interface{} // The Base64-encoded user data to make available to the launched EC2 instances. // // For more information, see [Instance metadata and user data](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) in the *Amazon EC2 User Guide for Linux Instances* . UserData() *string SetUserData(val *string) // Syntactic sugar for `addOverride(path, undefined)`. AddDeletionOverride(path *string) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // // This can be used for resources across stacks (or nested stack) boundaries // and the dependency will automatically be transferred to the relevant scope. AddDependency(target awscdk.CfnResource) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // Deprecated: use addDependency. AddDependsOn(target awscdk.CfnResource) // Add a value to the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // AddMetadata(key *string, value interface{}) // Adds an override to the synthesized CloudFormation resource. // // To add a // property override, either use `addPropertyOverride` or prefix `path` with // "Properties." (i.e. `Properties.TopicName`). // // If the override is nested, separate each nested level using a dot (.) in the path parameter. // If there is an array as part of the nesting, specify the index in the path. // // To include a literal `.` in the property name, prefix with a `\`. In most // programming languages you will need to write this as `"\\."` because the // `\` itself will need to be escaped. // // For example, // “`typescript // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']); // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE'); // “` // would add the overrides // “`json // "Properties": { // "GlobalSecondaryIndexes": [ // { // "Projection": { // "NonKeyAttributes": [ "myattribute" ] // ... // } // ... // }, // { // "ProjectionType": "INCLUDE" // ... // }, // ] // ... // } // “` // // The `value` argument to `addOverride` will not be processed or translated // in any way. Pass raw JSON values in here with the correct capitalization // for CloudFormation. If you pass CDK classes or structs, they will be // rendered with lowercased key names, and CloudFormation will reject the // template. AddOverride(path *string, value interface{}) // Adds an override that deletes the value of a property from the resource definition. AddPropertyDeletionOverride(propertyPath *string) // Adds an override to a resource property. // // Syntactic sugar for `addOverride("Properties.<...>", value)`. AddPropertyOverride(propertyPath *string, value interface{}) // Sets the deletion policy of the resource based on the removal policy specified. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some // cases, a snapshot can be taken of the resource prior to deletion // (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy // can be found in the following link:. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options // ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) // Returns a token for an runtime attribute of this resource. // // Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility // in case there is no generated attribute. GetAtt(attributeName *string, typeHint awscdk.ResolutionTypeHint) awscdk.Reference // Retrieve a value value from the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // GetMetadata(key *string) interface{} // Examines the CloudFormation resource and discloses attributes. Inspect(inspector awscdk.TreeInspector) // Retrieves an array of resources this resource depends on. // // This assembles dependencies on resources across stacks (including nested stacks) // automatically. ObtainDependencies() *[]interface{} // Get a shallow copy of dependencies between this resource and other resources in the same stack. ObtainResourceDependencies() *[]awscdk.CfnResource // Overrides the auto-generated logical ID with a specific ID. OverrideLogicalId(newLogicalId *string) // Indicates that this resource no longer depends on another resource. // // This can be used for resources across stacks (including nested stacks) // and the dependency will automatically be removed from the relevant scope. RemoveDependency(target awscdk.CfnResource) RenderProperties(props *map[string]interface{}) *map[string]interface{} // Replaces one dependency with another. ReplaceDependency(target awscdk.CfnResource, newTarget awscdk.CfnResource) // Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template. // // Returns: `true` if the resource should be included or `false` is the resource // should be omitted. ShouldSynthesize() *bool // Returns a string representation of this construct. // // Returns: a string representation of this resource. ToString() *string ValidateProperties(_properties interface{}) }
A CloudFormation `AWS::AutoScaling::LaunchConfiguration`.
The `AWS::AutoScaling::LaunchConfiguration` resource specifies the launch configuration that can be used by an Auto Scaling group to configure Amazon EC2 instances.
When you update the launch configuration for an Auto Scaling group, CloudFormation deletes that resource and creates a new launch configuration with the updated properties and a new name. Existing instances are not affected. To update existing instances when you update the `AWS::AutoScaling::LaunchConfiguration` resource, you can specify an [UpdatePolicy attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html) for the group. You can find sample update policies for rolling updates in [Auto scaling template snippets](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-autoscaling.html) .
> Amazon EC2 Auto Scaling configures instances launched as part of an Auto Scaling group using either a [launch template](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-launchtemplate.html) or a launch configuration. We strongly recommend that you do not use launch configurations. They do not provide full functionality for Amazon EC2 Auto Scaling or Amazon EC2. For more information, see [Launch configurations](https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-configurations.html) and [Migrate AWS CloudFormation stacks from launch configurations to launch templates](https://docs.aws.amazon.com/autoscaling/ec2/userguide/migrate-launch-configurations-with-cloudformation.html) in the *Amazon EC2 Auto Scaling User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" cfnLaunchConfiguration := awscdk.Aws_autoscaling.NewCfnLaunchConfiguration(this, jsii.String("MyCfnLaunchConfiguration"), &CfnLaunchConfigurationProps{ ImageId: jsii.String("imageId"), InstanceType: jsii.String("instanceType"), // the properties below are optional AssociatePublicIpAddress: jsii.Boolean(false), BlockDeviceMappings: []interface{}{ &BlockDeviceMappingProperty{ DeviceName: jsii.String("deviceName"), // the properties below are optional Ebs: &BlockDeviceProperty{ DeleteOnTermination: jsii.Boolean(false), Encrypted: jsii.Boolean(false), Iops: jsii.Number(123), SnapshotId: jsii.String("snapshotId"), Throughput: jsii.Number(123), VolumeSize: jsii.Number(123), VolumeType: jsii.String("volumeType"), }, NoDevice: jsii.Boolean(false), VirtualName: jsii.String("virtualName"), }, }, ClassicLinkVpcId: jsii.String("classicLinkVpcId"), ClassicLinkVpcSecurityGroups: []*string{ jsii.String("classicLinkVpcSecurityGroups"), }, EbsOptimized: jsii.Boolean(false), IamInstanceProfile: jsii.String("iamInstanceProfile"), InstanceId: jsii.String("instanceId"), InstanceMonitoring: jsii.Boolean(false), KernelId: jsii.String("kernelId"), KeyName: jsii.String("keyName"), LaunchConfigurationName: jsii.String("launchConfigurationName"), MetadataOptions: &MetadataOptionsProperty{ HttpEndpoint: jsii.String("httpEndpoint"), HttpPutResponseHopLimit: jsii.Number(123), HttpTokens: jsii.String("httpTokens"), }, PlacementTenancy: jsii.String("placementTenancy"), RamDiskId: jsii.String("ramDiskId"), SecurityGroups: []*string{ jsii.String("securityGroups"), }, SpotPrice: jsii.String("spotPrice"), UserData: jsii.String("userData"), })
func NewCfnLaunchConfiguration ¶
func NewCfnLaunchConfiguration(scope constructs.Construct, id *string, props *CfnLaunchConfigurationProps) CfnLaunchConfiguration
Create a new `AWS::AutoScaling::LaunchConfiguration`.
type CfnLaunchConfigurationProps ¶
type CfnLaunchConfigurationProps struct { // The ID of the Amazon Machine Image (AMI) that was assigned during registration. // // For more information, see [Finding a Linux AMI](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html) in the *Amazon EC2 User Guide for Linux Instances* . // // If you specify `InstanceId` , an `ImageId` is not required. ImageId *string `field:"required" json:"imageId" yaml:"imageId"` // Specifies the instance type of the EC2 instance. // // For information about available instance types, see [Available instance types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#AvailableInstanceTypes) in the *Amazon EC2 User Guide for Linux Instances* . // // If you specify `InstanceId` , an `InstanceType` is not required. InstanceType *string `field:"required" json:"instanceType" yaml:"instanceType"` // Specifies whether to assign a public IPv4 address to the group's instances. // // If the instance is launched into a default subnet, the default is to assign a public IPv4 address, unless you disabled the option to assign a public IPv4 address on the subnet. If the instance is launched into a nondefault subnet, the default is not to assign a public IPv4 address, unless you enabled the option to assign a public IPv4 address on the subnet. // // If you specify `true` , each instance in the Auto Scaling group receives a unique public IPv4 address. For more information, see [Launching Auto Scaling instances in a VPC](https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-in-vpc.html) in the *Amazon EC2 Auto Scaling User Guide* . // // If you specify this property, you must specify at least one subnet for `VPCZoneIdentifier` when you create your group. AssociatePublicIpAddress interface{} `field:"optional" json:"associatePublicIpAddress" yaml:"associatePublicIpAddress"` // The block device mapping entries that define the block devices to attach to the instances at launch. // // By default, the block devices specified in the block device mapping for the AMI are used. For more information, see [Block device mappings](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html) in the *Amazon EC2 User Guide for Linux Instances* . BlockDeviceMappings interface{} `field:"optional" json:"blockDeviceMappings" yaml:"blockDeviceMappings"` // Available for backward compatibility. ClassicLinkVpcId *string `field:"optional" json:"classicLinkVpcId" yaml:"classicLinkVpcId"` // Available for backward compatibility. ClassicLinkVpcSecurityGroups *[]*string `field:"optional" json:"classicLinkVpcSecurityGroups" yaml:"classicLinkVpcSecurityGroups"` // Specifies whether the launch configuration is optimized for EBS I/O ( `true` ) or not ( `false` ). // // The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional fees are incurred when you enable EBS optimization for an instance type that is not EBS-optimized by default. For more information, see [Amazon EBS-optimized instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html) in the *Amazon EC2 User Guide for Linux Instances* . // // The default value is `false` . EbsOptimized interface{} `field:"optional" json:"ebsOptimized" yaml:"ebsOptimized"` // The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance. // // The instance profile contains the IAM role. For more information, see [IAM role for applications that run on Amazon EC2 instances](https://docs.aws.amazon.com/autoscaling/ec2/userguide/us-iam-role.html) in the *Amazon EC2 Auto Scaling User Guide* . IamInstanceProfile *string `field:"optional" json:"iamInstanceProfile" yaml:"iamInstanceProfile"` // The ID of the Amazon EC2 instance to use to create the launch configuration. // // When you use an instance to create a launch configuration, all properties are derived from the instance with the exception of `BlockDeviceMapping` and `AssociatePublicIpAddress` . You can override any properties from the instance by specifying them in the launch configuration. InstanceId *string `field:"optional" json:"instanceId" yaml:"instanceId"` // Controls whether instances in this group are launched with detailed ( `true` ) or basic ( `false` ) monitoring. // // The default value is `true` (enabled). // // > When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. For more information, see [Configure Monitoring for Auto Scaling Instances](https://docs.aws.amazon.com/autoscaling/latest/userguide/enable-as-instance-metrics.html) in the *Amazon EC2 Auto Scaling User Guide* . InstanceMonitoring interface{} `field:"optional" json:"instanceMonitoring" yaml:"instanceMonitoring"` // The ID of the kernel associated with the AMI. // // > We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see [User provided kernels](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html) in the *Amazon EC2 User Guide for Linux Instances* . KernelId *string `field:"optional" json:"kernelId" yaml:"kernelId"` // The name of the key pair. // // For more information, see [Amazon EC2 key pairs and Linux instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html) in the *Amazon EC2 User Guide for Linux Instances* . KeyName *string `field:"optional" json:"keyName" yaml:"keyName"` // The name of the launch configuration. // // This name must be unique per Region per account. LaunchConfigurationName *string `field:"optional" json:"launchConfigurationName" yaml:"launchConfigurationName"` // The metadata options for the instances. // // For more information, see [Configuring the Instance Metadata Options](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds) in the *Amazon EC2 Auto Scaling User Guide* . MetadataOptions interface{} `field:"optional" json:"metadataOptions" yaml:"metadataOptions"` // The tenancy of the instance, either `default` or `dedicated` . // // An instance with `dedicated` tenancy runs on isolated, single-tenant hardware and can only be launched into a VPC. To launch dedicated instances into a shared tenancy VPC (a VPC with the instance placement tenancy attribute set to `default` ), you must set the value of this property to `dedicated` . For more information, see [Configuring instance tenancy with Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/auto-scaling-dedicated-instances.html) in the *Amazon EC2 Auto Scaling User Guide* . // // If you specify `PlacementTenancy` , you must specify at least one subnet for `VPCZoneIdentifier` when you create your group. // // Valid values: `default` | `dedicated`. PlacementTenancy *string `field:"optional" json:"placementTenancy" yaml:"placementTenancy"` // The ID of the RAM disk to select. // // > We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see [User provided kernels](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedKernels.html) in the *Amazon EC2 User Guide for Linux Instances* . RamDiskId *string `field:"optional" json:"ramDiskId" yaml:"ramDiskId"` // A list that contains the security groups to assign to the instances in the Auto Scaling group. // // The list can contain both the IDs of existing security groups and references to [SecurityGroup](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-security-group.html) resources created in the template. // // For more information, see [Control traffic to resources using security groups](https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html) in the *Amazon Virtual Private Cloud User Guide* . SecurityGroups *[]*string `field:"optional" json:"securityGroups" yaml:"securityGroups"` // The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. // // Spot Instances are launched when the price you specify exceeds the current Spot price. For more information, see [Request Spot Instances for fault-tolerant and flexible applications](https://docs.aws.amazon.com/autoscaling/ec2/userguide/launch-template-spot-instances.html) in the *Amazon EC2 Auto Scaling User Guide* . // // Valid Range: Minimum value of 0.001 // // > When you change your maximum price by creating a new launch configuration, running instances will continue to run as long as the maximum price for those running instances is higher than the current Spot price. SpotPrice *string `field:"optional" json:"spotPrice" yaml:"spotPrice"` // The Base64-encoded user data to make available to the launched EC2 instances. // // For more information, see [Instance metadata and user data](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html) in the *Amazon EC2 User Guide for Linux Instances* . UserData *string `field:"optional" json:"userData" yaml:"userData"` }
Properties for defining a `CfnLaunchConfiguration`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" cfnLaunchConfigurationProps := &CfnLaunchConfigurationProps{ ImageId: jsii.String("imageId"), InstanceType: jsii.String("instanceType"), // the properties below are optional AssociatePublicIpAddress: jsii.Boolean(false), BlockDeviceMappings: []interface{}{ &BlockDeviceMappingProperty{ DeviceName: jsii.String("deviceName"), // the properties below are optional Ebs: &BlockDeviceProperty{ DeleteOnTermination: jsii.Boolean(false), Encrypted: jsii.Boolean(false), Iops: jsii.Number(123), SnapshotId: jsii.String("snapshotId"), Throughput: jsii.Number(123), VolumeSize: jsii.Number(123), VolumeType: jsii.String("volumeType"), }, NoDevice: jsii.Boolean(false), VirtualName: jsii.String("virtualName"), }, }, ClassicLinkVpcId: jsii.String("classicLinkVpcId"), ClassicLinkVpcSecurityGroups: []*string{ jsii.String("classicLinkVpcSecurityGroups"), }, EbsOptimized: jsii.Boolean(false), IamInstanceProfile: jsii.String("iamInstanceProfile"), InstanceId: jsii.String("instanceId"), InstanceMonitoring: jsii.Boolean(false), KernelId: jsii.String("kernelId"), KeyName: jsii.String("keyName"), LaunchConfigurationName: jsii.String("launchConfigurationName"), MetadataOptions: &MetadataOptionsProperty{ HttpEndpoint: jsii.String("httpEndpoint"), HttpPutResponseHopLimit: jsii.Number(123), HttpTokens: jsii.String("httpTokens"), }, PlacementTenancy: jsii.String("placementTenancy"), RamDiskId: jsii.String("ramDiskId"), SecurityGroups: []*string{ jsii.String("securityGroups"), }, SpotPrice: jsii.String("spotPrice"), UserData: jsii.String("userData"), }
type CfnLaunchConfiguration_BlockDeviceMappingProperty ¶
type CfnLaunchConfiguration_BlockDeviceMappingProperty struct { // The device name assigned to the volume (for example, `/dev/sdh` or `xvdh` ). // // For more information, see [Device naming on Linux instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/device_naming.html) in the *Amazon EC2 User Guide for Linux Instances* . // // > To define a block device mapping, set the device name and exactly one of the following properties: `Ebs` , `NoDevice` , or `VirtualName` . DeviceName *string `field:"required" json:"deviceName" yaml:"deviceName"` // Information to attach an EBS volume to an instance at launch. Ebs interface{} `field:"optional" json:"ebs" yaml:"ebs"` // Setting this value to `true` prevents a volume that is included in the block device mapping of the AMI from being mapped to the specified device name at launch. // // If `NoDevice` is `true` for the root device, instances might fail the EC2 health check. In that case, Amazon EC2 Auto Scaling launches replacement instances. NoDevice interface{} `field:"optional" json:"noDevice" yaml:"noDevice"` // The name of the instance store volume (virtual device) to attach to an instance at launch. // // The name must be in the form ephemeral *X* where *X* is a number starting from zero (0), for example, `ephemeral0` . VirtualName *string `field:"optional" json:"virtualName" yaml:"virtualName"` }
`BlockDeviceMapping` specifies a block device mapping for the `BlockDeviceMappings` property of the [AWS::AutoScaling::LaunchConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html) resource.
Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched.
For more information, see [Example block device mapping](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html#block-device-mapping-ex) in the *Amazon EC2 User Guide for Linux Instances* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" blockDeviceMappingProperty := &BlockDeviceMappingProperty{ DeviceName: jsii.String("deviceName"), // the properties below are optional Ebs: &BlockDeviceProperty{ DeleteOnTermination: jsii.Boolean(false), Encrypted: jsii.Boolean(false), Iops: jsii.Number(123), SnapshotId: jsii.String("snapshotId"), Throughput: jsii.Number(123), VolumeSize: jsii.Number(123), VolumeType: jsii.String("volumeType"), }, NoDevice: jsii.Boolean(false), VirtualName: jsii.String("virtualName"), }
type CfnLaunchConfiguration_BlockDeviceProperty ¶
type CfnLaunchConfiguration_BlockDeviceProperty struct { // Indicates whether the volume is deleted on instance termination. // // For Amazon EC2 Auto Scaling, the default value is `true` . DeleteOnTermination interface{} `field:"optional" json:"deleteOnTermination" yaml:"deleteOnTermination"` // Specifies whether the volume should be encrypted. // // Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. For more information, see [Supported instance types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances) . If your AMI uses encrypted volumes, you can also only launch it on supported instance types. // // > If you are creating a volume from a snapshot, you cannot create an unencrypted volume from an encrypted snapshot. Also, you cannot specify a KMS key ID when using a launch configuration. // > // > If you enable encryption by default, the EBS volumes that you create are always encrypted, either using the AWS managed KMS key or a customer-managed KMS key, regardless of whether the snapshot was encrypted. // > // > For more information, see [Use AWS KMS keys to encrypt Amazon EBS volumes](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-data-protection.html#encryption) in the *Amazon EC2 Auto Scaling User Guide* . Encrypted interface{} `field:"optional" json:"encrypted" yaml:"encrypted"` // The number of input/output (I/O) operations per second (IOPS) to provision for the volume. // // For `gp3` and `io1` volumes, this represents the number of IOPS that are provisioned for the volume. For `gp2` volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting. // // The following are the supported values for each volume type: // // - `gp3` : 3,000-16,000 IOPS // - `io1` : 100-64,000 IOPS // // For `io1` volumes, we guarantee 64,000 IOPS only for [Instances built on the Nitro System](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances) . Other instance families guarantee performance up to 32,000 IOPS. // // `Iops` is supported when the volume type is `gp3` or `io1` and required only when the volume type is `io1` . (Not used with `standard` , `gp2` , `st1` , or `sc1` volumes.) Iops *float64 `field:"optional" json:"iops" yaml:"iops"` // The snapshot ID of the volume to use. // // You must specify either a `VolumeSize` or a `SnapshotId` . SnapshotId *string `field:"optional" json:"snapshotId" yaml:"snapshotId"` // The throughput (MiBps) to provision for a `gp3` volume. Throughput *float64 `field:"optional" json:"throughput" yaml:"throughput"` // The volume size, in GiBs. The following are the supported volumes sizes for each volume type:. // // - `gp2` and `gp3` : 1-16,384 // - `io1` : 4-16,384 // - `st1` and `sc1` : 125-16,384 // - `standard` : 1-1,024 // // You must specify either a `SnapshotId` or a `VolumeSize` . If you specify both `SnapshotId` and `VolumeSize` , the volume size must be equal or greater than the size of the snapshot. VolumeSize *float64 `field:"optional" json:"volumeSize" yaml:"volumeSize"` // The volume type. // // For more information, see [Amazon EBS volume types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html) in the *Amazon EC2 User Guide for Linux Instances* . // // Valid values: `standard` | `io1` | `gp2` | `st1` | `sc1` | `gp3`. VolumeType *string `field:"optional" json:"volumeType" yaml:"volumeType"` }
`BlockDevice` is a property of the `EBS` property of the [AWS::AutoScaling::LaunchConfiguration BlockDeviceMapping](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig-blockdev-mapping.html) property type that describes an Amazon EBS volume.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" blockDeviceProperty := &BlockDeviceProperty{ DeleteOnTermination: jsii.Boolean(false), Encrypted: jsii.Boolean(false), Iops: jsii.Number(123), SnapshotId: jsii.String("snapshotId"), Throughput: jsii.Number(123), VolumeSize: jsii.Number(123), VolumeType: jsii.String("volumeType"), }
type CfnLaunchConfiguration_MetadataOptionsProperty ¶
type CfnLaunchConfiguration_MetadataOptionsProperty struct { // This parameter enables or disables the HTTP metadata endpoint on your instances. // // If the parameter is not specified, the default state is `enabled` . // // > If you specify a value of `disabled` , you will not be able to access your instance metadata. HttpEndpoint *string `field:"optional" json:"httpEndpoint" yaml:"httpEndpoint"` // The desired HTTP PUT response hop limit for instance metadata requests. // // The larger the number, the further instance metadata requests can travel. // // Default: 1. HttpPutResponseHopLimit *float64 `field:"optional" json:"httpPutResponseHopLimit" yaml:"httpPutResponseHopLimit"` // The state of token usage for your instance metadata requests. // // If the parameter is not specified in the request, the default state is `optional` . // // If the state is `optional` , you can choose to retrieve instance metadata with or without a signed token header on your request. If you retrieve the IAM role credentials without a token, the version 1.0 role credentials are returned. If you retrieve the IAM role credentials using a valid signed token, the version 2.0 role credentials are returned. // // If the state is `required` , you must send a signed token header with any instance metadata retrieval requests. In this state, retrieving the IAM role credentials always returns the version 2.0 credentials; the version 1.0 credentials are not available. HttpTokens *string `field:"optional" json:"httpTokens" yaml:"httpTokens"` }
`MetadataOptions` is a property of [AWS::AutoScaling::LaunchConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-launchconfig.html) that describes metadata options for the instances.
For more information, see [Configure the instance metadata options](https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds) in the *Amazon EC2 Auto Scaling User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" metadataOptionsProperty := &MetadataOptionsProperty{ HttpEndpoint: jsii.String("httpEndpoint"), HttpPutResponseHopLimit: jsii.Number(123), HttpTokens: jsii.String("httpTokens"), }
type CfnLifecycleHook ¶
type CfnLifecycleHook interface { awscdk.CfnResource awscdk.IInspectable // The name of the Auto Scaling group. AutoScalingGroupName() *string SetAutoScalingGroupName(val *string) // Options for this resource, such as condition, update policy etc. CfnOptions() awscdk.ICfnResourceOptions CfnProperties() *map[string]interface{} // AWS resource type. CfnResourceType() *string // Returns: the stack trace of the point where this Resource was created from, sourced // from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most // node +internal+ entries filtered. CreationStack() *[]*string // The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. // // The default value is `ABANDON` . // // Valid values: `CONTINUE` | `ABANDON`. DefaultResult() *string SetDefaultResult(val *string) // The maximum time, in seconds, that can elapse before the lifecycle hook times out. // // The range is from `30` to `7200` seconds. The default value is `3600` seconds (1 hour). HeartbeatTimeout() *float64 SetHeartbeatTimeout(val *float64) // The name of the lifecycle hook. LifecycleHookName() *string SetLifecycleHookName(val *string) // The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions. // // - To create a lifecycle hook for scale-out events, specify `autoscaling:EC2_INSTANCE_LAUNCHING` . // - To create a lifecycle hook for scale-in events, specify `autoscaling:EC2_INSTANCE_TERMINATING` . LifecycleTransition() *string SetLifecycleTransition(val *string) // The logical ID for this CloudFormation stack element. // // The logical ID of the element // is calculated from the path of the resource node in the construct tree. // // To override this value, use `overrideLogicalId(newLogicalId)`. // // Returns: the logical ID as a stringified token. This value will only get // resolved during synthesis. LogicalId() *string // The tree node. Node() constructs.Node // Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target. NotificationMetadata() *string SetNotificationMetadata(val *string) // The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook. // // You can specify an Amazon SNS topic or an Amazon SQS queue. NotificationTargetArn() *string SetNotificationTargetArn(val *string) // Return a string that will be resolved to a CloudFormation `{ Ref }` for this element. // // If, by any chance, the intrinsic reference of a resource is not a string, you could // coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`. Ref() *string // The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. // // For information about creating this role, see [Configure a notification target for a lifecycle hook](https://docs.aws.amazon.com/autoscaling/ec2/userguide/prepare-for-lifecycle-notifications.html#lifecycle-hook-notification-target) in the *Amazon EC2 Auto Scaling User Guide* . // // Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue. RoleArn() *string SetRoleArn(val *string) // The stack in which this element is defined. // // CfnElements must be defined within a stack scope (directly or indirectly). Stack() awscdk.Stack // Deprecated. // Deprecated: use `updatedProperties` // // Return properties modified after initiation // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperites() *map[string]interface{} // Return properties modified after initiation. // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperties() *map[string]interface{} // Syntactic sugar for `addOverride(path, undefined)`. AddDeletionOverride(path *string) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // // This can be used for resources across stacks (or nested stack) boundaries // and the dependency will automatically be transferred to the relevant scope. AddDependency(target awscdk.CfnResource) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // Deprecated: use addDependency. AddDependsOn(target awscdk.CfnResource) // Add a value to the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // AddMetadata(key *string, value interface{}) // Adds an override to the synthesized CloudFormation resource. // // To add a // property override, either use `addPropertyOverride` or prefix `path` with // "Properties." (i.e. `Properties.TopicName`). // // If the override is nested, separate each nested level using a dot (.) in the path parameter. // If there is an array as part of the nesting, specify the index in the path. // // To include a literal `.` in the property name, prefix with a `\`. In most // programming languages you will need to write this as `"\\."` because the // `\` itself will need to be escaped. // // For example, // “`typescript // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']); // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE'); // “` // would add the overrides // “`json // "Properties": { // "GlobalSecondaryIndexes": [ // { // "Projection": { // "NonKeyAttributes": [ "myattribute" ] // ... // } // ... // }, // { // "ProjectionType": "INCLUDE" // ... // }, // ] // ... // } // “` // // The `value` argument to `addOverride` will not be processed or translated // in any way. Pass raw JSON values in here with the correct capitalization // for CloudFormation. If you pass CDK classes or structs, they will be // rendered with lowercased key names, and CloudFormation will reject the // template. AddOverride(path *string, value interface{}) // Adds an override that deletes the value of a property from the resource definition. AddPropertyDeletionOverride(propertyPath *string) // Adds an override to a resource property. // // Syntactic sugar for `addOverride("Properties.<...>", value)`. AddPropertyOverride(propertyPath *string, value interface{}) // Sets the deletion policy of the resource based on the removal policy specified. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some // cases, a snapshot can be taken of the resource prior to deletion // (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy // can be found in the following link:. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options // ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) // Returns a token for an runtime attribute of this resource. // // Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility // in case there is no generated attribute. GetAtt(attributeName *string, typeHint awscdk.ResolutionTypeHint) awscdk.Reference // Retrieve a value value from the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // GetMetadata(key *string) interface{} // Examines the CloudFormation resource and discloses attributes. Inspect(inspector awscdk.TreeInspector) // Retrieves an array of resources this resource depends on. // // This assembles dependencies on resources across stacks (including nested stacks) // automatically. ObtainDependencies() *[]interface{} // Get a shallow copy of dependencies between this resource and other resources in the same stack. ObtainResourceDependencies() *[]awscdk.CfnResource // Overrides the auto-generated logical ID with a specific ID. OverrideLogicalId(newLogicalId *string) // Indicates that this resource no longer depends on another resource. // // This can be used for resources across stacks (including nested stacks) // and the dependency will automatically be removed from the relevant scope. RemoveDependency(target awscdk.CfnResource) RenderProperties(props *map[string]interface{}) *map[string]interface{} // Replaces one dependency with another. ReplaceDependency(target awscdk.CfnResource, newTarget awscdk.CfnResource) // Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template. // // Returns: `true` if the resource should be included or `false` is the resource // should be omitted. ShouldSynthesize() *bool // Returns a string representation of this construct. // // Returns: a string representation of this resource. ToString() *string ValidateProperties(_properties interface{}) }
A CloudFormation `AWS::AutoScaling::LifecycleHook`.
The `AWS::AutoScaling::LifecycleHook` resource specifies lifecycle hooks for an Auto Scaling group. These hooks let you create solutions that are aware of events in the Auto Scaling instance lifecycle, and then perform a custom action on instances when the corresponding lifecycle event occurs. A lifecycle hook provides a specified amount of time (one hour by default) to wait for the action to complete before the instance transitions to the next state.
Use lifecycle hooks to prepare new instances for use or to delay them from being registered behind a load balancer before their configuration has been applied completely. You can also use lifecycle hooks to prepare running instances to be terminated by, for example, downloading logs or other data.
For more information, see [Amazon EC2 Auto Scaling lifecycle hooks](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html) in the *Amazon EC2 Auto Scaling User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" cfnLifecycleHook := awscdk.Aws_autoscaling.NewCfnLifecycleHook(this, jsii.String("MyCfnLifecycleHook"), &CfnLifecycleHookProps{ AutoScalingGroupName: jsii.String("autoScalingGroupName"), LifecycleTransition: jsii.String("lifecycleTransition"), // the properties below are optional DefaultResult: jsii.String("defaultResult"), HeartbeatTimeout: jsii.Number(123), LifecycleHookName: jsii.String("lifecycleHookName"), NotificationMetadata: jsii.String("notificationMetadata"), NotificationTargetArn: jsii.String("notificationTargetArn"), RoleArn: jsii.String("roleArn"), })
func NewCfnLifecycleHook ¶
func NewCfnLifecycleHook(scope constructs.Construct, id *string, props *CfnLifecycleHookProps) CfnLifecycleHook
Create a new `AWS::AutoScaling::LifecycleHook`.
type CfnLifecycleHookProps ¶
type CfnLifecycleHookProps struct { // The name of the Auto Scaling group. AutoScalingGroupName *string `field:"required" json:"autoScalingGroupName" yaml:"autoScalingGroupName"` // The lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions. // // - To create a lifecycle hook for scale-out events, specify `autoscaling:EC2_INSTANCE_LAUNCHING` . // - To create a lifecycle hook for scale-in events, specify `autoscaling:EC2_INSTANCE_TERMINATING` . LifecycleTransition *string `field:"required" json:"lifecycleTransition" yaml:"lifecycleTransition"` // The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. // // The default value is `ABANDON` . // // Valid values: `CONTINUE` | `ABANDON`. DefaultResult *string `field:"optional" json:"defaultResult" yaml:"defaultResult"` // The maximum time, in seconds, that can elapse before the lifecycle hook times out. // // The range is from `30` to `7200` seconds. The default value is `3600` seconds (1 hour). HeartbeatTimeout *float64 `field:"optional" json:"heartbeatTimeout" yaml:"heartbeatTimeout"` // The name of the lifecycle hook. LifecycleHookName *string `field:"optional" json:"lifecycleHookName" yaml:"lifecycleHookName"` // Additional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target. NotificationMetadata *string `field:"optional" json:"notificationMetadata" yaml:"notificationMetadata"` // The Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook. // // You can specify an Amazon SNS topic or an Amazon SQS queue. NotificationTargetArn *string `field:"optional" json:"notificationTargetArn" yaml:"notificationTargetArn"` // The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. // // For information about creating this role, see [Configure a notification target for a lifecycle hook](https://docs.aws.amazon.com/autoscaling/ec2/userguide/prepare-for-lifecycle-notifications.html#lifecycle-hook-notification-target) in the *Amazon EC2 Auto Scaling User Guide* . // // Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue. RoleArn *string `field:"optional" json:"roleArn" yaml:"roleArn"` }
Properties for defining a `CfnLifecycleHook`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" cfnLifecycleHookProps := &CfnLifecycleHookProps{ AutoScalingGroupName: jsii.String("autoScalingGroupName"), LifecycleTransition: jsii.String("lifecycleTransition"), // the properties below are optional DefaultResult: jsii.String("defaultResult"), HeartbeatTimeout: jsii.Number(123), LifecycleHookName: jsii.String("lifecycleHookName"), NotificationMetadata: jsii.String("notificationMetadata"), NotificationTargetArn: jsii.String("notificationTargetArn"), RoleArn: jsii.String("roleArn"), }
type CfnScalingPolicy ¶
type CfnScalingPolicy interface { awscdk.CfnResource awscdk.IInspectable // Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage). // // The valid values are `ChangeInCapacity` , `ExactCapacity` , and `PercentChangeInCapacity` . // // Required if the policy type is `StepScaling` or `SimpleScaling` . For more information, see [Scaling adjustment types](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html#as-scaling-adjustment) in the *Amazon EC2 Auto Scaling User Guide* . AdjustmentType() *string SetAdjustmentType(val *string) AttrArn() *string // Returns the name of a scaling policy. AttrPolicyName() *string // The name of the Auto Scaling group. AutoScalingGroupName() *string SetAutoScalingGroupName(val *string) // Options for this resource, such as condition, update policy etc. CfnOptions() awscdk.ICfnResourceOptions CfnProperties() *map[string]interface{} // AWS resource type. CfnResourceType() *string // A cooldown period, in seconds, that applies to a specific simple scaling policy. // // When a cooldown period is specified here, it overrides the default cooldown. // // Valid only if the policy type is `SimpleScaling` . For more information, see [Scaling cooldowns for Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html) in the *Amazon EC2 Auto Scaling User Guide* . // // Default: None. Cooldown() *string SetCooldown(val *string) // Returns: the stack trace of the point where this Resource was created from, sourced // from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most // node +internal+ entries filtered. CreationStack() *[]*string // *Not needed if the default instance warmup is defined for the group.*. // // The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. This warm-up period applies to instances launched due to a specific target tracking or step scaling policy. When a warm-up period is specified here, it overrides the default instance warmup. // // Valid only if the policy type is `TargetTrackingScaling` or `StepScaling` . // // > The default is to use the value for the default instance warmup defined for the group. If default instance warmup is null, then `EstimatedInstanceWarmup` falls back to the value of default cooldown. EstimatedInstanceWarmup() *float64 SetEstimatedInstanceWarmup(val *float64) // The logical ID for this CloudFormation stack element. // // The logical ID of the element // is calculated from the path of the resource node in the construct tree. // // To override this value, use `overrideLogicalId(newLogicalId)`. // // Returns: the logical ID as a stringified token. This value will only get // resolved during synthesis. LogicalId() *string // The aggregation type for the CloudWatch metrics. // // The valid values are `Minimum` , `Maximum` , and `Average` . If the aggregation type is null, the value is treated as `Average` . // // Valid only if the policy type is `StepScaling` . MetricAggregationType() *string SetMetricAggregationType(val *string) // The minimum value to scale by when the adjustment type is `PercentChangeInCapacity` . // // For example, suppose that you create a step scaling policy to scale out an Auto Scaling group by 25 percent and you specify a `MinAdjustmentMagnitude` of 2. If the group has 4 instances and the scaling policy is performed, 25 percent of 4 is 1. However, because you specified a `MinAdjustmentMagnitude` of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances. // // Valid only if the policy type is `StepScaling` or `SimpleScaling` . For more information, see [Scaling adjustment types](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html#as-scaling-adjustment) in the *Amazon EC2 Auto Scaling User Guide* . // // > Some Auto Scaling groups use instance weights. In this case, set the `MinAdjustmentMagnitude` to a value that is at least as large as your largest instance weight. MinAdjustmentMagnitude() *float64 SetMinAdjustmentMagnitude(val *float64) // The tree node. Node() constructs.Node // One of the following policy types:. // // - `TargetTrackingScaling` // - `StepScaling` // - `SimpleScaling` (default) // - `PredictiveScaling`. PolicyType() *string SetPolicyType(val *string) // A predictive scaling policy. Provides support for predefined and custom metrics. // // Predefined metrics include CPU utilization, network in/out, and the Application Load Balancer request count. // // Required if the policy type is `PredictiveScaling` . PredictiveScalingConfiguration() interface{} SetPredictiveScalingConfiguration(val interface{}) // Return a string that will be resolved to a CloudFormation `{ Ref }` for this element. // // If, by any chance, the intrinsic reference of a resource is not a string, you could // coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`. Ref() *string // The amount by which to scale, based on the specified adjustment type. // // A positive value adds to the current capacity while a negative number removes from the current capacity. For exact capacity, you must specify a non-negative value. // // Required if the policy type is `SimpleScaling` . (Not used with any other policy type.) ScalingAdjustment() *float64 SetScalingAdjustment(val *float64) // The stack in which this element is defined. // // CfnElements must be defined within a stack scope (directly or indirectly). Stack() awscdk.Stack // A set of adjustments that enable you to scale based on the size of the alarm breach. // // Required if the policy type is `StepScaling` . (Not used with any other policy type.) StepAdjustments() interface{} SetStepAdjustments(val interface{}) // A target tracking scaling policy. Provides support for predefined or custom metrics. // // The following predefined metrics are available: // // - `ASGAverageCPUUtilization` // - `ASGAverageNetworkIn` // - `ASGAverageNetworkOut` // - `ALBRequestCountPerTarget` // // If you specify `ALBRequestCountPerTarget` for the metric, you must specify the `ResourceLabel` property with the `PredefinedMetricSpecification` . // // Required if the policy type is `TargetTrackingScaling` . TargetTrackingConfiguration() interface{} SetTargetTrackingConfiguration(val interface{}) // Deprecated. // Deprecated: use `updatedProperties` // // Return properties modified after initiation // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperites() *map[string]interface{} // Return properties modified after initiation. // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperties() *map[string]interface{} // Syntactic sugar for `addOverride(path, undefined)`. AddDeletionOverride(path *string) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // // This can be used for resources across stacks (or nested stack) boundaries // and the dependency will automatically be transferred to the relevant scope. AddDependency(target awscdk.CfnResource) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // Deprecated: use addDependency. AddDependsOn(target awscdk.CfnResource) // Add a value to the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // AddMetadata(key *string, value interface{}) // Adds an override to the synthesized CloudFormation resource. // // To add a // property override, either use `addPropertyOverride` or prefix `path` with // "Properties." (i.e. `Properties.TopicName`). // // If the override is nested, separate each nested level using a dot (.) in the path parameter. // If there is an array as part of the nesting, specify the index in the path. // // To include a literal `.` in the property name, prefix with a `\`. In most // programming languages you will need to write this as `"\\."` because the // `\` itself will need to be escaped. // // For example, // “`typescript // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']); // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE'); // “` // would add the overrides // “`json // "Properties": { // "GlobalSecondaryIndexes": [ // { // "Projection": { // "NonKeyAttributes": [ "myattribute" ] // ... // } // ... // }, // { // "ProjectionType": "INCLUDE" // ... // }, // ] // ... // } // “` // // The `value` argument to `addOverride` will not be processed or translated // in any way. Pass raw JSON values in here with the correct capitalization // for CloudFormation. If you pass CDK classes or structs, they will be // rendered with lowercased key names, and CloudFormation will reject the // template. AddOverride(path *string, value interface{}) // Adds an override that deletes the value of a property from the resource definition. AddPropertyDeletionOverride(propertyPath *string) // Adds an override to a resource property. // // Syntactic sugar for `addOverride("Properties.<...>", value)`. AddPropertyOverride(propertyPath *string, value interface{}) // Sets the deletion policy of the resource based on the removal policy specified. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some // cases, a snapshot can be taken of the resource prior to deletion // (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy // can be found in the following link:. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options // ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) // Returns a token for an runtime attribute of this resource. // // Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility // in case there is no generated attribute. GetAtt(attributeName *string, typeHint awscdk.ResolutionTypeHint) awscdk.Reference // Retrieve a value value from the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // GetMetadata(key *string) interface{} // Examines the CloudFormation resource and discloses attributes. Inspect(inspector awscdk.TreeInspector) // Retrieves an array of resources this resource depends on. // // This assembles dependencies on resources across stacks (including nested stacks) // automatically. ObtainDependencies() *[]interface{} // Get a shallow copy of dependencies between this resource and other resources in the same stack. ObtainResourceDependencies() *[]awscdk.CfnResource // Overrides the auto-generated logical ID with a specific ID. OverrideLogicalId(newLogicalId *string) // Indicates that this resource no longer depends on another resource. // // This can be used for resources across stacks (including nested stacks) // and the dependency will automatically be removed from the relevant scope. RemoveDependency(target awscdk.CfnResource) RenderProperties(props *map[string]interface{}) *map[string]interface{} // Replaces one dependency with another. ReplaceDependency(target awscdk.CfnResource, newTarget awscdk.CfnResource) // Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template. // // Returns: `true` if the resource should be included or `false` is the resource // should be omitted. ShouldSynthesize() *bool // Returns a string representation of this construct. // // Returns: a string representation of this resource. ToString() *string ValidateProperties(_properties interface{}) }
A CloudFormation `AWS::AutoScaling::ScalingPolicy`.
The `AWS::AutoScaling::ScalingPolicy` resource specifies an Amazon EC2 Auto Scaling scaling policy so that the Auto Scaling group can scale the number of instances available for your application.
For more information about using scaling policies to scale your Auto Scaling group automatically, see [Dynamic scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scale-based-on-demand.html) and [Predictive scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-predictive-scaling.html) in the *Amazon EC2 Auto Scaling User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" cfnScalingPolicy := awscdk.Aws_autoscaling.NewCfnScalingPolicy(this, jsii.String("MyCfnScalingPolicy"), &CfnScalingPolicyProps{ AutoScalingGroupName: jsii.String("autoScalingGroupName"), // the properties below are optional AdjustmentType: jsii.String("adjustmentType"), Cooldown: jsii.String("cooldown"), EstimatedInstanceWarmup: jsii.Number(123), MetricAggregationType: jsii.String("metricAggregationType"), MinAdjustmentMagnitude: jsii.Number(123), PolicyType: jsii.String("policyType"), PredictiveScalingConfiguration: &PredictiveScalingConfigurationProperty{ MetricSpecifications: []interface{}{ &PredictiveScalingMetricSpecificationProperty{ TargetValue: jsii.Number(123), // the properties below are optional CustomizedCapacityMetricSpecification: &PredictiveScalingCustomizedCapacityMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }, CustomizedLoadMetricSpecification: &PredictiveScalingCustomizedLoadMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }, CustomizedScalingMetricSpecification: &PredictiveScalingCustomizedScalingMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }, PredefinedLoadMetricSpecification: &PredictiveScalingPredefinedLoadMetricProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, PredefinedMetricPairSpecification: &PredictiveScalingPredefinedMetricPairProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, PredefinedScalingMetricSpecification: &PredictiveScalingPredefinedScalingMetricProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, }, }, // the properties below are optional MaxCapacityBreachBehavior: jsii.String("maxCapacityBreachBehavior"), MaxCapacityBuffer: jsii.Number(123), Mode: jsii.String("mode"), SchedulingBufferTime: jsii.Number(123), }, ScalingAdjustment: jsii.Number(123), StepAdjustments: []interface{}{ &StepAdjustmentProperty{ ScalingAdjustment: jsii.Number(123), // the properties below are optional MetricIntervalLowerBound: jsii.Number(123), MetricIntervalUpperBound: jsii.Number(123), }, }, TargetTrackingConfiguration: &TargetTrackingConfigurationProperty{ TargetValue: jsii.Number(123), // the properties below are optional CustomizedMetricSpecification: &CustomizedMetricSpecificationProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), Statistic: jsii.String("statistic"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, Unit: jsii.String("unit"), }, DisableScaleIn: jsii.Boolean(false), PredefinedMetricSpecification: &PredefinedMetricSpecificationProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, }, })
func NewCfnScalingPolicy ¶
func NewCfnScalingPolicy(scope constructs.Construct, id *string, props *CfnScalingPolicyProps) CfnScalingPolicy
Create a new `AWS::AutoScaling::ScalingPolicy`.
type CfnScalingPolicyProps ¶
type CfnScalingPolicyProps struct { // The name of the Auto Scaling group. AutoScalingGroupName *string `field:"required" json:"autoScalingGroupName" yaml:"autoScalingGroupName"` // Specifies how the scaling adjustment is interpreted (for example, an absolute number or a percentage). // // The valid values are `ChangeInCapacity` , `ExactCapacity` , and `PercentChangeInCapacity` . // // Required if the policy type is `StepScaling` or `SimpleScaling` . For more information, see [Scaling adjustment types](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html#as-scaling-adjustment) in the *Amazon EC2 Auto Scaling User Guide* . AdjustmentType *string `field:"optional" json:"adjustmentType" yaml:"adjustmentType"` // A cooldown period, in seconds, that applies to a specific simple scaling policy. // // When a cooldown period is specified here, it overrides the default cooldown. // // Valid only if the policy type is `SimpleScaling` . For more information, see [Scaling cooldowns for Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/Cooldown.html) in the *Amazon EC2 Auto Scaling User Guide* . // // Default: None. Cooldown *string `field:"optional" json:"cooldown" yaml:"cooldown"` // *Not needed if the default instance warmup is defined for the group.*. // // The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. This warm-up period applies to instances launched due to a specific target tracking or step scaling policy. When a warm-up period is specified here, it overrides the default instance warmup. // // Valid only if the policy type is `TargetTrackingScaling` or `StepScaling` . // // > The default is to use the value for the default instance warmup defined for the group. If default instance warmup is null, then `EstimatedInstanceWarmup` falls back to the value of default cooldown. EstimatedInstanceWarmup *float64 `field:"optional" json:"estimatedInstanceWarmup" yaml:"estimatedInstanceWarmup"` // The aggregation type for the CloudWatch metrics. // // The valid values are `Minimum` , `Maximum` , and `Average` . If the aggregation type is null, the value is treated as `Average` . // // Valid only if the policy type is `StepScaling` . MetricAggregationType *string `field:"optional" json:"metricAggregationType" yaml:"metricAggregationType"` // The minimum value to scale by when the adjustment type is `PercentChangeInCapacity` . // // For example, suppose that you create a step scaling policy to scale out an Auto Scaling group by 25 percent and you specify a `MinAdjustmentMagnitude` of 2. If the group has 4 instances and the scaling policy is performed, 25 percent of 4 is 1. However, because you specified a `MinAdjustmentMagnitude` of 2, Amazon EC2 Auto Scaling scales out the group by 2 instances. // // Valid only if the policy type is `StepScaling` or `SimpleScaling` . For more information, see [Scaling adjustment types](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html#as-scaling-adjustment) in the *Amazon EC2 Auto Scaling User Guide* . // // > Some Auto Scaling groups use instance weights. In this case, set the `MinAdjustmentMagnitude` to a value that is at least as large as your largest instance weight. MinAdjustmentMagnitude *float64 `field:"optional" json:"minAdjustmentMagnitude" yaml:"minAdjustmentMagnitude"` // One of the following policy types:. // // - `TargetTrackingScaling` // - `StepScaling` // - `SimpleScaling` (default) // - `PredictiveScaling`. PolicyType *string `field:"optional" json:"policyType" yaml:"policyType"` // A predictive scaling policy. Provides support for predefined and custom metrics. // // Predefined metrics include CPU utilization, network in/out, and the Application Load Balancer request count. // // Required if the policy type is `PredictiveScaling` . PredictiveScalingConfiguration interface{} `field:"optional" json:"predictiveScalingConfiguration" yaml:"predictiveScalingConfiguration"` // The amount by which to scale, based on the specified adjustment type. // // A positive value adds to the current capacity while a negative number removes from the current capacity. For exact capacity, you must specify a non-negative value. // // Required if the policy type is `SimpleScaling` . (Not used with any other policy type.) ScalingAdjustment *float64 `field:"optional" json:"scalingAdjustment" yaml:"scalingAdjustment"` // A set of adjustments that enable you to scale based on the size of the alarm breach. // // Required if the policy type is `StepScaling` . (Not used with any other policy type.) StepAdjustments interface{} `field:"optional" json:"stepAdjustments" yaml:"stepAdjustments"` // A target tracking scaling policy. Provides support for predefined or custom metrics. // // The following predefined metrics are available: // // - `ASGAverageCPUUtilization` // - `ASGAverageNetworkIn` // - `ASGAverageNetworkOut` // - `ALBRequestCountPerTarget` // // If you specify `ALBRequestCountPerTarget` for the metric, you must specify the `ResourceLabel` property with the `PredefinedMetricSpecification` . // // Required if the policy type is `TargetTrackingScaling` . TargetTrackingConfiguration interface{} `field:"optional" json:"targetTrackingConfiguration" yaml:"targetTrackingConfiguration"` }
Properties for defining a `CfnScalingPolicy`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" cfnScalingPolicyProps := &CfnScalingPolicyProps{ AutoScalingGroupName: jsii.String("autoScalingGroupName"), // the properties below are optional AdjustmentType: jsii.String("adjustmentType"), Cooldown: jsii.String("cooldown"), EstimatedInstanceWarmup: jsii.Number(123), MetricAggregationType: jsii.String("metricAggregationType"), MinAdjustmentMagnitude: jsii.Number(123), PolicyType: jsii.String("policyType"), PredictiveScalingConfiguration: &PredictiveScalingConfigurationProperty{ MetricSpecifications: []interface{}{ &PredictiveScalingMetricSpecificationProperty{ TargetValue: jsii.Number(123), // the properties below are optional CustomizedCapacityMetricSpecification: &PredictiveScalingCustomizedCapacityMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }, CustomizedLoadMetricSpecification: &PredictiveScalingCustomizedLoadMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }, CustomizedScalingMetricSpecification: &PredictiveScalingCustomizedScalingMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }, PredefinedLoadMetricSpecification: &PredictiveScalingPredefinedLoadMetricProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, PredefinedMetricPairSpecification: &PredictiveScalingPredefinedMetricPairProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, PredefinedScalingMetricSpecification: &PredictiveScalingPredefinedScalingMetricProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, }, }, // the properties below are optional MaxCapacityBreachBehavior: jsii.String("maxCapacityBreachBehavior"), MaxCapacityBuffer: jsii.Number(123), Mode: jsii.String("mode"), SchedulingBufferTime: jsii.Number(123), }, ScalingAdjustment: jsii.Number(123), StepAdjustments: []interface{}{ &StepAdjustmentProperty{ ScalingAdjustment: jsii.Number(123), // the properties below are optional MetricIntervalLowerBound: jsii.Number(123), MetricIntervalUpperBound: jsii.Number(123), }, }, TargetTrackingConfiguration: &TargetTrackingConfigurationProperty{ TargetValue: jsii.Number(123), // the properties below are optional CustomizedMetricSpecification: &CustomizedMetricSpecificationProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), Statistic: jsii.String("statistic"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, Unit: jsii.String("unit"), }, DisableScaleIn: jsii.Boolean(false), PredefinedMetricSpecification: &PredefinedMetricSpecificationProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, }, }
type CfnScalingPolicy_CustomizedMetricSpecificationProperty ¶
type CfnScalingPolicy_CustomizedMetricSpecificationProperty struct { // The name of the metric. // // To get the exact metric name, namespace, and dimensions, inspect the [Metric](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_Metric.html) object that is returned by a call to [ListMetrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_ListMetrics.html) . MetricName *string `field:"required" json:"metricName" yaml:"metricName"` // The namespace of the metric. Namespace *string `field:"required" json:"namespace" yaml:"namespace"` // The statistic of the metric. Statistic *string `field:"required" json:"statistic" yaml:"statistic"` // The dimensions of the metric. // // Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy. Dimensions interface{} `field:"optional" json:"dimensions" yaml:"dimensions"` // The unit of the metric. // // For a complete list of the units that CloudWatch supports, see the [MetricDatum](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html) data type in the *Amazon CloudWatch API Reference* . Unit *string `field:"optional" json:"unit" yaml:"unit"` }
Contains customized metric specification information for a target tracking scaling policy for Amazon EC2 Auto Scaling.
To create your customized metric specification:
- Add values for each required property from CloudWatch. You can use an existing metric, or a new metric that you create. To use your own metric, you must first publish the metric to CloudWatch. For more information, see [Publish Custom Metrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html) in the *Amazon CloudWatch User Guide* . - Choose a metric that changes proportionally with capacity. The value of the metric should increase or decrease in inverse proportion to the number of capacity units. That is, the value of the metric should decrease when capacity increases.
For more information about CloudWatch, see [Amazon CloudWatch Concepts](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html) .
`CustomizedMetricSpecification` is a property of the [AWS::AutoScaling::ScalingPolicy TargetTrackingConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-targettrackingconfiguration.html) property type.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" customizedMetricSpecificationProperty := &CustomizedMetricSpecificationProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), Statistic: jsii.String("statistic"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, Unit: jsii.String("unit"), }
type CfnScalingPolicy_MetricDataQueryProperty ¶ added in v2.17.0
type CfnScalingPolicy_MetricDataQueryProperty struct { // A short name that identifies the object's results in the response. // // This name must be unique among all `MetricDataQuery` objects specified for a single scaling policy. If you are performing math expressions on this set of data, this name represents that data and can serve as a variable in the mathematical expression. The valid characters are letters, numbers, and underscores. The first character must be a lowercase letter. Id *string `field:"required" json:"id" yaml:"id"` // The math expression to perform on the returned data, if this object is performing a math expression. // // This expression can use the `Id` of the other metrics to refer to those metrics, and can also use the `Id` of other expressions to use the result of those expressions. // // Conditional: Within each `MetricDataQuery` object, you must specify either `Expression` or `MetricStat` , but not both. Expression *string `field:"optional" json:"expression" yaml:"expression"` // A human-readable label for this metric or expression. // // This is especially useful if this is a math expression, so that you know what the value represents. Label *string `field:"optional" json:"label" yaml:"label"` // Information about the metric data to return. // // Conditional: Within each `MetricDataQuery` object, you must specify either `Expression` or `MetricStat` , but not both. MetricStat interface{} `field:"optional" json:"metricStat" yaml:"metricStat"` // Indicates whether to return the timestamps and raw data values of this metric. // // If you use any math expressions, specify `true` for this value for only the final math expression that the metric specification is based on. You must specify `false` for `ReturnData` for all the other metrics and expressions used in the metric specification. // // If you are only retrieving metrics and not performing any math expressions, do not specify anything for `ReturnData` . This sets it to its default ( `true` ). ReturnData interface{} `field:"optional" json:"returnData" yaml:"returnData"` }
The metric data to return.
Also defines whether this call is returning data for one metric only, or whether it is performing a math expression on the values of returned metric statistics to create a new time series. A time series is a series of data points, each of which is associated with a timestamp.
`MetricDataQuery` is a property of the following property types:
- [AWS::AutoScaling::ScalingPolicy PredictiveScalingCustomizedScalingMetric](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingcustomizedscalingmetric.html) - [AWS::AutoScaling::ScalingPolicy PredictiveScalingCustomizedLoadMetric](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingcustomizedloadmetric.html) - [AWS::AutoScaling::ScalingPolicy PredictiveScalingCustomizedCapacityMetric](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingcustomizedcapacitymetric.html)
Predictive scaling uses the time series data received from CloudWatch to understand how to schedule capacity based on your historical workload patterns.
You can call for a single metric or perform math expressions on multiple metrics. Any expressions used in a metric specification must eventually return a single time series.
For more information and examples, see [Advanced predictive scaling policy configurations using custom metrics](https://docs.aws.amazon.com/autoscaling/ec2/userguide/predictive-scaling-customized-metric-specification.html) in the *Amazon EC2 Auto Scaling User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" metricDataQueryProperty := &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }
type CfnScalingPolicy_MetricDimensionProperty ¶
type CfnScalingPolicy_MetricDimensionProperty struct { // The name of the dimension. Name *string `field:"required" json:"name" yaml:"name"` // The value of the dimension. Value *string `field:"required" json:"value" yaml:"value"` }
`MetricDimension` specifies a name/value pair that is part of the identity of a CloudWatch metric for the `Dimensions` property of the [AWS::AutoScaling::ScalingPolicy CustomizedMetricSpecification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-customizedmetricspecification.html) property type. Duplicate dimensions are not allowed.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" metricDimensionProperty := &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }
type CfnScalingPolicy_MetricProperty ¶ added in v2.17.0
type CfnScalingPolicy_MetricProperty struct { // The name of the metric. MetricName *string `field:"required" json:"metricName" yaml:"metricName"` // The namespace of the metric. // // For more information, see the table in [AWS services that publish CloudWatch metrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-services-cloudwatch-metrics.html) in the *Amazon CloudWatch User Guide* . Namespace *string `field:"required" json:"namespace" yaml:"namespace"` // The dimensions for the metric. // // For the list of available dimensions, see the AWS documentation available from the table in [AWS services that publish CloudWatch metrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/aws-services-cloudwatch-metrics.html) in the *Amazon CloudWatch User Guide* . // // Conditional: If you published your metric with dimensions, you must specify the same dimensions in your scaling policy. Dimensions interface{} `field:"optional" json:"dimensions" yaml:"dimensions"` }
Represents a specific metric.
`Metric` is a property of the [AWS::AutoScaling::ScalingPolicy MetricStat](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-metricstat.html) property type.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" metricProperty := &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }
type CfnScalingPolicy_MetricStatProperty ¶ added in v2.17.0
type CfnScalingPolicy_MetricStatProperty struct { // The CloudWatch metric to return, including the metric name, namespace, and dimensions. // // To get the exact metric name, namespace, and dimensions, inspect the [Metric](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_Metric.html) object that is returned by a call to [ListMetrics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_ListMetrics.html) . Metric interface{} `field:"required" json:"metric" yaml:"metric"` // The statistic to return. // // It can include any CloudWatch statistic or extended statistic. For a list of valid values, see the table in [Statistics](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html#Statistic) in the *Amazon CloudWatch User Guide* . // // The most commonly used metrics for predictive scaling are `Average` and `Sum` . Stat *string `field:"required" json:"stat" yaml:"stat"` // The unit to use for the returned data points. // // For a complete list of the units that CloudWatch supports, see the [MetricDatum](https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html) data type in the *Amazon CloudWatch API Reference* . Unit *string `field:"optional" json:"unit" yaml:"unit"` }
`MetricStat` is a property of the [AWS::AutoScaling::ScalingPolicy MetricDataQuery](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-metricdataquery.html) property type.
This structure defines the CloudWatch metric to return, along with the statistic, period, and unit.
For more information about the CloudWatch terminology below, see [Amazon CloudWatch concepts](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html) in the *Amazon CloudWatch User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" metricStatProperty := &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }
type CfnScalingPolicy_PredefinedMetricSpecificationProperty ¶
type CfnScalingPolicy_PredefinedMetricSpecificationProperty struct { // The metric type. The following predefined metrics are available:. // // - `ASGAverageCPUUtilization` - Average CPU utilization of the Auto Scaling group. // - `ASGAverageNetworkIn` - Average number of bytes received on all network interfaces by the Auto Scaling group. // - `ASGAverageNetworkOut` - Average number of bytes sent out on all network interfaces by the Auto Scaling group. // - `ALBRequestCountPerTarget` - Average Application Load Balancer request count per target for your Auto Scaling group. PredefinedMetricType *string `field:"required" json:"predefinedMetricType" yaml:"predefinedMetricType"` // A label that uniquely identifies a specific Application Load Balancer target group from which to determine the average request count served by your Auto Scaling group. // // You can't specify a resource label unless the target group is attached to the Auto Scaling group. // // You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is: // // `app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff` . // // Where: // // - app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN // - targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN. // // To find the ARN for an Application Load Balancer, use the [DescribeLoadBalancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) API operation. To find the ARN for the target group, use the [DescribeTargetGroups](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html) API operation. ResourceLabel *string `field:"optional" json:"resourceLabel" yaml:"resourceLabel"` }
Contains predefined metric specification information for a target tracking scaling policy for Amazon EC2 Auto Scaling.
`PredefinedMetricSpecification` is a property of the [AWS::AutoScaling::ScalingPolicy TargetTrackingConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-targettrackingconfiguration.html) property type.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" predefinedMetricSpecificationProperty := &PredefinedMetricSpecificationProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }
type CfnScalingPolicy_PredictiveScalingConfigurationProperty ¶
type CfnScalingPolicy_PredictiveScalingConfigurationProperty struct { // This structure includes the metrics and target utilization to use for predictive scaling. // // This is an array, but we currently only support a single metric specification. That is, you can specify a target value and a single metric pair, or a target value and one scaling metric and one load metric. MetricSpecifications interface{} `field:"required" json:"metricSpecifications" yaml:"metricSpecifications"` // Defines the behavior that should be applied if the forecast capacity approaches or exceeds the maximum capacity of the Auto Scaling group. // // Defaults to `HonorMaxCapacity` if not specified. // // The following are possible values: // // - `HonorMaxCapacity` - Amazon EC2 Auto Scaling cannot scale out capacity higher than the maximum capacity. The maximum capacity is enforced as a hard limit. // - `IncreaseMaxCapacity` - Amazon EC2 Auto Scaling can scale out capacity higher than the maximum capacity when the forecast capacity is close to or exceeds the maximum capacity. The upper limit is determined by the forecasted capacity and the value for `MaxCapacityBuffer` . MaxCapacityBreachBehavior *string `field:"optional" json:"maxCapacityBreachBehavior" yaml:"maxCapacityBreachBehavior"` // The size of the capacity buffer to use when the forecast capacity is close to or exceeds the maximum capacity. // // The value is specified as a percentage relative to the forecast capacity. For example, if the buffer is 10, this means a 10 percent buffer, such that if the forecast capacity is 50, and the maximum capacity is 40, then the effective maximum capacity is 55. // // If set to 0, Amazon EC2 Auto Scaling may scale capacity higher than the maximum capacity to equal but not exceed forecast capacity. // // Required if the `MaxCapacityBreachBehavior` property is set to `IncreaseMaxCapacity` , and cannot be used otherwise. MaxCapacityBuffer *float64 `field:"optional" json:"maxCapacityBuffer" yaml:"maxCapacityBuffer"` // The predictive scaling mode. // // Defaults to `ForecastOnly` if not specified. Mode *string `field:"optional" json:"mode" yaml:"mode"` // The amount of time, in seconds, by which the instance launch time can be advanced. // // For example, the forecast says to add capacity at 10:00 AM, and you choose to pre-launch instances by 5 minutes. In that case, the instances will be launched at 9:55 AM. The intention is to give resources time to be provisioned. It can take a few minutes to launch an EC2 instance. The actual amount of time required depends on several factors, such as the size of the instance and whether there are startup scripts to complete. // // The value must be less than the forecast interval duration of 3600 seconds (60 minutes). Defaults to 300 seconds if not specified. SchedulingBufferTime *float64 `field:"optional" json:"schedulingBufferTime" yaml:"schedulingBufferTime"` }
`PredictiveScalingConfiguration` is a property of the [AWS::AutoScaling::ScalingPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html) resource that specifies a predictive scaling policy for Amazon EC2 Auto Scaling.
For more information, see [Predictive scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-predictive-scaling.html) in the *Amazon EC2 Auto Scaling User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" predictiveScalingConfigurationProperty := &PredictiveScalingConfigurationProperty{ MetricSpecifications: []interface{}{ &PredictiveScalingMetricSpecificationProperty{ TargetValue: jsii.Number(123), // the properties below are optional CustomizedCapacityMetricSpecification: &PredictiveScalingCustomizedCapacityMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }, CustomizedLoadMetricSpecification: &PredictiveScalingCustomizedLoadMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }, CustomizedScalingMetricSpecification: &PredictiveScalingCustomizedScalingMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }, PredefinedLoadMetricSpecification: &PredictiveScalingPredefinedLoadMetricProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, PredefinedMetricPairSpecification: &PredictiveScalingPredefinedMetricPairProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, PredefinedScalingMetricSpecification: &PredictiveScalingPredefinedScalingMetricProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, }, }, // the properties below are optional MaxCapacityBreachBehavior: jsii.String("maxCapacityBreachBehavior"), MaxCapacityBuffer: jsii.Number(123), Mode: jsii.String("mode"), SchedulingBufferTime: jsii.Number(123), }
type CfnScalingPolicy_PredictiveScalingCustomizedCapacityMetricProperty ¶ added in v2.17.0
type CfnScalingPolicy_PredictiveScalingCustomizedCapacityMetricProperty struct { // One or more metric data queries to provide the data points for a capacity metric. // // Use multiple metric data queries only if you are performing a math expression on returned data. MetricDataQueries interface{} `field:"required" json:"metricDataQueries" yaml:"metricDataQueries"` }
Contains capacity metric information for the `CustomizedCapacityMetricSpecification` property of the [AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingmetricspecification.html) property type.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" predictiveScalingCustomizedCapacityMetricProperty := &PredictiveScalingCustomizedCapacityMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }
type CfnScalingPolicy_PredictiveScalingCustomizedLoadMetricProperty ¶ added in v2.17.0
type CfnScalingPolicy_PredictiveScalingCustomizedLoadMetricProperty struct { // One or more metric data queries to provide the data points for a load metric. // // Use multiple metric data queries only if you are performing a math expression on returned data. MetricDataQueries interface{} `field:"required" json:"metricDataQueries" yaml:"metricDataQueries"` }
Contains load metric information for the `CustomizedLoadMetricSpecification` property of the [AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingmetricspecification.html) property type.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" predictiveScalingCustomizedLoadMetricProperty := &PredictiveScalingCustomizedLoadMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }
type CfnScalingPolicy_PredictiveScalingCustomizedScalingMetricProperty ¶ added in v2.17.0
type CfnScalingPolicy_PredictiveScalingCustomizedScalingMetricProperty struct { // One or more metric data queries to provide the data points for a scaling metric. // // Use multiple metric data queries only if you are performing a math expression on returned data. MetricDataQueries interface{} `field:"required" json:"metricDataQueries" yaml:"metricDataQueries"` }
Contains scaling metric information for the `CustomizedScalingMetricSpecification` property of the [AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingmetricspecification.html) property type.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" predictiveScalingCustomizedScalingMetricProperty := &PredictiveScalingCustomizedScalingMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }
type CfnScalingPolicy_PredictiveScalingMetricSpecificationProperty ¶
type CfnScalingPolicy_PredictiveScalingMetricSpecificationProperty struct { // Specifies the target utilization. // // > Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval. TargetValue *float64 `field:"required" json:"targetValue" yaml:"targetValue"` // The customized capacity metric specification. CustomizedCapacityMetricSpecification interface{} `field:"optional" json:"customizedCapacityMetricSpecification" yaml:"customizedCapacityMetricSpecification"` // The customized load metric specification. CustomizedLoadMetricSpecification interface{} `field:"optional" json:"customizedLoadMetricSpecification" yaml:"customizedLoadMetricSpecification"` // The customized scaling metric specification. CustomizedScalingMetricSpecification interface{} `field:"optional" json:"customizedScalingMetricSpecification" yaml:"customizedScalingMetricSpecification"` // The predefined load metric specification. PredefinedLoadMetricSpecification interface{} `field:"optional" json:"predefinedLoadMetricSpecification" yaml:"predefinedLoadMetricSpecification"` // The predefined metric pair specification from which Amazon EC2 Auto Scaling determines the appropriate scaling metric and load metric to use. PredefinedMetricPairSpecification interface{} `field:"optional" json:"predefinedMetricPairSpecification" yaml:"predefinedMetricPairSpecification"` // The predefined scaling metric specification. PredefinedScalingMetricSpecification interface{} `field:"optional" json:"predefinedScalingMetricSpecification" yaml:"predefinedScalingMetricSpecification"` }
A structure that specifies a metric specification for the `MetricSpecifications` property of the [AWS::AutoScaling::ScalingPolicy PredictiveScalingConfiguration](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingconfiguration.html) property type.
You must specify either a metric pair, or a load metric and a scaling metric individually. Specifying a metric pair instead of individual metrics provides a simpler way to configure metrics for a scaling policy. You choose the metric pair, and the policy automatically knows the correct sum and average statistics to use for the load metric and the scaling metric.
Example ¶
- You create a predictive scaling policy and specify `ALBRequestCount` as the value for the metric pair and `1000.0` as the target value. For this type of metric, you must provide the metric dimension for the corresponding target group, so you also provide a resource label for the Application Load Balancer target group that is attached to your Auto Scaling group. - The number of requests the target group receives per minute provides the load metric, and the request count averaged between the members of the target group provides the scaling metric. In CloudWatch, this refers to the `RequestCount` and `RequestCountPerTarget` metrics, respectively. - For optimal use of predictive scaling, you adhere to the best practice of using a dynamic scaling policy to automatically scale between the minimum capacity and maximum capacity in response to real-time changes in resource utilization. - Amazon EC2 Auto Scaling consumes data points for the load metric over the last 14 days and creates an hourly load forecast for predictive scaling. (A minimum of 24 hours of data is required.) - After creating the load forecast, Amazon EC2 Auto Scaling determines when to reduce or increase the capacity of your Auto Scaling group in each hour of the forecast period so that the average number of requests received by each instance is as close to 1000 requests per minute as possible at all times.
For information about using custom metrics with predictive scaling, see [Advanced predictive scaling policy configurations using custom metrics](https://docs.aws.amazon.com/autoscaling/ec2/userguide/predictive-scaling-customized-metric-specification.html) in the *Amazon EC2 Auto Scaling User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" predictiveScalingMetricSpecificationProperty := &PredictiveScalingMetricSpecificationProperty{ TargetValue: jsii.Number(123), // the properties below are optional CustomizedCapacityMetricSpecification: &PredictiveScalingCustomizedCapacityMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }, CustomizedLoadMetricSpecification: &PredictiveScalingCustomizedLoadMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }, CustomizedScalingMetricSpecification: &PredictiveScalingCustomizedScalingMetricProperty{ MetricDataQueries: []interface{}{ &MetricDataQueryProperty{ Id: jsii.String("id"), // the properties below are optional Expression: jsii.String("expression"), Label: jsii.String("label"), MetricStat: &MetricStatProperty{ Metric: &MetricProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, }, Stat: jsii.String("stat"), // the properties below are optional Unit: jsii.String("unit"), }, ReturnData: jsii.Boolean(false), }, }, }, PredefinedLoadMetricSpecification: &PredictiveScalingPredefinedLoadMetricProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, PredefinedMetricPairSpecification: &PredictiveScalingPredefinedMetricPairProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, PredefinedScalingMetricSpecification: &PredictiveScalingPredefinedScalingMetricProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, }
type CfnScalingPolicy_PredictiveScalingPredefinedLoadMetricProperty ¶
type CfnScalingPolicy_PredictiveScalingPredefinedLoadMetricProperty struct { // The metric type. PredefinedMetricType *string `field:"required" json:"predefinedMetricType" yaml:"predefinedMetricType"` // A label that uniquely identifies a specific Application Load Balancer target group from which to determine the request count served by your Auto Scaling group. // // You can't specify a resource label unless the target group is attached to the Auto Scaling group. // // You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is: // // `app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff` . // // Where: // // - app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN // - targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN. // // To find the ARN for an Application Load Balancer, use the [DescribeLoadBalancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) API operation. To find the ARN for the target group, use the [DescribeTargetGroups](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html) API operation. ResourceLabel *string `field:"optional" json:"resourceLabel" yaml:"resourceLabel"` }
Contains load metric information for the `PredefinedLoadMetricSpecification` property of the [AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingmetricspecification.html) property type.
> Does not apply to policies that use a *metric pair* for the metric specification.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" predictiveScalingPredefinedLoadMetricProperty := &PredictiveScalingPredefinedLoadMetricProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }
type CfnScalingPolicy_PredictiveScalingPredefinedMetricPairProperty ¶
type CfnScalingPolicy_PredictiveScalingPredefinedMetricPairProperty struct { // Indicates which metrics to use. // // There are two different types of metrics for each metric type: one is a load metric and one is a scaling metric. For example, if the metric type is `ASGCPUUtilization` , the Auto Scaling group's total CPU metric is used as the load metric, and the average CPU metric is used for the scaling metric. PredefinedMetricType *string `field:"required" json:"predefinedMetricType" yaml:"predefinedMetricType"` // A label that uniquely identifies a specific Application Load Balancer target group from which to determine the total and average request count served by your Auto Scaling group. // // You can't specify a resource label unless the target group is attached to the Auto Scaling group. // // You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is: // // `app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff` . // // Where: // // - app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN // - targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN. // // To find the ARN for an Application Load Balancer, use the [DescribeLoadBalancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) API operation. To find the ARN for the target group, use the [DescribeTargetGroups](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html) API operation. ResourceLabel *string `field:"optional" json:"resourceLabel" yaml:"resourceLabel"` }
Contains metric pair information for the `PredefinedMetricPairSpecification` property of the [AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingmetricspecification.html) property type.
For more information, see [Predictive scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-predictive-scaling.html) in the *Amazon EC2 Auto Scaling User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" predictiveScalingPredefinedMetricPairProperty := &PredictiveScalingPredefinedMetricPairProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }
type CfnScalingPolicy_PredictiveScalingPredefinedScalingMetricProperty ¶
type CfnScalingPolicy_PredictiveScalingPredefinedScalingMetricProperty struct { // The metric type. PredefinedMetricType *string `field:"required" json:"predefinedMetricType" yaml:"predefinedMetricType"` // A label that uniquely identifies a specific Application Load Balancer target group from which to determine the average request count served by your Auto Scaling group. // // You can't specify a resource label unless the target group is attached to the Auto Scaling group. // // You create the resource label by appending the final portion of the load balancer ARN and the final portion of the target group ARN into a single value, separated by a forward slash (/). The format of the resource label is: // // `app/my-alb/778d41231b141a0f/targetgroup/my-alb-target-group/943f017f100becff` . // // Where: // // - app/<load-balancer-name>/<load-balancer-id> is the final portion of the load balancer ARN // - targetgroup/<target-group-name>/<target-group-id> is the final portion of the target group ARN. // // To find the ARN for an Application Load Balancer, use the [DescribeLoadBalancers](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) API operation. To find the ARN for the target group, use the [DescribeTargetGroups](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeTargetGroups.html) API operation. ResourceLabel *string `field:"optional" json:"resourceLabel" yaml:"resourceLabel"` }
Contains scaling metric information for the `PredefinedScalingMetricSpecification` property of the [AWS::AutoScaling::ScalingPolicy PredictiveScalingMetricSpecification](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-autoscaling-scalingpolicy-predictivescalingmetricspecification.html) property type.
> Does not apply to policies that use a *metric pair* for the metric specification.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" predictiveScalingPredefinedScalingMetricProperty := &PredictiveScalingPredefinedScalingMetricProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }
type CfnScalingPolicy_StepAdjustmentProperty ¶
type CfnScalingPolicy_StepAdjustmentProperty struct { // The amount by which to scale, based on the specified adjustment type. // // A positive value adds to the current capacity while a negative number removes from the current capacity. For exact capacity, you must specify a non-negative value. ScalingAdjustment *float64 `field:"required" json:"scalingAdjustment" yaml:"scalingAdjustment"` // The lower bound for the difference between the alarm threshold and the CloudWatch metric. // // If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity. MetricIntervalLowerBound *float64 `field:"optional" json:"metricIntervalLowerBound" yaml:"metricIntervalLowerBound"` // The upper bound for the difference between the alarm threshold and the CloudWatch metric. // // If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity. // // The upper bound must be greater than the lower bound. MetricIntervalUpperBound *float64 `field:"optional" json:"metricIntervalUpperBound" yaml:"metricIntervalUpperBound"` }
`StepAdjustment` specifies a step adjustment for the `StepAdjustments` property of the [AWS::AutoScaling::ScalingPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html) resource.
For the following examples, suppose that you have an alarm with a breach threshold of 50:
- To trigger a step adjustment when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10. - To trigger a step adjustment when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.
There are a few rules for the step adjustments for your step policy:
- The ranges of your step adjustments can't overlap or have a gap. - At most one step adjustment can have a null lower bound. If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound. - At most one step adjustment can have a null upper bound. If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound. - The upper and lower bound can't be null in the same step adjustment.
For more information, see [Step adjustments](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html#as-scaling-steps) in the *Amazon EC2 Auto Scaling User Guide* .
You can find a sample template snippet in the [Examples](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html#aws-properties-as-policy--examples) section of the `AWS::AutoScaling::ScalingPolicy` resource.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" stepAdjustmentProperty := &StepAdjustmentProperty{ ScalingAdjustment: jsii.Number(123), // the properties below are optional MetricIntervalLowerBound: jsii.Number(123), MetricIntervalUpperBound: jsii.Number(123), }
type CfnScalingPolicy_TargetTrackingConfigurationProperty ¶
type CfnScalingPolicy_TargetTrackingConfigurationProperty struct { // The target value for the metric. // // > Some metrics are based on a count instead of a percentage, such as the request count for an Application Load Balancer or the number of messages in an SQS queue. If the scaling policy specifies one of these metrics, specify the target utilization as the optimal average request or message count per instance during any one-minute interval. TargetValue *float64 `field:"required" json:"targetValue" yaml:"targetValue"` // A customized metric. // // You must specify either a predefined metric or a customized metric. CustomizedMetricSpecification interface{} `field:"optional" json:"customizedMetricSpecification" yaml:"customizedMetricSpecification"` // Indicates whether scaling in by the target tracking scaling policy is disabled. // // If scaling in is disabled, the target tracking scaling policy doesn't remove instances from the Auto Scaling group. Otherwise, the target tracking scaling policy can remove instances from the Auto Scaling group. The default is `false` . DisableScaleIn interface{} `field:"optional" json:"disableScaleIn" yaml:"disableScaleIn"` // A predefined metric. // // You must specify either a predefined metric or a customized metric. PredefinedMetricSpecification interface{} `field:"optional" json:"predefinedMetricSpecification" yaml:"predefinedMetricSpecification"` }
`TargetTrackingConfiguration` is a property of the [AWS::AutoScaling::ScalingPolicy](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-policy.html) resource that specifies a target tracking scaling policy configuration for Amazon EC2 Auto Scaling.
For more information about scaling policies, see [Dynamic scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scale-based-on-demand.html) in the *Amazon EC2 Auto Scaling User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" targetTrackingConfigurationProperty := &TargetTrackingConfigurationProperty{ TargetValue: jsii.Number(123), // the properties below are optional CustomizedMetricSpecification: &CustomizedMetricSpecificationProperty{ MetricName: jsii.String("metricName"), Namespace: jsii.String("namespace"), Statistic: jsii.String("statistic"), // the properties below are optional Dimensions: []interface{}{ &MetricDimensionProperty{ Name: jsii.String("name"), Value: jsii.String("value"), }, }, Unit: jsii.String("unit"), }, DisableScaleIn: jsii.Boolean(false), PredefinedMetricSpecification: &PredefinedMetricSpecificationProperty{ PredefinedMetricType: jsii.String("predefinedMetricType"), // the properties below are optional ResourceLabel: jsii.String("resourceLabel"), }, }
type CfnScheduledAction ¶
type CfnScheduledAction interface { awscdk.CfnResource awscdk.IInspectable // Returns the name of a scheduled action. AttrScheduledActionName() *string // The name of the Auto Scaling group. AutoScalingGroupName() *string SetAutoScalingGroupName(val *string) // Options for this resource, such as condition, update policy etc. CfnOptions() awscdk.ICfnResourceOptions CfnProperties() *map[string]interface{} // AWS resource type. CfnResourceType() *string // Returns: the stack trace of the point where this Resource was created from, sourced // from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most // node +internal+ entries filtered. CreationStack() *[]*string // The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. // // It can scale beyond this capacity if you add more scaling conditions. // // > You must specify at least one of the following properties: `MaxSize` , `MinSize` , or `DesiredCapacity` . DesiredCapacity() *float64 SetDesiredCapacity(val *float64) // The date and time for the recurring schedule to end, in UTC. // // For example, `"2021-06-01T00:00:00Z"` . EndTime() *string SetEndTime(val *string) // The logical ID for this CloudFormation stack element. // // The logical ID of the element // is calculated from the path of the resource node in the construct tree. // // To override this value, use `overrideLogicalId(newLogicalId)`. // // Returns: the logical ID as a stringified token. This value will only get // resolved during synthesis. LogicalId() *string // The maximum size of the Auto Scaling group. MaxSize() *float64 SetMaxSize(val *float64) // The minimum size of the Auto Scaling group. MinSize() *float64 SetMinSize(val *float64) // The tree node. Node() constructs.Node // The recurring schedule for this action. // // This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example, `"30 0 1 1,6,12 *"` ). For more information about this format, see [Crontab](https://docs.aws.amazon.com/http://crontab.org) . // // When `StartTime` and `EndTime` are specified with `Recurrence` , they form the boundaries of when the recurring action starts and stops. // // Cron expressions use Universal Coordinated Time (UTC) by default. Recurrence() *string SetRecurrence(val *string) // Return a string that will be resolved to a CloudFormation `{ Ref }` for this element. // // If, by any chance, the intrinsic reference of a resource is not a string, you could // coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`. Ref() *string // The stack in which this element is defined. // // CfnElements must be defined within a stack scope (directly or indirectly). Stack() awscdk.Stack // The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example, `"2021-06-01T00:00:00Z"` ). // // If you specify `Recurrence` and `StartTime` , Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence. StartTime() *string SetStartTime(val *string) // Specifies the time zone for a cron expression. // // If a time zone is not provided, UTC is used by default. // // Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as `Etc/GMT+9` or `Pacific/Tahiti` ). For more information, see [https://en.wikipedia.org/wiki/List_of_tz_database_time_zones](https://docs.aws.amazon.com/https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) . TimeZone() *string SetTimeZone(val *string) // Deprecated. // Deprecated: use `updatedProperties` // // Return properties modified after initiation // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperites() *map[string]interface{} // Return properties modified after initiation. // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperties() *map[string]interface{} // Syntactic sugar for `addOverride(path, undefined)`. AddDeletionOverride(path *string) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // // This can be used for resources across stacks (or nested stack) boundaries // and the dependency will automatically be transferred to the relevant scope. AddDependency(target awscdk.CfnResource) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // Deprecated: use addDependency. AddDependsOn(target awscdk.CfnResource) // Add a value to the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // AddMetadata(key *string, value interface{}) // Adds an override to the synthesized CloudFormation resource. // // To add a // property override, either use `addPropertyOverride` or prefix `path` with // "Properties." (i.e. `Properties.TopicName`). // // If the override is nested, separate each nested level using a dot (.) in the path parameter. // If there is an array as part of the nesting, specify the index in the path. // // To include a literal `.` in the property name, prefix with a `\`. In most // programming languages you will need to write this as `"\\."` because the // `\` itself will need to be escaped. // // For example, // “`typescript // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']); // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE'); // “` // would add the overrides // “`json // "Properties": { // "GlobalSecondaryIndexes": [ // { // "Projection": { // "NonKeyAttributes": [ "myattribute" ] // ... // } // ... // }, // { // "ProjectionType": "INCLUDE" // ... // }, // ] // ... // } // “` // // The `value` argument to `addOverride` will not be processed or translated // in any way. Pass raw JSON values in here with the correct capitalization // for CloudFormation. If you pass CDK classes or structs, they will be // rendered with lowercased key names, and CloudFormation will reject the // template. AddOverride(path *string, value interface{}) // Adds an override that deletes the value of a property from the resource definition. AddPropertyDeletionOverride(propertyPath *string) // Adds an override to a resource property. // // Syntactic sugar for `addOverride("Properties.<...>", value)`. AddPropertyOverride(propertyPath *string, value interface{}) // Sets the deletion policy of the resource based on the removal policy specified. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some // cases, a snapshot can be taken of the resource prior to deletion // (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy // can be found in the following link:. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options // ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) // Returns a token for an runtime attribute of this resource. // // Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility // in case there is no generated attribute. GetAtt(attributeName *string, typeHint awscdk.ResolutionTypeHint) awscdk.Reference // Retrieve a value value from the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // GetMetadata(key *string) interface{} // Examines the CloudFormation resource and discloses attributes. Inspect(inspector awscdk.TreeInspector) // Retrieves an array of resources this resource depends on. // // This assembles dependencies on resources across stacks (including nested stacks) // automatically. ObtainDependencies() *[]interface{} // Get a shallow copy of dependencies between this resource and other resources in the same stack. ObtainResourceDependencies() *[]awscdk.CfnResource // Overrides the auto-generated logical ID with a specific ID. OverrideLogicalId(newLogicalId *string) // Indicates that this resource no longer depends on another resource. // // This can be used for resources across stacks (including nested stacks) // and the dependency will automatically be removed from the relevant scope. RemoveDependency(target awscdk.CfnResource) RenderProperties(props *map[string]interface{}) *map[string]interface{} // Replaces one dependency with another. ReplaceDependency(target awscdk.CfnResource, newTarget awscdk.CfnResource) // Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template. // // Returns: `true` if the resource should be included or `false` is the resource // should be omitted. ShouldSynthesize() *bool // Returns a string representation of this construct. // // Returns: a string representation of this resource. ToString() *string ValidateProperties(_properties interface{}) }
A CloudFormation `AWS::AutoScaling::ScheduledAction`.
The `AWS::AutoScaling::ScheduledAction` resource specifies an Amazon EC2 Auto Scaling scheduled action so that the Auto Scaling group can change the number of instances available for your application in response to predictable load changes.
When you update a stack with an Auto Scaling group and scheduled action, CloudFormation always sets the min size, max size, and desired capacity properties of your group to the values that are defined in the `AWS::AutoScaling::AutoScalingGroup` section of your template. However, you might not want CloudFormation to do that when you have a scheduled action in effect. You can use an [UpdatePolicy attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html) to prevent CloudFormation from changing the min size, max size, or desired capacity property values during a stack update unless you modified the individual values in your template. If you have rolling updates enabled, before you can update the Auto Scaling group, you must suspend scheduled actions by specifying an [UpdatePolicy attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-updatepolicy.html) for the Auto Scaling group. You can find a sample update policy for rolling updates in [Auto scaling template snippets](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/quickref-autoscaling.html) .
For more information, see [Scheduled scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/schedule_time.html) and [Suspending and resuming scaling processes](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html) in the *Amazon EC2 Auto Scaling User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" cfnScheduledAction := awscdk.Aws_autoscaling.NewCfnScheduledAction(this, jsii.String("MyCfnScheduledAction"), &CfnScheduledActionProps{ AutoScalingGroupName: jsii.String("autoScalingGroupName"), // the properties below are optional DesiredCapacity: jsii.Number(123), EndTime: jsii.String("endTime"), MaxSize: jsii.Number(123), MinSize: jsii.Number(123), Recurrence: jsii.String("recurrence"), StartTime: jsii.String("startTime"), TimeZone: jsii.String("timeZone"), })
func NewCfnScheduledAction ¶
func NewCfnScheduledAction(scope constructs.Construct, id *string, props *CfnScheduledActionProps) CfnScheduledAction
Create a new `AWS::AutoScaling::ScheduledAction`.
type CfnScheduledActionProps ¶
type CfnScheduledActionProps struct { // The name of the Auto Scaling group. AutoScalingGroupName *string `field:"required" json:"autoScalingGroupName" yaml:"autoScalingGroupName"` // The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. // // It can scale beyond this capacity if you add more scaling conditions. // // > You must specify at least one of the following properties: `MaxSize` , `MinSize` , or `DesiredCapacity` . DesiredCapacity *float64 `field:"optional" json:"desiredCapacity" yaml:"desiredCapacity"` // The date and time for the recurring schedule to end, in UTC. // // For example, `"2021-06-01T00:00:00Z"` . EndTime *string `field:"optional" json:"endTime" yaml:"endTime"` // The maximum size of the Auto Scaling group. MaxSize *float64 `field:"optional" json:"maxSize" yaml:"maxSize"` // The minimum size of the Auto Scaling group. MinSize *float64 `field:"optional" json:"minSize" yaml:"minSize"` // The recurring schedule for this action. // // This format consists of five fields separated by white spaces: [Minute] [Hour] [Day_of_Month] [Month_of_Year] [Day_of_Week]. The value must be in quotes (for example, `"30 0 1 1,6,12 *"` ). For more information about this format, see [Crontab](https://docs.aws.amazon.com/http://crontab.org) . // // When `StartTime` and `EndTime` are specified with `Recurrence` , they form the boundaries of when the recurring action starts and stops. // // Cron expressions use Universal Coordinated Time (UTC) by default. Recurrence *string `field:"optional" json:"recurrence" yaml:"recurrence"` // The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example, `"2021-06-01T00:00:00Z"` ). // // If you specify `Recurrence` and `StartTime` , Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence. StartTime *string `field:"optional" json:"startTime" yaml:"startTime"` // Specifies the time zone for a cron expression. // // If a time zone is not provided, UTC is used by default. // // Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as `Etc/GMT+9` or `Pacific/Tahiti` ). For more information, see [https://en.wikipedia.org/wiki/List_of_tz_database_time_zones](https://docs.aws.amazon.com/https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) . TimeZone *string `field:"optional" json:"timeZone" yaml:"timeZone"` }
Properties for defining a `CfnScheduledAction`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" cfnScheduledActionProps := &CfnScheduledActionProps{ AutoScalingGroupName: jsii.String("autoScalingGroupName"), // the properties below are optional DesiredCapacity: jsii.Number(123), EndTime: jsii.String("endTime"), MaxSize: jsii.Number(123), MinSize: jsii.Number(123), Recurrence: jsii.String("recurrence"), StartTime: jsii.String("startTime"), TimeZone: jsii.String("timeZone"), }
type CfnWarmPool ¶
type CfnWarmPool interface { awscdk.CfnResource awscdk.IInspectable // The name of the Auto Scaling group. AutoScalingGroupName() *string SetAutoScalingGroupName(val *string) // Options for this resource, such as condition, update policy etc. CfnOptions() awscdk.ICfnResourceOptions CfnProperties() *map[string]interface{} // AWS resource type. CfnResourceType() *string // Returns: the stack trace of the point where this Resource was created from, sourced // from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most // node +internal+ entries filtered. CreationStack() *[]*string // 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. InstanceReusePolicy() interface{} SetInstanceReusePolicy(val interface{}) // The logical ID for this CloudFormation stack element. // // The logical ID of the element // is calculated from the path of the resource node in the construct tree. // // To override this value, use `overrideLogicalId(newLogicalId)`. // // Returns: the logical ID as a stringified token. This value will only get // resolved during synthesis. LogicalId() *string // Specifies the maximum number of instances that are allowed to be in the warm pool or in any state except `Terminated` for 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 `MaxGroupPreparedCapacity` is 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 for `MaxGroupPreparedCapacity` , Amazon EC2 Auto Scaling uses the difference between the `MaxGroupPreparedCapacity` and the desired capacity instead. // > // > The size of the warm pool is dynamic. Only when `MaxGroupPreparedCapacity` and `MinSize` are 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 for `MinSize` . To remove a value that you previously set, include the property but specify -1 for the value. MaxGroupPreparedCapacity() *float64 SetMaxGroupPreparedCapacity(val *float64) // 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. MinSize() *float64 SetMinSize(val *float64) // The tree node. Node() constructs.Node // Sets the instance state to transition to after the lifecycle actions are complete. // // Default is `Stopped` . PoolState() *string SetPoolState(val *string) // Return a string that will be resolved to a CloudFormation `{ Ref }` for this element. // // If, by any chance, the intrinsic reference of a resource is not a string, you could // coerce it to an IResolvable through `Lazy.any({ produce: resource.ref })`. Ref() *string // The stack in which this element is defined. // // CfnElements must be defined within a stack scope (directly or indirectly). Stack() awscdk.Stack // Deprecated. // Deprecated: use `updatedProperties` // // Return properties modified after initiation // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperites() *map[string]interface{} // Return properties modified after initiation. // // Resources that expose mutable properties should override this function to // collect and return the properties object for this resource. UpdatedProperties() *map[string]interface{} // Syntactic sugar for `addOverride(path, undefined)`. AddDeletionOverride(path *string) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // // This can be used for resources across stacks (or nested stack) boundaries // and the dependency will automatically be transferred to the relevant scope. AddDependency(target awscdk.CfnResource) // Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned. // Deprecated: use addDependency. AddDependsOn(target awscdk.CfnResource) // Add a value to the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // AddMetadata(key *string, value interface{}) // Adds an override to the synthesized CloudFormation resource. // // To add a // property override, either use `addPropertyOverride` or prefix `path` with // "Properties." (i.e. `Properties.TopicName`). // // If the override is nested, separate each nested level using a dot (.) in the path parameter. // If there is an array as part of the nesting, specify the index in the path. // // To include a literal `.` in the property name, prefix with a `\`. In most // programming languages you will need to write this as `"\\."` because the // `\` itself will need to be escaped. // // For example, // “`typescript // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']); // cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE'); // “` // would add the overrides // “`json // "Properties": { // "GlobalSecondaryIndexes": [ // { // "Projection": { // "NonKeyAttributes": [ "myattribute" ] // ... // } // ... // }, // { // "ProjectionType": "INCLUDE" // ... // }, // ] // ... // } // “` // // The `value` argument to `addOverride` will not be processed or translated // in any way. Pass raw JSON values in here with the correct capitalization // for CloudFormation. If you pass CDK classes or structs, they will be // rendered with lowercased key names, and CloudFormation will reject the // template. AddOverride(path *string, value interface{}) // Adds an override that deletes the value of a property from the resource definition. AddPropertyDeletionOverride(propertyPath *string) // Adds an override to a resource property. // // Syntactic sugar for `addOverride("Properties.<...>", value)`. AddPropertyOverride(propertyPath *string, value interface{}) // Sets the deletion policy of the resource based on the removal policy specified. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). In some // cases, a snapshot can be taken of the resource prior to deletion // (`RemovalPolicy.SNAPSHOT`). A list of resources that support this policy // can be found in the following link:. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options // ApplyRemovalPolicy(policy awscdk.RemovalPolicy, options *awscdk.RemovalPolicyOptions) // Returns a token for an runtime attribute of this resource. // // Ideally, use generated attribute accessors (e.g. `resource.arn`), but this can be used for future compatibility // in case there is no generated attribute. GetAtt(attributeName *string, typeHint awscdk.ResolutionTypeHint) awscdk.Reference // Retrieve a value value from the CloudFormation Resource Metadata. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html // // Note that this is a different set of metadata from CDK node metadata; this // metadata ends up in the stack template under the resource, whereas CDK // node metadata ends up in the Cloud Assembly. // GetMetadata(key *string) interface{} // Examines the CloudFormation resource and discloses attributes. Inspect(inspector awscdk.TreeInspector) // Retrieves an array of resources this resource depends on. // // This assembles dependencies on resources across stacks (including nested stacks) // automatically. ObtainDependencies() *[]interface{} // Get a shallow copy of dependencies between this resource and other resources in the same stack. ObtainResourceDependencies() *[]awscdk.CfnResource // Overrides the auto-generated logical ID with a specific ID. OverrideLogicalId(newLogicalId *string) // Indicates that this resource no longer depends on another resource. // // This can be used for resources across stacks (including nested stacks) // and the dependency will automatically be removed from the relevant scope. RemoveDependency(target awscdk.CfnResource) RenderProperties(props *map[string]interface{}) *map[string]interface{} // Replaces one dependency with another. ReplaceDependency(target awscdk.CfnResource, newTarget awscdk.CfnResource) // Can be overridden by subclasses to determine if this resource will be rendered into the cloudformation template. // // Returns: `true` if the resource should be included or `false` is the resource // should be omitted. ShouldSynthesize() *bool // Returns a string representation of this construct. // // Returns: a string representation of this resource. ToString() *string ValidateProperties(_properties interface{}) }
A CloudFormation `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](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html) in the *Amazon EC2 Auto Scaling User Guide* .
> CloudFormation supports the `UpdatePolicy` attribute for Auto Scaling groups. During an update, if `UpdatePolicy` is set to `AutoScalingRollingUpdate` , CloudFormation replaces `InService` instances 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. If `UpdatePolicy` is set to `AutoScalingReplacingUpdate` , 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 "github.com/aws/aws-cdk-go/awscdk" cfnWarmPool := awscdk.Aws_autoscaling.NewCfnWarmPool(this, jsii.String("MyCfnWarmPool"), &CfnWarmPoolProps{ AutoScalingGroupName: jsii.String("autoScalingGroupName"), // the properties below are optional InstanceReusePolicy: &InstanceReusePolicyProperty{ ReuseOnScaleIn: jsii.Boolean(false), }, MaxGroupPreparedCapacity: jsii.Number(123), MinSize: jsii.Number(123), PoolState: jsii.String("poolState"), })
func NewCfnWarmPool ¶
func NewCfnWarmPool(scope constructs.Construct, id *string, props *CfnWarmPoolProps) CfnWarmPool
Create a new `AWS::AutoScaling::WarmPool`.
type CfnWarmPoolProps ¶
type CfnWarmPoolProps struct { // The name of the Auto Scaling group. AutoScalingGroupName *string `field:"required" json:"autoScalingGroupName" yaml:"autoScalingGroupName"` // 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. InstanceReusePolicy interface{} `field:"optional" json:"instanceReusePolicy" yaml:"instanceReusePolicy"` // Specifies the maximum number of instances that are allowed to be in the warm pool or in any state except `Terminated` for 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 `MaxGroupPreparedCapacity` is 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 for `MaxGroupPreparedCapacity` , Amazon EC2 Auto Scaling uses the difference between the `MaxGroupPreparedCapacity` and the desired capacity instead. // > // > The size of the warm pool is dynamic. Only when `MaxGroupPreparedCapacity` and `MinSize` are 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 for `MinSize` . To remove a value that you previously set, include the property but specify -1 for the value. MaxGroupPreparedCapacity *float64 `field:"optional" json:"maxGroupPreparedCapacity" yaml:"maxGroupPreparedCapacity"` // 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. MinSize *float64 `field:"optional" json:"minSize" yaml:"minSize"` // Sets the instance state to transition to after the lifecycle actions are complete. // // Default is `Stopped` . PoolState *string `field:"optional" json:"poolState" yaml:"poolState"` }
Properties for defining a `CfnWarmPool`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" cfnWarmPoolProps := &CfnWarmPoolProps{ AutoScalingGroupName: jsii.String("autoScalingGroupName"), // the properties below are optional InstanceReusePolicy: &InstanceReusePolicyProperty{ ReuseOnScaleIn: jsii.Boolean(false), }, MaxGroupPreparedCapacity: jsii.Number(123), MinSize: jsii.Number(123), PoolState: jsii.String("poolState"), }
type CfnWarmPool_InstanceReusePolicyProperty ¶ added in v2.9.0
type CfnWarmPool_InstanceReusePolicyProperty struct {
// Specifies whether instances in the Auto Scaling group can be returned to the warm pool on scale in.
ReuseOnScaleIn interface{} `field:"optional" json:"reuseOnScaleIn" yaml:"reuseOnScaleIn"`
}
A structure that specifies an instance reuse policy for the `InstanceReusePolicy` property of the [AWS::AutoScaling::WarmPool](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-autoscaling-warmpool.html) resource.
For more information, see [Warm pools for Amazon EC2 Auto Scaling](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-warm-pools.html) in the *Amazon EC2 Auto Scaling User Guide* .
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" instanceReusePolicyProperty := &InstanceReusePolicyProperty{ ReuseOnScaleIn: jsii.Boolean(false), }
type CommonAutoScalingGroupProps ¶
type CommonAutoScalingGroupProps struct { // Whether the instances can initiate connections to anywhere by default. AllowAllOutbound *bool `field:"optional" json:"allowAllOutbound" yaml:"allowAllOutbound"` // Whether instances in the Auto Scaling Group should have public IP addresses associated with them. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. AssociatePublicIpAddress *bool `field:"optional" json:"associatePublicIpAddress" yaml:"associatePublicIpAddress"` // The name of the Auto Scaling group. // // This name must be unique per Region per account. AutoScalingGroupName *string `field:"optional" json:"autoScalingGroupName" yaml:"autoScalingGroupName"` // Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. // // Each instance that is launched has an associated root device volume, // either an Amazon EBS volume or an instance store volume. // You can use block device mappings to specify additional EBS volumes or // instance store volumes to attach to an instance when it is launched. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html // BlockDevices *[]*BlockDevice `field:"optional" json:"blockDevices" yaml:"blockDevices"` // Indicates whether Capacity Rebalancing is enabled. // // When you turn on Capacity Rebalancing, Amazon EC2 Auto Scaling // attempts to launch a Spot Instance whenever Amazon EC2 notifies that a Spot Instance is at an elevated risk of // interruption. After launching a new instance, it then terminates an old instance. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-capacityrebalance // CapacityRebalance *bool `field:"optional" json:"capacityRebalance" yaml:"capacityRebalance"` // Default scaling cooldown for this AutoScalingGroup. Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // The amount of time, in seconds, until a newly launched instance can contribute to the Amazon CloudWatch metrics. // // This delay lets an instance finish initializing before Amazon EC2 Auto Scaling aggregates instance metrics, // resulting in more reliable usage data. Set this value equal to the amount of time that it takes for resource // consumption to become stable after an instance reaches the InService state. // // To optimize the performance of scaling policies that scale continuously, such as target tracking and // step scaling policies, we strongly recommend that you enable the default instance warmup, even if its value is set to 0 seconds // // Default instance warmup will not be added if no value is specified. // See: https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-default-instance-warmup.html // DefaultInstanceWarmup awscdk.Duration `field:"optional" json:"defaultInstanceWarmup" yaml:"defaultInstanceWarmup"` // Initial amount of instances in the fleet. // // If this is set to a number, every deployment will reset the amount of // instances to this number. It is recommended to leave this value blank. // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-desiredcapacity // DesiredCapacity *float64 `field:"optional" json:"desiredCapacity" yaml:"desiredCapacity"` // Enable monitoring for group metrics, these metrics describe the group rather than any of its instances. // // To report all group metrics use `GroupMetrics.all()` // Group metrics are reported in a granularity of 1 minute at no additional charge. GroupMetrics *[]GroupMetrics `field:"optional" json:"groupMetrics" yaml:"groupMetrics"` // Configuration for health checks. HealthCheck HealthCheck `field:"optional" json:"healthCheck" yaml:"healthCheck"` // If the ASG has scheduled actions, don't reset unchanged group sizes. // // Only used if the ASG has scheduled actions (which may scale your ASG up // or down regardless of cdk deployments). If true, the size of the group // will only be reset if it has been changed in the CDK app. If false, the // sizes will always be changed back to what they were in the CDK app // on deployment. IgnoreUnmodifiedSizeProperties *bool `field:"optional" json:"ignoreUnmodifiedSizeProperties" yaml:"ignoreUnmodifiedSizeProperties"` // Controls whether instances in this group are launched with detailed or basic monitoring. // // When detailed monitoring is enabled, Amazon CloudWatch generates metrics every minute and your account // is charged a fee. When you disable detailed monitoring, CloudWatch generates metrics every 5 minutes. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. // See: https://docs.aws.amazon.com/autoscaling/latest/userguide/as-instance-monitoring.html#enable-as-instance-metrics // InstanceMonitoring Monitoring `field:"optional" json:"instanceMonitoring" yaml:"instanceMonitoring"` // Name of SSH keypair to grant access to instances. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. KeyName *string `field:"optional" json:"keyName" yaml:"keyName"` // Maximum number of instances in the fleet. MaxCapacity *float64 `field:"optional" json:"maxCapacity" yaml:"maxCapacity"` // The maximum amount of time that an instance can be in service. // // The maximum duration applies // to all current and future instances in the group. As an instance approaches its maximum duration, // it is terminated and replaced, and cannot be used again. // // You must specify a value of at least 604,800 seconds (7 days). To clear a previously set value, // leave this property undefined. // See: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-max-instance-lifetime.html // MaxInstanceLifetime awscdk.Duration `field:"optional" json:"maxInstanceLifetime" yaml:"maxInstanceLifetime"` // Minimum number of instances in the fleet. MinCapacity *float64 `field:"optional" json:"minCapacity" yaml:"minCapacity"` // Whether newly-launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in. // // By default, Auto Scaling can terminate an instance at any time after launch // when scaling in an Auto Scaling Group, subject to the group's termination // policy. However, you may wish to protect newly-launched instances from // being scaled in if they are going to run critical applications that should // not be prematurely terminated. // // This flag must be enabled if the Auto Scaling Group will be associated with // an ECS Capacity Provider with managed termination protection. NewInstancesProtectedFromScaleIn *bool `field:"optional" json:"newInstancesProtectedFromScaleIn" yaml:"newInstancesProtectedFromScaleIn"` // Configure autoscaling group to send notifications about fleet changes to an SNS topic(s). // See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html#cfn-as-group-notificationconfigurations // Notifications *[]*NotificationConfiguration `field:"optional" json:"notifications" yaml:"notifications"` // Configure waiting for signals during deployment. // // Use this to pause the CloudFormation deployment to wait for the instances // in the AutoScalingGroup to report successful startup during // creation and updates. The UserData script needs to invoke `cfn-signal` // with a success or failure code after it is done setting up the instance. // // Without waiting for signals, the CloudFormation deployment will proceed as // soon as the AutoScalingGroup has been created or updated but before the // instances in the group have been started. // // For example, to have instances wait for an Elastic Load Balancing health check before // they signal success, add a health-check verification by using the // cfn-init helper script. For an example, see the verify_instance_health // command in the Auto Scaling rolling updates sample template: // // https://github.com/awslabs/aws-cloudformation-templates/blob/master/aws/services/AutoScaling/AutoScalingRollingUpdates.yaml Signals Signals `field:"optional" json:"signals" yaml:"signals"` // The maximum hourly price (in USD) to be paid for any Spot Instance launched to fulfill the request. // // Spot Instances are // launched when the price you specify exceeds the current Spot market price. // // `launchTemplate` and `mixedInstancesPolicy` must not be specified when this property is specified. SpotPrice *string `field:"optional" json:"spotPrice" yaml:"spotPrice"` // Add SSM session permissions to the instance role. // // Setting this to `true` adds the necessary permissions to connect // to the instance using SSM Session Manager. You can do this // from the AWS Console. // // NOTE: Setting this flag to `true` may not be enough by itself. // You must also use an AMI that comes with the SSM Agent, or install // the SSM Agent yourself. See // [Working with SSM Agent](https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent.html) // in the SSM Developer Guide. SsmSessionPermissions *bool `field:"optional" json:"ssmSessionPermissions" yaml:"ssmSessionPermissions"` // A policy or a list of policies that are used to select the instances to terminate. // // The policies are executed in the order that you list them. // See: https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-instance-termination.html // TerminationPolicies *[]TerminationPolicy `field:"optional" json:"terminationPolicies" yaml:"terminationPolicies"` // What to do when an AutoScalingGroup's instance configuration is changed. // // This is applied when any of the settings on the ASG are changed that // affect how the instances should be created (VPC, instance type, startup // scripts, etc.). It indicates how the existing instances should be // replaced with new instances matching the new config. By default, nothing // is done and only new instances are launched with the new config. UpdatePolicy UpdatePolicy `field:"optional" json:"updatePolicy" yaml:"updatePolicy"` // Where to place instances within the VPC. VpcSubnets *awsec2.SubnetSelection `field:"optional" json:"vpcSubnets" yaml:"vpcSubnets"` }
Basic properties of an AutoScalingGroup, except the exact machines to run and where they should run.
Constructs that want to create AutoScalingGroups can inherit this interface and specialize the essential parts in various ways.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var blockDeviceVolume blockDeviceVolume var groupMetrics groupMetrics var healthCheck healthCheck var scalingEvents scalingEvents var signals signals var subnet subnet var subnetFilter subnetFilter var topic topic var updatePolicy updatePolicy commonAutoScalingGroupProps := &CommonAutoScalingGroupProps{ AllowAllOutbound: jsii.Boolean(false), AssociatePublicIpAddress: jsii.Boolean(false), AutoScalingGroupName: jsii.String("autoScalingGroupName"), BlockDevices: []blockDevice{ &blockDevice{ DeviceName: jsii.String("deviceName"), Volume: blockDeviceVolume, }, }, CapacityRebalance: jsii.Boolean(false), Cooldown: cdk.Duration_Minutes(jsii.Number(30)), DefaultInstanceWarmup: cdk.Duration_*Minutes(jsii.Number(30)), DesiredCapacity: jsii.Number(123), GroupMetrics: []*groupMetrics{ groupMetrics, }, HealthCheck: healthCheck, IgnoreUnmodifiedSizeProperties: jsii.Boolean(false), InstanceMonitoring: awscdk.Aws_autoscaling.Monitoring_BASIC, KeyName: jsii.String("keyName"), MaxCapacity: jsii.Number(123), MaxInstanceLifetime: cdk.Duration_*Minutes(jsii.Number(30)), MinCapacity: jsii.Number(123), NewInstancesProtectedFromScaleIn: jsii.Boolean(false), Notifications: []notificationConfiguration{ ¬ificationConfiguration{ Topic: topic, // the properties below are optional ScalingEvents: scalingEvents, }, }, Signals: signals, SpotPrice: jsii.String("spotPrice"), SsmSessionPermissions: jsii.Boolean(false), TerminationPolicies: []terminationPolicy{ awscdk.*Aws_autoscaling.*terminationPolicy_ALLOCATION_STRATEGY, }, UpdatePolicy: updatePolicy, VpcSubnets: &SubnetSelection{ AvailabilityZones: []*string{ jsii.String("availabilityZones"), }, OnePerAz: jsii.Boolean(false), SubnetFilters: []*subnetFilter{ subnetFilter, }, SubnetGroupName: jsii.String("subnetGroupName"), Subnets: []iSubnet{ subnet, }, SubnetType: awscdk.Aws_ec2.SubnetType_PRIVATE_ISOLATED, }, }
type CpuUtilizationScalingProps ¶
type CpuUtilizationScalingProps struct { // Period after a scaling completes before another scaling activity can start. Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // Indicates whether scale in by the target tracking policy is disabled. // // If the value is true, scale in is disabled and the target tracking policy // won't remove capacity from the autoscaling group. Otherwise, scale in is // enabled and the target tracking policy can remove capacity from the // group. DisableScaleIn *bool `field:"optional" json:"disableScaleIn" yaml:"disableScaleIn"` // Estimated time until a newly launched instance can send metrics to CloudWatch. EstimatedInstanceWarmup awscdk.Duration `field:"optional" json:"estimatedInstanceWarmup" yaml:"estimatedInstanceWarmup"` // Target average CPU utilization across the task. TargetUtilizationPercent *float64 `field:"required" json:"targetUtilizationPercent" yaml:"targetUtilizationPercent"` }
Properties for enabling scaling based on CPU utilization.
Example:
var autoScalingGroup autoScalingGroup autoScalingGroup.scaleOnCpuUtilization(jsii.String("KeepSpareCPU"), &CpuUtilizationScalingProps{ TargetUtilizationPercent: jsii.Number(50), })
type CronOptions ¶
type CronOptions struct { // The day of the month to run this rule at. Day *string `field:"optional" json:"day" yaml:"day"` // The hour to run this rule at. Hour *string `field:"optional" json:"hour" yaml:"hour"` // The minute to run this rule at. Minute *string `field:"optional" json:"minute" yaml:"minute"` // The month to run this rule at. Month *string `field:"optional" json:"month" yaml:"month"` // The day of the week to run this rule at. WeekDay *string `field:"optional" json:"weekDay" yaml:"weekDay"` }
Options to configure a cron expression.
All fields are strings so you can use complex expressions. Absence of a field implies '*' or '?', whichever one is appropriate.
Example:
var autoScalingGroup autoScalingGroup autoScalingGroup.scaleOnSchedule(jsii.String("PrescaleInTheMorning"), &BasicScheduledActionProps{ Schedule: autoscaling.Schedule_Cron(&CronOptions{ Hour: jsii.String("8"), Minute: jsii.String("0"), }), MinCapacity: jsii.Number(20), }) autoScalingGroup.scaleOnSchedule(jsii.String("AllowDownscalingAtNight"), &BasicScheduledActionProps{ Schedule: autoscaling.Schedule_*Cron(&CronOptions{ Hour: jsii.String("20"), Minute: jsii.String("0"), }), MinCapacity: jsii.Number(1), })
See: http://crontab.org/
type DefaultResult ¶
type DefaultResult string
const ( DefaultResult_CONTINUE DefaultResult = "CONTINUE" DefaultResult_ABANDON DefaultResult = "ABANDON" )
type EbsDeviceOptions ¶
type EbsDeviceOptions struct { // Indicates whether to delete the volume when the instance is terminated. DeleteOnTermination *bool `field:"optional" json:"deleteOnTermination" yaml:"deleteOnTermination"` // The number of I/O operations per second (IOPS) to provision for the volume. // // Must only be set for `volumeType`: `EbsDeviceVolumeType.IO1` // // The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS, // you need at least 100 GiB storage on the volume. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html // Iops *float64 `field:"optional" json:"iops" yaml:"iops"` // The throughput that the volume supports, in MiB/s Takes a minimum of 125 and maximum of 1000. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html // Throughput *float64 `field:"optional" json:"throughput" yaml:"throughput"` // The EBS volume type. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html // VolumeType EbsDeviceVolumeType `field:"optional" json:"volumeType" yaml:"volumeType"` // Specifies whether the EBS volume is encrypted. // // Encrypted EBS volumes can only be attached to instances that support Amazon EBS encryption. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSEncryption.html#EBSEncryption_supported_instances // Encrypted *bool `field:"optional" json:"encrypted" yaml:"encrypted"` }
Block device options for an EBS volume.
Example:
var vpc vpc var instanceType instanceType var machineImage iMachineImage autoScalingGroup := autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, InstanceType: InstanceType, MachineImage: MachineImage, BlockDevices: []blockDevice{ &blockDevice{ DeviceName: jsii.String("gp3-volume"), Volume: autoscaling.BlockDeviceVolume_Ebs(jsii.Number(15), &EbsDeviceOptions{ VolumeType: autoscaling.EbsDeviceVolumeType_GP3, Throughput: jsii.Number(125), }), }, }, })
type EbsDeviceOptionsBase ¶
type EbsDeviceOptionsBase struct { // Indicates whether to delete the volume when the instance is terminated. DeleteOnTermination *bool `field:"optional" json:"deleteOnTermination" yaml:"deleteOnTermination"` // The number of I/O operations per second (IOPS) to provision for the volume. // // Must only be set for `volumeType`: `EbsDeviceVolumeType.IO1` // // The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS, // you need at least 100 GiB storage on the volume. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html // Iops *float64 `field:"optional" json:"iops" yaml:"iops"` // The throughput that the volume supports, in MiB/s Takes a minimum of 125 and maximum of 1000. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html // Throughput *float64 `field:"optional" json:"throughput" yaml:"throughput"` // The EBS volume type. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html // VolumeType EbsDeviceVolumeType `field:"optional" json:"volumeType" yaml:"volumeType"` }
Base block device options for an EBS volume.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" ebsDeviceOptionsBase := &EbsDeviceOptionsBase{ DeleteOnTermination: jsii.Boolean(false), Iops: jsii.Number(123), Throughput: jsii.Number(123), VolumeType: awscdk.Aws_autoscaling.EbsDeviceVolumeType_STANDARD, }
type EbsDeviceProps ¶
type EbsDeviceProps struct { // Indicates whether to delete the volume when the instance is terminated. DeleteOnTermination *bool `field:"optional" json:"deleteOnTermination" yaml:"deleteOnTermination"` // The number of I/O operations per second (IOPS) to provision for the volume. // // Must only be set for `volumeType`: `EbsDeviceVolumeType.IO1` // // The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS, // you need at least 100 GiB storage on the volume. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html // Iops *float64 `field:"optional" json:"iops" yaml:"iops"` // The throughput that the volume supports, in MiB/s Takes a minimum of 125 and maximum of 1000. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html // Throughput *float64 `field:"optional" json:"throughput" yaml:"throughput"` // The EBS volume type. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html // VolumeType EbsDeviceVolumeType `field:"optional" json:"volumeType" yaml:"volumeType"` // The volume size, in Gibibytes (GiB). // // If you specify volumeSize, it must be equal or greater than the size of the snapshot. VolumeSize *float64 `field:"optional" json:"volumeSize" yaml:"volumeSize"` // The snapshot ID of the volume to use. SnapshotId *string `field:"optional" json:"snapshotId" yaml:"snapshotId"` }
Properties of an EBS block device.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" ebsDeviceProps := &EbsDeviceProps{ DeleteOnTermination: jsii.Boolean(false), Iops: jsii.Number(123), SnapshotId: jsii.String("snapshotId"), Throughput: jsii.Number(123), VolumeSize: jsii.Number(123), VolumeType: awscdk.Aws_autoscaling.EbsDeviceVolumeType_STANDARD, }
type EbsDeviceSnapshotOptions ¶
type EbsDeviceSnapshotOptions struct { // Indicates whether to delete the volume when the instance is terminated. DeleteOnTermination *bool `field:"optional" json:"deleteOnTermination" yaml:"deleteOnTermination"` // The number of I/O operations per second (IOPS) to provision for the volume. // // Must only be set for `volumeType`: `EbsDeviceVolumeType.IO1` // // The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS, // you need at least 100 GiB storage on the volume. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html // Iops *float64 `field:"optional" json:"iops" yaml:"iops"` // The throughput that the volume supports, in MiB/s Takes a minimum of 125 and maximum of 1000. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html // Throughput *float64 `field:"optional" json:"throughput" yaml:"throughput"` // The EBS volume type. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html // VolumeType EbsDeviceVolumeType `field:"optional" json:"volumeType" yaml:"volumeType"` // The volume size, in Gibibytes (GiB). // // If you specify volumeSize, it must be equal or greater than the size of the snapshot. VolumeSize *float64 `field:"optional" json:"volumeSize" yaml:"volumeSize"` }
Block device options for an EBS volume created from a snapshot.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" ebsDeviceSnapshotOptions := &EbsDeviceSnapshotOptions{ DeleteOnTermination: jsii.Boolean(false), Iops: jsii.Number(123), Throughput: jsii.Number(123), VolumeSize: jsii.Number(123), VolumeType: awscdk.Aws_autoscaling.EbsDeviceVolumeType_STANDARD, }
type EbsDeviceVolumeType ¶
type EbsDeviceVolumeType string
Supported EBS volume types for blockDevices.
Example:
var vpc vpc var instanceType instanceType var machineImage iMachineImage autoScalingGroup := autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, InstanceType: InstanceType, MachineImage: MachineImage, BlockDevices: []blockDevice{ &blockDevice{ DeviceName: jsii.String("gp3-volume"), Volume: autoscaling.BlockDeviceVolume_Ebs(jsii.Number(15), &EbsDeviceOptions{ VolumeType: autoscaling.EbsDeviceVolumeType_GP3, Throughput: jsii.Number(125), }), }, }, })
const ( // Magnetic. EbsDeviceVolumeType_STANDARD EbsDeviceVolumeType = "STANDARD" // Provisioned IOPS SSD - IO1. EbsDeviceVolumeType_IO1 EbsDeviceVolumeType = "IO1" // General Purpose SSD - GP2. EbsDeviceVolumeType_GP2 EbsDeviceVolumeType = "GP2" // General Purpose SSD - GP3. EbsDeviceVolumeType_GP3 EbsDeviceVolumeType = "GP3" // Throughput Optimized HDD. EbsDeviceVolumeType_ST1 EbsDeviceVolumeType = "ST1" // Cold HDD. EbsDeviceVolumeType_SC1 EbsDeviceVolumeType = "SC1" )
type Ec2HealthCheckOptions ¶
type Ec2HealthCheckOptions struct {
// Specified the time Auto Scaling waits before checking the health status of an EC2 instance that has come into service.
Grace awscdk.Duration `field:"optional" json:"grace" yaml:"grace"`
}
EC2 Heath check options.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" ec2HealthCheckOptions := &Ec2HealthCheckOptions{ Grace: cdk.Duration_Minutes(jsii.Number(30)), }
type ElbHealthCheckOptions ¶
type ElbHealthCheckOptions struct { // Specified the time Auto Scaling waits before checking the health status of an EC2 instance that has come into service. // // This option is required for ELB health checks. Grace awscdk.Duration `field:"required" json:"grace" yaml:"grace"` }
ELB Heath check options.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" elbHealthCheckOptions := &ElbHealthCheckOptions{ Grace: cdk.Duration_Minutes(jsii.Number(30)), }
type GroupMetric ¶
type GroupMetric interface { // The name of the group metric. Name() *string }
Group metrics that an Auto Scaling group sends to Amazon CloudWatch.
Example:
var vpc vpc var instanceType instanceType var machineImage iMachineImage // Enable monitoring of all group metrics // Enable monitoring of all group metrics autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, InstanceType: InstanceType, MachineImage: MachineImage, // ... GroupMetrics: []groupMetrics{ autoscaling.*groupMetrics_All(), }, }) // Enable monitoring for a subset of group metrics // Enable monitoring for a subset of group metrics autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, InstanceType: InstanceType, MachineImage: MachineImage, // ... GroupMetrics: []*groupMetrics{ autoscaling.NewGroupMetrics(autoscaling.GroupMetric_MIN_SIZE(), autoscaling.GroupMetric_MAX_SIZE()), }, })
func GroupMetric_DESIRED_CAPACITY ¶
func GroupMetric_DESIRED_CAPACITY() GroupMetric
func GroupMetric_IN_SERVICE_INSTANCES ¶
func GroupMetric_IN_SERVICE_INSTANCES() GroupMetric
func GroupMetric_MAX_SIZE ¶
func GroupMetric_MAX_SIZE() GroupMetric
func GroupMetric_MIN_SIZE ¶
func GroupMetric_MIN_SIZE() GroupMetric
func GroupMetric_PENDING_INSTANCES ¶
func GroupMetric_PENDING_INSTANCES() GroupMetric
func GroupMetric_STANDBY_INSTANCES ¶
func GroupMetric_STANDBY_INSTANCES() GroupMetric
func GroupMetric_TERMINATING_INSTANCES ¶
func GroupMetric_TERMINATING_INSTANCES() GroupMetric
func GroupMetric_TOTAL_INSTANCES ¶
func GroupMetric_TOTAL_INSTANCES() GroupMetric
func NewGroupMetric ¶
func NewGroupMetric(name *string) GroupMetric
type GroupMetrics ¶
type GroupMetrics interface { }
A set of group metrics.
Example:
var vpc vpc var instanceType instanceType var machineImage iMachineImage // Enable monitoring of all group metrics // Enable monitoring of all group metrics autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, InstanceType: InstanceType, MachineImage: MachineImage, // ... GroupMetrics: []groupMetrics{ autoscaling.*groupMetrics_All(), }, }) // Enable monitoring for a subset of group metrics // Enable monitoring for a subset of group metrics autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, InstanceType: InstanceType, MachineImage: MachineImage, // ... GroupMetrics: []*groupMetrics{ autoscaling.NewGroupMetrics(autoscaling.GroupMetric_MIN_SIZE(), autoscaling.GroupMetric_MAX_SIZE()), }, })
func NewGroupMetrics ¶
func NewGroupMetrics(metrics ...GroupMetric) GroupMetrics
type HealthCheck ¶
type HealthCheck interface { GracePeriod() awscdk.Duration Type() *string }
Health check settings.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" healthCheck := awscdk.Aws_autoscaling.HealthCheck_Ec2(&Ec2HealthCheckOptions{ Grace: cdk.Duration_Minutes(jsii.Number(30)), })
func HealthCheck_Ec2 ¶
func HealthCheck_Ec2(options *Ec2HealthCheckOptions) HealthCheck
Use EC2 for health checks.
func HealthCheck_Elb ¶
func HealthCheck_Elb(options *ElbHealthCheckOptions) HealthCheck
Use ELB for health checks.
It considers the instance unhealthy if it fails either the EC2 status checks or the load balancer health checks.
type IAutoScalingGroup ¶
type IAutoScalingGroup interface { awsiam.IGrantable awscdk.IResource // Send a message to either an SQS queue or SNS topic when instances launch or terminate. AddLifecycleHook(id *string, props *BasicLifecycleHookProps) LifecycleHook // Add command to the startup script of fleet instances. // // The command must be in the scripting language supported by the fleet's OS (i.e. Linux/Windows). // Does nothing for imported ASGs. AddUserData(commands ...*string) // Add a pool of pre-initialized EC2 instances that sits alongside an Auto Scaling group. AddWarmPool(options *WarmPoolOptions) WarmPool // Scale out or in to achieve a target CPU utilization. ScaleOnCpuUtilization(id *string, props *CpuUtilizationScalingProps) TargetTrackingScalingPolicy // Scale out or in to achieve a target network ingress rate. ScaleOnIncomingBytes(id *string, props *NetworkUtilizationScalingProps) TargetTrackingScalingPolicy // Scale out or in, in response to a metric. ScaleOnMetric(id *string, props *BasicStepScalingPolicyProps) StepScalingPolicy // Scale out or in to achieve a target network egress rate. ScaleOnOutgoingBytes(id *string, props *NetworkUtilizationScalingProps) TargetTrackingScalingPolicy // Scale out or in based on time. ScaleOnSchedule(id *string, props *BasicScheduledActionProps) ScheduledAction // Scale out or in in order to keep a metric around a target value. ScaleToTrackMetric(id *string, props *MetricTargetTrackingProps) TargetTrackingScalingPolicy // The arn of the AutoScalingGroup. AutoScalingGroupArn() *string // The name of the AutoScalingGroup. AutoScalingGroupName() *string // The operating system family that the instances in this auto-scaling group belong to. // // Is 'UNKNOWN' for imported ASGs. OsType() awsec2.OperatingSystemType }
An AutoScalingGroup.
func AutoScalingGroup_FromAutoScalingGroupName ¶
func AutoScalingGroup_FromAutoScalingGroupName(scope constructs.Construct, id *string, autoScalingGroupName *string) IAutoScalingGroup
type ILifecycleHook ¶
type ILifecycleHook interface { awscdk.IResource // The role for the lifecycle hook to execute. Role() awsiam.IRole }
A basic lifecycle hook object.
type ILifecycleHookTarget ¶
type ILifecycleHookTarget interface { // Called when this object is used as the target of a lifecycle hook. Bind(scope constructs.Construct, options *BindHookTargetOptions) *LifecycleHookTargetConfig }
Interface for autoscaling lifecycle hook targets.
type InstancesDistribution ¶ added in v2.21.0
type InstancesDistribution struct { // Indicates how to allocate instance types to fulfill On-Demand capacity. // // The only valid value is prioritized, // which is also the default value. OnDemandAllocationStrategy OnDemandAllocationStrategy `field:"optional" json:"onDemandAllocationStrategy" yaml:"onDemandAllocationStrategy"` // The minimum amount of the Auto Scaling group's capacity that must be fulfilled by On-Demand Instances. // // This // base portion is provisioned first as your group scales. Defaults to 0 if not specified. If you specify weights // for the instance types in the overrides, set the value of OnDemandBaseCapacity in terms of the number of // capacity units, and not the number of instances. OnDemandBaseCapacity *float64 `field:"optional" json:"onDemandBaseCapacity" yaml:"onDemandBaseCapacity"` // Controls the percentages of On-Demand Instances and Spot Instances for your additional capacity beyond OnDemandBaseCapacity. // // Expressed as a number (for example, 20 specifies 20% On-Demand Instances, 80% Spot Instances). // Defaults to 100 if not specified. If set to 100, only On-Demand Instances are provisioned. OnDemandPercentageAboveBaseCapacity *float64 `field:"optional" json:"onDemandPercentageAboveBaseCapacity" yaml:"onDemandPercentageAboveBaseCapacity"` // If the allocation strategy is lowest-price, the Auto Scaling group launches instances using the Spot pools with the lowest price, and evenly allocates your instances across the number of Spot pools that you specify. // // Defaults to // lowest-price if not specified. // // If the allocation strategy is capacity-optimized (recommended), the Auto Scaling group launches instances using Spot // pools that are optimally chosen based on the available Spot capacity. Alternatively, you can use capacity-optimized-prioritized // and set the order of instance types in the list of launch template overrides from highest to lowest priority // (from first to last in the list). Amazon EC2 Auto Scaling honors the instance type priorities on a best-effort basis but // optimizes for capacity first. SpotAllocationStrategy SpotAllocationStrategy `field:"optional" json:"spotAllocationStrategy" yaml:"spotAllocationStrategy"` // The number of Spot Instance pools to use to allocate your Spot capacity. // // The Spot pools are determined from the different instance // types in the overrides. Valid only when the Spot allocation strategy is lowest-price. Value must be in the range of 1 to 20. // Defaults to 2 if not specified. SpotInstancePools *float64 `field:"optional" json:"spotInstancePools" yaml:"spotInstancePools"` // The maximum price per unit hour that you are willing to pay for a Spot Instance. // // If you leave the value at its default (empty), // Amazon EC2 Auto Scaling uses the On-Demand price as the maximum Spot price. To remove a value that you previously set, include // the property but specify an empty string ("") for the value. SpotMaxPrice *string `field:"optional" json:"spotMaxPrice" yaml:"spotMaxPrice"` }
InstancesDistribution is a subproperty of MixedInstancesPolicy that describes an instances distribution for an Auto Scaling group.
The instances distribution specifies the distribution of On-Demand Instances and Spot Instances, the maximum price to pay for Spot Instances, and how the Auto Scaling group allocates instance types to fulfill On-Demand and Spot capacities.
For more information and example configurations, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User Guide:
https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html
Example:
var vpc vpc var launchTemplate1 launchTemplate var launchTemplate2 launchTemplate autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, MixedInstancesPolicy: &MixedInstancesPolicy{ InstancesDistribution: &InstancesDistribution{ OnDemandPercentageAboveBaseCapacity: jsii.Number(50), }, LaunchTemplate: launchTemplate1, LaunchTemplateOverrides: []launchTemplateOverrides{ &launchTemplateOverrides{ InstanceType: ec2.NewInstanceType(jsii.String("t3.micro")), }, &launchTemplateOverrides{ InstanceType: ec2.NewInstanceType(jsii.String("t3a.micro")), }, &launchTemplateOverrides{ InstanceType: ec2.NewInstanceType(jsii.String("t4g.micro")), LaunchTemplate: launchTemplate2, }, }, }, })
type LaunchTemplateOverrides ¶ added in v2.21.0
type LaunchTemplateOverrides struct { // The instance type, such as m3.xlarge. You must use an instance type that is supported in your requested Region and Availability Zones. InstanceType awsec2.InstanceType `field:"required" json:"instanceType" yaml:"instanceType"` // Provides the launch template to be used when launching the instance type. // // For example, some instance types might // require a launch template with a different AMI. If not provided, Amazon EC2 Auto Scaling uses the launch template // that's defined for your mixed instances policy. LaunchTemplate awsec2.ILaunchTemplate `field:"optional" json:"launchTemplate" yaml:"launchTemplate"` // The number of capacity units provided by the specified instance type in terms of virtual CPUs, memory, storage, throughput, or other relative performance characteristic. // // When a Spot or On-Demand Instance is provisioned, the // capacity units count toward the desired capacity. Amazon EC2 Auto Scaling provisions instances until the desired // capacity is totally fulfilled, even if this results in an overage. Value must be in the range of 1 to 999. // // For example, If there are 2 units remaining to fulfill capacity, and Amazon EC2 Auto Scaling can only provision // an instance with a WeightedCapacity of 5 units, the instance is provisioned, and the desired capacity is exceeded // by 3 units. // See: https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-instance-weighting.html // WeightedCapacity *float64 `field:"optional" json:"weightedCapacity" yaml:"weightedCapacity"` }
LaunchTemplateOverrides is a subproperty of LaunchTemplate that describes an override for a launch template.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var instanceType instanceType var launchTemplate launchTemplate launchTemplateOverrides := &LaunchTemplateOverrides{ InstanceType: instanceType, // the properties below are optional LaunchTemplate: launchTemplate, WeightedCapacity: jsii.Number(123), }
type LifecycleHook ¶
type LifecycleHook interface { awscdk.Resource ILifecycleHook // The environment this resource belongs to. // // For resources that are created and managed by the CDK // (generally, those created by creating new class instances like Role, Bucket, etc.), // this is always the same as the environment of the stack they belong to; // however, for imported resources // (those obtained from static methods like fromRoleArn, fromBucketName, etc.), // that might be different than the stack they were imported into. Env() *awscdk.ResourceEnvironment // The name of this lifecycle hook. LifecycleHookName() *string // The tree node. Node() constructs.Node // Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource. // // This value will resolve to one of the following: // - a concrete value (e.g. `"my-awesome-bucket"`) // - `undefined`, when a name should be generated by CloudFormation // - a concrete name generated automatically during synthesis, in // cross-environment scenarios. PhysicalName() *string // The role that allows the ASG to publish to the notification target. Role() awsiam.IRole // The stack in which this resource is defined. Stack() awscdk.Stack // Apply the given removal policy to this resource. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). ApplyRemovalPolicy(policy awscdk.RemovalPolicy) GeneratePhysicalName() *string // Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`). // // Normally, this token will resolve to `arnAttr`, but if the resource is // referenced across environments, `arnComponents` will be used to synthesize // a concrete ARN with the resource's physical name. Make sure to reference // `this.physicalName` in `arnComponents`. GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string // Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`). // // Normally, this token will resolve to `nameAttr`, but if the resource is // referenced across environments, it will be resolved to `this.physicalName`, // which will be a concrete name. GetResourceNameAttribute(nameAttr *string) *string // Returns a string representation of this construct. ToString() *string }
Define a life cycle hook.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var autoScalingGroup autoScalingGroup var lifecycleHookTarget iLifecycleHookTarget var role role lifecycleHook := awscdk.Aws_autoscaling.NewLifecycleHook(this, jsii.String("MyLifecycleHook"), &LifecycleHookProps{ AutoScalingGroup: autoScalingGroup, LifecycleTransition: awscdk.*Aws_autoscaling.LifecycleTransition_INSTANCE_LAUNCHING, // the properties below are optional DefaultResult: awscdk.*Aws_autoscaling.DefaultResult_CONTINUE, HeartbeatTimeout: cdk.Duration_Minutes(jsii.Number(30)), LifecycleHookName: jsii.String("lifecycleHookName"), NotificationMetadata: jsii.String("notificationMetadata"), NotificationTarget: lifecycleHookTarget, Role: role, })
func NewLifecycleHook ¶
func NewLifecycleHook(scope constructs.Construct, id *string, props *LifecycleHookProps) LifecycleHook
type LifecycleHookProps ¶
type LifecycleHookProps struct { // The state of the Amazon EC2 instance to which you want to attach the lifecycle hook. LifecycleTransition LifecycleTransition `field:"required" json:"lifecycleTransition" yaml:"lifecycleTransition"` // The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. DefaultResult DefaultResult `field:"optional" json:"defaultResult" yaml:"defaultResult"` // Maximum time between calls to RecordLifecycleActionHeartbeat for the hook. // // If the lifecycle hook times out, perform the action in DefaultResult. HeartbeatTimeout awscdk.Duration `field:"optional" json:"heartbeatTimeout" yaml:"heartbeatTimeout"` // Name of the lifecycle hook. LifecycleHookName *string `field:"optional" json:"lifecycleHookName" yaml:"lifecycleHookName"` // Additional data to pass to the lifecycle hook target. NotificationMetadata *string `field:"optional" json:"notificationMetadata" yaml:"notificationMetadata"` // The target of the lifecycle hook. NotificationTarget ILifecycleHookTarget `field:"optional" json:"notificationTarget" yaml:"notificationTarget"` // The role that allows publishing to the notification target. Role awsiam.IRole `field:"optional" json:"role" yaml:"role"` // The AutoScalingGroup to add the lifecycle hook to. AutoScalingGroup IAutoScalingGroup `field:"required" json:"autoScalingGroup" yaml:"autoScalingGroup"` }
Properties for a Lifecycle hook.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var autoScalingGroup autoScalingGroup var lifecycleHookTarget iLifecycleHookTarget var role role lifecycleHookProps := &LifecycleHookProps{ AutoScalingGroup: autoScalingGroup, LifecycleTransition: awscdk.Aws_autoscaling.LifecycleTransition_INSTANCE_LAUNCHING, // the properties below are optional DefaultResult: awscdk.*Aws_autoscaling.DefaultResult_CONTINUE, HeartbeatTimeout: cdk.Duration_Minutes(jsii.Number(30)), LifecycleHookName: jsii.String("lifecycleHookName"), NotificationMetadata: jsii.String("notificationMetadata"), NotificationTarget: lifecycleHookTarget, Role: role, }
type LifecycleHookTargetConfig ¶
type LifecycleHookTargetConfig struct { // The IRole that was used to bind the lifecycle hook to the target. CreatedRole awsiam.IRole `field:"required" json:"createdRole" yaml:"createdRole"` // The targetArn that the lifecycle hook was bound to. NotificationTargetArn *string `field:"required" json:"notificationTargetArn" yaml:"notificationTargetArn"` }
Result of binding a lifecycle hook to a target.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var role role lifecycleHookTargetConfig := &LifecycleHookTargetConfig{ CreatedRole: role, NotificationTargetArn: jsii.String("notificationTargetArn"), }
type LifecycleTransition ¶
type LifecycleTransition string
What instance transition to attach the hook to.
const ( // Execute the hook when an instance is about to be added. LifecycleTransition_INSTANCE_LAUNCHING LifecycleTransition = "INSTANCE_LAUNCHING" // Execute the hook when an instance is about to be terminated. LifecycleTransition_INSTANCE_TERMINATING LifecycleTransition = "INSTANCE_TERMINATING" )
type MetricAggregationType ¶
type MetricAggregationType string
How the scaling metric is going to be aggregated.
const ( // Average. MetricAggregationType_AVERAGE MetricAggregationType = "AVERAGE" // Minimum. MetricAggregationType_MINIMUM MetricAggregationType = "MINIMUM" // Maximum. MetricAggregationType_MAXIMUM MetricAggregationType = "MAXIMUM" )
type MetricTargetTrackingProps ¶
type MetricTargetTrackingProps struct { // Period after a scaling completes before another scaling activity can start. Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // Indicates whether scale in by the target tracking policy is disabled. // // If the value is true, scale in is disabled and the target tracking policy // won't remove capacity from the autoscaling group. Otherwise, scale in is // enabled and the target tracking policy can remove capacity from the // group. DisableScaleIn *bool `field:"optional" json:"disableScaleIn" yaml:"disableScaleIn"` // Estimated time until a newly launched instance can send metrics to CloudWatch. EstimatedInstanceWarmup awscdk.Duration `field:"optional" json:"estimatedInstanceWarmup" yaml:"estimatedInstanceWarmup"` // Metric to track. // // The metric must represent a utilization, so that if it's higher than the // target value, your ASG should scale out, and if it's lower it should // scale in. Metric awscloudwatch.IMetric `field:"required" json:"metric" yaml:"metric"` // Value to keep the metric around. TargetValue *float64 `field:"required" json:"targetValue" yaml:"targetValue"` }
Properties for enabling tracking of an arbitrary metric.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var metric metric metricTargetTrackingProps := &MetricTargetTrackingProps{ Metric: metric, TargetValue: jsii.Number(123), // the properties below are optional Cooldown: cdk.Duration_Minutes(jsii.Number(30)), DisableScaleIn: jsii.Boolean(false), EstimatedInstanceWarmup: cdk.Duration_*Minutes(jsii.Number(30)), }
type MixedInstancesPolicy ¶ added in v2.21.0
type MixedInstancesPolicy struct { // Launch template to use. LaunchTemplate awsec2.ILaunchTemplate `field:"required" json:"launchTemplate" yaml:"launchTemplate"` // InstancesDistribution to use. InstancesDistribution *InstancesDistribution `field:"optional" json:"instancesDistribution" yaml:"instancesDistribution"` // Launch template overrides. // // The maximum number of instance types that can be associated with an Auto Scaling group is 40. // // The maximum number of distinct launch templates you can define for an Auto Scaling group is 20. LaunchTemplateOverrides *[]*LaunchTemplateOverrides `field:"optional" json:"launchTemplateOverrides" yaml:"launchTemplateOverrides"` }
MixedInstancesPolicy allows you to configure a group that diversifies across On-Demand Instances and Spot Instances of multiple instance types.
For more information, see Auto Scaling groups with multiple instance types and purchase options in the Amazon EC2 Auto Scaling User Guide:
https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html
Example:
var vpc vpc var launchTemplate1 launchTemplate var launchTemplate2 launchTemplate autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, MixedInstancesPolicy: &MixedInstancesPolicy{ InstancesDistribution: &InstancesDistribution{ OnDemandPercentageAboveBaseCapacity: jsii.Number(50), }, LaunchTemplate: launchTemplate1, LaunchTemplateOverrides: []launchTemplateOverrides{ &launchTemplateOverrides{ InstanceType: ec2.NewInstanceType(jsii.String("t3.micro")), }, &launchTemplateOverrides{ InstanceType: ec2.NewInstanceType(jsii.String("t3a.micro")), }, &launchTemplateOverrides{ InstanceType: ec2.NewInstanceType(jsii.String("t4g.micro")), LaunchTemplate: launchTemplate2, }, }, }, })
type Monitoring ¶
type Monitoring string
The monitoring mode for instances launched in an autoscaling group.
const ( // Generates metrics every 5 minutes. Monitoring_BASIC Monitoring = "BASIC" // Generates metrics every minute. Monitoring_DETAILED Monitoring = "DETAILED" )
type NetworkUtilizationScalingProps ¶
type NetworkUtilizationScalingProps struct { // Period after a scaling completes before another scaling activity can start. Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // Indicates whether scale in by the target tracking policy is disabled. // // If the value is true, scale in is disabled and the target tracking policy // won't remove capacity from the autoscaling group. Otherwise, scale in is // enabled and the target tracking policy can remove capacity from the // group. DisableScaleIn *bool `field:"optional" json:"disableScaleIn" yaml:"disableScaleIn"` // Estimated time until a newly launched instance can send metrics to CloudWatch. EstimatedInstanceWarmup awscdk.Duration `field:"optional" json:"estimatedInstanceWarmup" yaml:"estimatedInstanceWarmup"` // Target average bytes/seconds on each instance. TargetBytesPerSecond *float64 `field:"required" json:"targetBytesPerSecond" yaml:"targetBytesPerSecond"` }
Properties for enabling scaling based on network utilization.
Example:
var autoScalingGroup autoScalingGroup autoScalingGroup.scaleOnIncomingBytes(jsii.String("LimitIngressPerInstance"), &NetworkUtilizationScalingProps{ TargetBytesPerSecond: jsii.Number(10 * 1024 * 1024), }) autoScalingGroup.scaleOnOutgoingBytes(jsii.String("LimitEgressPerInstance"), &NetworkUtilizationScalingProps{ TargetBytesPerSecond: jsii.Number(10 * 1024 * 1024), })
type NotificationConfiguration ¶
type NotificationConfiguration struct { // SNS topic to send notifications about fleet scaling events. Topic awssns.ITopic `field:"required" json:"topic" yaml:"topic"` // Which fleet scaling events triggers a notification. ScalingEvents ScalingEvents `field:"optional" json:"scalingEvents" yaml:"scalingEvents"` }
AutoScalingGroup fleet change notifications configurations.
You can configure AutoScaling to send an SNS notification whenever your Auto Scaling group scales.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var scalingEvents scalingEvents var topic topic notificationConfiguration := &NotificationConfiguration{ Topic: topic, // the properties below are optional ScalingEvents: scalingEvents, }
type OnDemandAllocationStrategy ¶ added in v2.21.0
type OnDemandAllocationStrategy string
Indicates how to allocate instance types to fulfill On-Demand capacity.
const ( // This strategy uses the order of instance types in the LaunchTemplateOverrides to define the launch priority of each instance type. // // The first instance type in the array is prioritized higher than the // last. If all your On-Demand capacity cannot be fulfilled using your highest priority instance, then // the Auto Scaling group launches the remaining capacity using the second priority instance type, and // so on. OnDemandAllocationStrategy_PRIORITIZED OnDemandAllocationStrategy = "PRIORITIZED" )
type PoolState ¶ added in v2.18.0
type PoolState string
The instance state in the warm pool.
const ( // Hibernated. // // To use this state, prerequisites must be in place. // See: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hibernating-prerequisites.html // PoolState_HIBERNATED PoolState = "HIBERNATED" // Running. PoolState_RUNNING PoolState = "RUNNING" // Stopped. PoolState_STOPPED PoolState = "STOPPED" )
type PredefinedMetric ¶
type PredefinedMetric string
One of the predefined autoscaling metrics.
const ( // Average CPU utilization of the Auto Scaling group. PredefinedMetric_ASG_AVERAGE_CPU_UTILIZATION PredefinedMetric = "ASG_AVERAGE_CPU_UTILIZATION" // Average number of bytes received on all network interfaces by the Auto Scaling group. PredefinedMetric_ASG_AVERAGE_NETWORK_IN PredefinedMetric = "ASG_AVERAGE_NETWORK_IN" // Average number of bytes sent out on all network interfaces by the Auto Scaling group. PredefinedMetric_ASG_AVERAGE_NETWORK_OUT PredefinedMetric = "ASG_AVERAGE_NETWORK_OUT" // Number of requests completed per target in an Application Load Balancer target group. // // Specify the ALB to look at in the `resourceLabel` field. PredefinedMetric_ALB_REQUEST_COUNT_PER_TARGET PredefinedMetric = "ALB_REQUEST_COUNT_PER_TARGET" )
type RenderSignalsOptions ¶
type RenderSignalsOptions struct { // The desiredCapacity of the ASG. DesiredCapacity *float64 `field:"optional" json:"desiredCapacity" yaml:"desiredCapacity"` // The minSize of the ASG. MinCapacity *float64 `field:"optional" json:"minCapacity" yaml:"minCapacity"` }
Input for Signals.renderCreationPolicy.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" renderSignalsOptions := &RenderSignalsOptions{ DesiredCapacity: jsii.Number(123), MinCapacity: jsii.Number(123), }
type RequestCountScalingProps ¶
type RequestCountScalingProps struct { // Period after a scaling completes before another scaling activity can start. Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // Indicates whether scale in by the target tracking policy is disabled. // // If the value is true, scale in is disabled and the target tracking policy // won't remove capacity from the autoscaling group. Otherwise, scale in is // enabled and the target tracking policy can remove capacity from the // group. DisableScaleIn *bool `field:"optional" json:"disableScaleIn" yaml:"disableScaleIn"` // Estimated time until a newly launched instance can send metrics to CloudWatch. EstimatedInstanceWarmup awscdk.Duration `field:"optional" json:"estimatedInstanceWarmup" yaml:"estimatedInstanceWarmup"` // Target average requests/minute on each instance. TargetRequestsPerMinute *float64 `field:"optional" json:"targetRequestsPerMinute" yaml:"targetRequestsPerMinute"` }
Properties for enabling scaling based on request/second.
Example:
var autoScalingGroup autoScalingGroup autoScalingGroup.scaleOnRequestCount(jsii.String("LimitRPS"), &RequestCountScalingProps{ TargetRequestsPerSecond: jsii.Number(1000), })
type RollingUpdateOptions ¶
type RollingUpdateOptions struct { // The maximum number of instances that AWS CloudFormation updates at once. // // This number affects the speed of the replacement. MaxBatchSize *float64 `field:"optional" json:"maxBatchSize" yaml:"maxBatchSize"` // The minimum number of instances that must be in service before more instances are replaced. // // This number affects the speed of the replacement. MinInstancesInService *float64 `field:"optional" json:"minInstancesInService" yaml:"minInstancesInService"` // The percentage of instances that must signal success for the update to succeed. MinSuccessPercentage *float64 `field:"optional" json:"minSuccessPercentage" yaml:"minSuccessPercentage"` // The pause time after making a change to a batch of instances. PauseTime awscdk.Duration `field:"optional" json:"pauseTime" yaml:"pauseTime"` // Specifies the Auto Scaling processes to suspend during a stack update. // // Suspending processes prevents Auto Scaling from interfering with a stack // update. SuspendProcesses *[]ScalingProcess `field:"optional" json:"suspendProcesses" yaml:"suspendProcesses"` // Specifies whether the Auto Scaling group waits on signals from new instances during an update. WaitOnResourceSignals *bool `field:"optional" json:"waitOnResourceSignals" yaml:"waitOnResourceSignals"` }
Options for customizing the rolling update.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import cdk "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" rollingUpdateOptions := &RollingUpdateOptions{ MaxBatchSize: jsii.Number(123), MinInstancesInService: jsii.Number(123), MinSuccessPercentage: jsii.Number(123), PauseTime: cdk.Duration_Minutes(jsii.Number(30)), SuspendProcesses: []scalingProcess{ awscdk.Aws_autoscaling.*scalingProcess_LAUNCH, }, WaitOnResourceSignals: jsii.Boolean(false), }
type ScalingEvent ¶
type ScalingEvent string
Fleet scaling events.
const ( // Notify when an instance was launched. ScalingEvent_INSTANCE_LAUNCH ScalingEvent = "INSTANCE_LAUNCH" // Notify when an instance was terminated. ScalingEvent_INSTANCE_TERMINATE ScalingEvent = "INSTANCE_TERMINATE" // Notify when an instance failed to terminate. ScalingEvent_INSTANCE_TERMINATE_ERROR ScalingEvent = "INSTANCE_TERMINATE_ERROR" // Notify when an instance failed to launch. ScalingEvent_INSTANCE_LAUNCH_ERROR ScalingEvent = "INSTANCE_LAUNCH_ERROR" // Send a test notification to the topic. ScalingEvent_TEST_NOTIFICATION ScalingEvent = "TEST_NOTIFICATION" )
type ScalingEvents ¶
type ScalingEvents interface { }
A list of ScalingEvents, you can use one of the predefined lists, such as ScalingEvents.ERRORS or create a custom group by instantiating a `NotificationTypes` object, e.g: `new NotificationTypes(`NotificationType.INSTANCE_LAUNCH`)`.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" scalingEvents := awscdk.Aws_autoscaling.ScalingEvents_ALL()
func NewScalingEvents ¶
func NewScalingEvents(types ...ScalingEvent) ScalingEvents
func ScalingEvents_ALL ¶
func ScalingEvents_ALL() ScalingEvents
func ScalingEvents_ERRORS ¶
func ScalingEvents_ERRORS() ScalingEvents
func ScalingEvents_LAUNCH_EVENTS ¶
func ScalingEvents_LAUNCH_EVENTS() ScalingEvents
func ScalingEvents_TERMINATION_EVENTS ¶
func ScalingEvents_TERMINATION_EVENTS() ScalingEvents
type ScalingInterval ¶
type ScalingInterval struct { // The capacity adjustment to apply in this interval. // // The number is interpreted differently based on AdjustmentType: // // - ChangeInCapacity: add the adjustment to the current capacity. // The number can be positive or negative. // - PercentChangeInCapacity: add or remove the given percentage of the current // capacity to itself. The number can be in the range [-100..100]. // - ExactCapacity: set the capacity to this number. The number must // be positive. Change *float64 `field:"required" json:"change" yaml:"change"` // The lower bound of the interval. // // The scaling adjustment will be applied if the metric is higher than this value. Lower *float64 `field:"optional" json:"lower" yaml:"lower"` // The upper bound of the interval. // // The scaling adjustment will be applied if the metric is lower than this value. Upper *float64 `field:"optional" json:"upper" yaml:"upper"` }
A range of metric values in which to apply a certain scaling operation.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" scalingInterval := &ScalingInterval{ Change: jsii.Number(123), // the properties below are optional Lower: jsii.Number(123), Upper: jsii.Number(123), }
type ScalingProcess ¶
type ScalingProcess string
const ( ScalingProcess_LAUNCH ScalingProcess = "LAUNCH" ScalingProcess_TERMINATE ScalingProcess = "TERMINATE" ScalingProcess_HEALTH_CHECK ScalingProcess = "HEALTH_CHECK" ScalingProcess_REPLACE_UNHEALTHY ScalingProcess = "REPLACE_UNHEALTHY" ScalingProcess_AZ_REBALANCE ScalingProcess = "AZ_REBALANCE" ScalingProcess_ALARM_NOTIFICATION ScalingProcess = "ALARM_NOTIFICATION" ScalingProcess_SCHEDULED_ACTIONS ScalingProcess = "SCHEDULED_ACTIONS" ScalingProcess_ADD_TO_LOAD_BALANCER ScalingProcess = "ADD_TO_LOAD_BALANCER" )
type Schedule ¶
type Schedule interface { // Retrieve the expression for this schedule. ExpressionString() *string }
Schedule for scheduled scaling actions.
Example:
var autoScalingGroup autoScalingGroup autoScalingGroup.scaleOnSchedule(jsii.String("PrescaleInTheMorning"), &BasicScheduledActionProps{ Schedule: autoscaling.Schedule_Cron(&CronOptions{ Hour: jsii.String("8"), Minute: jsii.String("0"), }), MinCapacity: jsii.Number(20), }) autoScalingGroup.scaleOnSchedule(jsii.String("AllowDownscalingAtNight"), &BasicScheduledActionProps{ Schedule: autoscaling.Schedule_*Cron(&CronOptions{ Hour: jsii.String("20"), Minute: jsii.String("0"), }), MinCapacity: jsii.Number(1), })
func Schedule_Cron ¶
func Schedule_Cron(options *CronOptions) Schedule
Create a schedule from a set of cron fields.
func Schedule_Expression ¶
Construct a schedule from a literal schedule expression. See: http://crontab.org/
type ScheduledAction ¶
type ScheduledAction interface { awscdk.Resource // The environment this resource belongs to. // // For resources that are created and managed by the CDK // (generally, those created by creating new class instances like Role, Bucket, etc.), // this is always the same as the environment of the stack they belong to; // however, for imported resources // (those obtained from static methods like fromRoleArn, fromBucketName, etc.), // that might be different than the stack they were imported into. Env() *awscdk.ResourceEnvironment // The tree node. Node() constructs.Node // Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource. // // This value will resolve to one of the following: // - a concrete value (e.g. `"my-awesome-bucket"`) // - `undefined`, when a name should be generated by CloudFormation // - a concrete name generated automatically during synthesis, in // cross-environment scenarios. PhysicalName() *string // The name of the scheduled action. ScheduledActionName() *string // The stack in which this resource is defined. Stack() awscdk.Stack // Apply the given removal policy to this resource. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). ApplyRemovalPolicy(policy awscdk.RemovalPolicy) GeneratePhysicalName() *string // Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`). // // Normally, this token will resolve to `arnAttr`, but if the resource is // referenced across environments, `arnComponents` will be used to synthesize // a concrete ARN with the resource's physical name. Make sure to reference // `this.physicalName` in `arnComponents`. GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string // Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`). // // Normally, this token will resolve to `nameAttr`, but if the resource is // referenced across environments, it will be resolved to `this.physicalName`, // which will be a concrete name. GetResourceNameAttribute(nameAttr *string) *string // Returns a string representation of this construct. ToString() *string }
Define a scheduled scaling action.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var autoScalingGroup autoScalingGroup var schedule schedule scheduledAction := awscdk.Aws_autoscaling.NewScheduledAction(this, jsii.String("MyScheduledAction"), &ScheduledActionProps{ AutoScalingGroup: autoScalingGroup, Schedule: schedule, // the properties below are optional DesiredCapacity: jsii.Number(123), EndTime: NewDate(), MaxCapacity: jsii.Number(123), MinCapacity: jsii.Number(123), StartTime: NewDate(), TimeZone: jsii.String("timeZone"), })
func NewScheduledAction ¶
func NewScheduledAction(scope constructs.Construct, id *string, props *ScheduledActionProps) ScheduledAction
type ScheduledActionProps ¶
type ScheduledActionProps struct { // When to perform this action. // // Supports cron expressions. // // For more information about cron expressions, see https://en.wikipedia.org/wiki/Cron. Schedule Schedule `field:"required" json:"schedule" yaml:"schedule"` // The new desired capacity. // // At the scheduled time, set the desired capacity to the given capacity. // // At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied. DesiredCapacity *float64 `field:"optional" json:"desiredCapacity" yaml:"desiredCapacity"` // When this scheduled action expires. EndTime *time.Time `field:"optional" json:"endTime" yaml:"endTime"` // The new maximum capacity. // // At the scheduled time, set the maximum capacity to the given capacity. // // At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied. MaxCapacity *float64 `field:"optional" json:"maxCapacity" yaml:"maxCapacity"` // The new minimum capacity. // // At the scheduled time, set the minimum capacity to the given capacity. // // At least one of maxCapacity, minCapacity, or desiredCapacity must be supplied. MinCapacity *float64 `field:"optional" json:"minCapacity" yaml:"minCapacity"` // When this scheduled action becomes active. StartTime *time.Time `field:"optional" json:"startTime" yaml:"startTime"` // Specifies the time zone for a cron expression. // // If a time zone is not provided, UTC is used by default. // // Valid values are the canonical names of the IANA time zones, derived from the IANA Time Zone Database (such as Etc/GMT+9 or Pacific/Tahiti). // // For more information, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. TimeZone *string `field:"optional" json:"timeZone" yaml:"timeZone"` // The AutoScalingGroup to apply the scheduled actions to. AutoScalingGroup IAutoScalingGroup `field:"required" json:"autoScalingGroup" yaml:"autoScalingGroup"` }
Properties for a scheduled action on an AutoScalingGroup.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var autoScalingGroup autoScalingGroup var schedule schedule scheduledActionProps := &ScheduledActionProps{ AutoScalingGroup: autoScalingGroup, Schedule: schedule, // the properties below are optional DesiredCapacity: jsii.Number(123), EndTime: NewDate(), MaxCapacity: jsii.Number(123), MinCapacity: jsii.Number(123), StartTime: NewDate(), TimeZone: jsii.String("timeZone"), }
type Signals ¶
type Signals interface { // Helper to render the actual creation policy, as the logic between them is quite similar. DoRender(options *SignalsOptions, count *float64) *awscdk.CfnCreationPolicy // Render the ASG's CreationPolicy. RenderCreationPolicy(renderOptions *RenderSignalsOptions) *awscdk.CfnCreationPolicy }
Configure whether the AutoScalingGroup waits for signals.
If you do configure waiting for signals, you should make sure the instances invoke `cfn-signal` somewhere in their UserData to signal that they have started up (either successfully or unsuccessfully).
Signals are used both during intial creation and subsequent updates.
Example:
var vpc vpc var instanceType instanceType var machineImage iMachineImage autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, InstanceType: InstanceType, MachineImage: MachineImage, // ... Init: ec2.CloudFormationInit_FromElements(ec2.InitFile_FromString(jsii.String("/etc/my_instance"), jsii.String("This got written during instance startup"))), Signals: autoscaling.Signals_WaitForAll(&SignalsOptions{ Timeout: awscdk.Duration_Minutes(jsii.Number(10)), }), })
func Signals_WaitForAll ¶
func Signals_WaitForAll(options *SignalsOptions) Signals
Wait for the desiredCapacity of the AutoScalingGroup amount of signals to have been received.
If no desiredCapacity has been configured, wait for minCapacity signals intead.
This number is used during initial creation and during replacing updates. During rolling updates, all updated instances must send a signal.
func Signals_WaitForCount ¶
func Signals_WaitForCount(count *float64, options *SignalsOptions) Signals
Wait for a specific amount of signals to have been received.
You should send one signal per instance, so this represents the number of instances to wait for.
This number is used during initial creation and during replacing updates. During rolling updates, all updated instances must send a signal.
func Signals_WaitForMinCapacity ¶
func Signals_WaitForMinCapacity(options *SignalsOptions) Signals
Wait for the minCapacity of the AutoScalingGroup amount of signals to have been received.
This number is used during initial creation and during replacing updates. During rolling updates, all updated instances must send a signal.
type SignalsOptions ¶
type SignalsOptions struct { // The percentage of signals that need to be successful. // // If this number is less than 100, a percentage of signals may be failure // signals while still succeeding the creation or update in CloudFormation. MinSuccessPercentage *float64 `field:"optional" json:"minSuccessPercentage" yaml:"minSuccessPercentage"` // How long to wait for the signals to be sent. // // This should reflect how long it takes your instances to start up // (including instance start time and instance initialization time). Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"` }
Customization options for Signal handling.
Example:
var vpc vpc var instanceType instanceType var machineImage iMachineImage autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, InstanceType: InstanceType, MachineImage: MachineImage, // ... Init: ec2.CloudFormationInit_FromElements(ec2.InitFile_FromString(jsii.String("/etc/my_instance"), jsii.String("This got written during instance startup"))), Signals: autoscaling.Signals_WaitForAll(&SignalsOptions{ Timeout: awscdk.Duration_Minutes(jsii.Number(10)), }), })
type SpotAllocationStrategy ¶ added in v2.21.0
type SpotAllocationStrategy string
Indicates how to allocate instance types to fulfill Spot capacity.
const ( // The Auto Scaling group launches instances using the Spot pools with the lowest price, and evenly allocates your instances across the number of Spot pools that you specify. SpotAllocationStrategy_LOWEST_PRICE SpotAllocationStrategy = "LOWEST_PRICE" // The Auto Scaling group launches instances using Spot pools that are optimally chosen based on the available Spot capacity. // // Recommended. SpotAllocationStrategy_CAPACITY_OPTIMIZED SpotAllocationStrategy = "CAPACITY_OPTIMIZED" // When you use this strategy, you need to set the order of instance types in the list of launch template overrides from highest to lowest priority (from first to last in the list). // // Amazon EC2 Auto Scaling // honors the instance type priorities on a best-effort basis but optimizes for capacity first. SpotAllocationStrategy_CAPACITY_OPTIMIZED_PRIORITIZED SpotAllocationStrategy = "CAPACITY_OPTIMIZED_PRIORITIZED" // The price and capacity optimized allocation strategy looks at both price and capacity to select the Spot Instance pools that are the least likely to be interrupted and have the lowest possible price. SpotAllocationStrategy_PRICE_CAPACITY_OPTIMIZED SpotAllocationStrategy = "PRICE_CAPACITY_OPTIMIZED" )
type StepScalingAction ¶
type StepScalingAction interface { constructs.Construct // The tree node. Node() constructs.Node // ARN of the scaling policy. ScalingPolicyArn() *string // Add an adjusment interval to the ScalingAction. AddAdjustment(adjustment *AdjustmentTier) // Returns a string representation of this construct. ToString() *string }
Define a step scaling action.
This kind of scaling policy adjusts the target capacity in configurable steps. The size of the step is configurable based on the metric's distance to its alarm threshold.
This Action must be used as the target of a CloudWatch alarm to take effect.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var autoScalingGroup autoScalingGroup stepScalingAction := awscdk.Aws_autoscaling.NewStepScalingAction(this, jsii.String("MyStepScalingAction"), &StepScalingActionProps{ AutoScalingGroup: autoScalingGroup, // the properties below are optional AdjustmentType: awscdk.*Aws_autoscaling.AdjustmentType_CHANGE_IN_CAPACITY, Cooldown: cdk.Duration_Minutes(jsii.Number(30)), EstimatedInstanceWarmup: cdk.Duration_*Minutes(jsii.Number(30)), MetricAggregationType: awscdk.*Aws_autoscaling.MetricAggregationType_AVERAGE, MinAdjustmentMagnitude: jsii.Number(123), })
func NewStepScalingAction ¶
func NewStepScalingAction(scope constructs.Construct, id *string, props *StepScalingActionProps) StepScalingAction
type StepScalingActionProps ¶
type StepScalingActionProps struct { // The auto scaling group. AutoScalingGroup IAutoScalingGroup `field:"required" json:"autoScalingGroup" yaml:"autoScalingGroup"` // How the adjustment numbers are interpreted. AdjustmentType AdjustmentType `field:"optional" json:"adjustmentType" yaml:"adjustmentType"` // Period after a scaling completes before another scaling activity can start. Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // Estimated time until a newly launched instance can send metrics to CloudWatch. EstimatedInstanceWarmup awscdk.Duration `field:"optional" json:"estimatedInstanceWarmup" yaml:"estimatedInstanceWarmup"` // The aggregation type for the CloudWatch metrics. MetricAggregationType MetricAggregationType `field:"optional" json:"metricAggregationType" yaml:"metricAggregationType"` // Minimum absolute number to adjust capacity with as result of percentage scaling. // // Only when using AdjustmentType = PercentChangeInCapacity, this number controls // the minimum absolute effect size. MinAdjustmentMagnitude *float64 `field:"optional" json:"minAdjustmentMagnitude" yaml:"minAdjustmentMagnitude"` }
Properties for a scaling policy.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var autoScalingGroup autoScalingGroup stepScalingActionProps := &StepScalingActionProps{ AutoScalingGroup: autoScalingGroup, // the properties below are optional AdjustmentType: awscdk.Aws_autoscaling.AdjustmentType_CHANGE_IN_CAPACITY, Cooldown: cdk.Duration_Minutes(jsii.Number(30)), EstimatedInstanceWarmup: cdk.Duration_*Minutes(jsii.Number(30)), MetricAggregationType: awscdk.*Aws_autoscaling.MetricAggregationType_AVERAGE, MinAdjustmentMagnitude: jsii.Number(123), }
type StepScalingPolicy ¶
type StepScalingPolicy interface { constructs.Construct LowerAction() StepScalingAction LowerAlarm() awscloudwatch.Alarm // The tree node. Node() constructs.Node UpperAction() StepScalingAction UpperAlarm() awscloudwatch.Alarm // Returns a string representation of this construct. ToString() *string }
Define a acaling strategy which scales depending on absolute values of some metric.
You can specify the scaling behavior for various values of the metric.
Implemented using one or more CloudWatch alarms and Step Scaling Policies.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var autoScalingGroup autoScalingGroup var metric metric stepScalingPolicy := awscdk.Aws_autoscaling.NewStepScalingPolicy(this, jsii.String("MyStepScalingPolicy"), &StepScalingPolicyProps{ AutoScalingGroup: autoScalingGroup, Metric: metric, ScalingSteps: []scalingInterval{ &scalingInterval{ Change: jsii.Number(123), // the properties below are optional Lower: jsii.Number(123), Upper: jsii.Number(123), }, }, // the properties below are optional AdjustmentType: awscdk.*Aws_autoscaling.AdjustmentType_CHANGE_IN_CAPACITY, Cooldown: cdk.Duration_Minutes(jsii.Number(30)), EstimatedInstanceWarmup: cdk.Duration_*Minutes(jsii.Number(30)), EvaluationPeriods: jsii.Number(123), MetricAggregationType: awscdk.*Aws_autoscaling.MetricAggregationType_AVERAGE, MinAdjustmentMagnitude: jsii.Number(123), })
func NewStepScalingPolicy ¶
func NewStepScalingPolicy(scope constructs.Construct, id *string, props *StepScalingPolicyProps) StepScalingPolicy
type StepScalingPolicyProps ¶
type StepScalingPolicyProps struct { // Metric to scale on. Metric awscloudwatch.IMetric `field:"required" json:"metric" yaml:"metric"` // The intervals for scaling. // // Maps a range of metric values to a particular scaling behavior. ScalingSteps *[]*ScalingInterval `field:"required" json:"scalingSteps" yaml:"scalingSteps"` // How the adjustment numbers inside 'intervals' are interpreted. AdjustmentType AdjustmentType `field:"optional" json:"adjustmentType" yaml:"adjustmentType"` // Grace period after scaling activity. Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // Estimated time until a newly launched instance can send metrics to CloudWatch. EstimatedInstanceWarmup awscdk.Duration `field:"optional" json:"estimatedInstanceWarmup" yaml:"estimatedInstanceWarmup"` // How many evaluation periods of the metric to wait before triggering a scaling action. // // Raising this value can be used to smooth out the metric, at the expense // of slower response times. EvaluationPeriods *float64 `field:"optional" json:"evaluationPeriods" yaml:"evaluationPeriods"` // Aggregation to apply to all data points over the evaluation periods. // // Only has meaning if `evaluationPeriods != 1`. MetricAggregationType MetricAggregationType `field:"optional" json:"metricAggregationType" yaml:"metricAggregationType"` // Minimum absolute number to adjust capacity with as result of percentage scaling. // // Only when using AdjustmentType = PercentChangeInCapacity, this number controls // the minimum absolute effect size. MinAdjustmentMagnitude *float64 `field:"optional" json:"minAdjustmentMagnitude" yaml:"minAdjustmentMagnitude"` // The auto scaling group. AutoScalingGroup IAutoScalingGroup `field:"required" json:"autoScalingGroup" yaml:"autoScalingGroup"` }
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var autoScalingGroup autoScalingGroup var metric metric stepScalingPolicyProps := &StepScalingPolicyProps{ AutoScalingGroup: autoScalingGroup, Metric: metric, ScalingSteps: []scalingInterval{ &scalingInterval{ Change: jsii.Number(123), // the properties below are optional Lower: jsii.Number(123), Upper: jsii.Number(123), }, }, // the properties below are optional AdjustmentType: awscdk.Aws_autoscaling.AdjustmentType_CHANGE_IN_CAPACITY, Cooldown: cdk.Duration_Minutes(jsii.Number(30)), EstimatedInstanceWarmup: cdk.Duration_*Minutes(jsii.Number(30)), EvaluationPeriods: jsii.Number(123), MetricAggregationType: awscdk.*Aws_autoscaling.MetricAggregationType_AVERAGE, MinAdjustmentMagnitude: jsii.Number(123), }
type TargetTrackingScalingPolicy ¶
type TargetTrackingScalingPolicy interface { constructs.Construct // The tree node. Node() constructs.Node // ARN of the scaling policy. ScalingPolicyArn() *string // Returns a string representation of this construct. ToString() *string }
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var autoScalingGroup autoScalingGroup var metric metric targetTrackingScalingPolicy := awscdk.Aws_autoscaling.NewTargetTrackingScalingPolicy(this, jsii.String("MyTargetTrackingScalingPolicy"), &TargetTrackingScalingPolicyProps{ AutoScalingGroup: autoScalingGroup, TargetValue: jsii.Number(123), // the properties below are optional Cooldown: cdk.Duration_Minutes(jsii.Number(30)), CustomMetric: metric, DisableScaleIn: jsii.Boolean(false), EstimatedInstanceWarmup: cdk.Duration_*Minutes(jsii.Number(30)), PredefinedMetric: awscdk.*Aws_autoscaling.PredefinedMetric_ASG_AVERAGE_CPU_UTILIZATION, ResourceLabel: jsii.String("resourceLabel"), })
func NewTargetTrackingScalingPolicy ¶
func NewTargetTrackingScalingPolicy(scope constructs.Construct, id *string, props *TargetTrackingScalingPolicyProps) TargetTrackingScalingPolicy
type TargetTrackingScalingPolicyProps ¶
type TargetTrackingScalingPolicyProps struct { // Period after a scaling completes before another scaling activity can start. Cooldown awscdk.Duration `field:"optional" json:"cooldown" yaml:"cooldown"` // Indicates whether scale in by the target tracking policy is disabled. // // If the value is true, scale in is disabled and the target tracking policy // won't remove capacity from the autoscaling group. Otherwise, scale in is // enabled and the target tracking policy can remove capacity from the // group. DisableScaleIn *bool `field:"optional" json:"disableScaleIn" yaml:"disableScaleIn"` // Estimated time until a newly launched instance can send metrics to CloudWatch. EstimatedInstanceWarmup awscdk.Duration `field:"optional" json:"estimatedInstanceWarmup" yaml:"estimatedInstanceWarmup"` // The target value for the metric. TargetValue *float64 `field:"required" json:"targetValue" yaml:"targetValue"` // A custom metric for application autoscaling. // // The metric must track utilization. Scaling out will happen if the metric is higher than // the target value, scaling in will happen in the metric is lower than the target value. // // Exactly one of customMetric or predefinedMetric must be specified. CustomMetric awscloudwatch.IMetric `field:"optional" json:"customMetric" yaml:"customMetric"` // A predefined metric for application autoscaling. // // The metric must track utilization. Scaling out will happen if the metric is higher than // the target value, scaling in will happen in the metric is lower than the target value. // // Exactly one of customMetric or predefinedMetric must be specified. PredefinedMetric PredefinedMetric `field:"optional" json:"predefinedMetric" yaml:"predefinedMetric"` // The resource label associated with the predefined metric. // // Should be supplied if the predefined metric is ALBRequestCountPerTarget, and the // format should be: // // app/<load-balancer-name>/<load-balancer-id>/targetgroup/<target-group-name>/<target-group-id>. ResourceLabel *string `field:"optional" json:"resourceLabel" yaml:"resourceLabel"` AutoScalingGroup IAutoScalingGroup `field:"required" json:"autoScalingGroup" yaml:"autoScalingGroup"` }
Properties for a concrete TargetTrackingPolicy.
Adds the scalingTarget.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" import "github.com/aws/aws-cdk-go/awscdk" var autoScalingGroup autoScalingGroup var metric metric targetTrackingScalingPolicyProps := &TargetTrackingScalingPolicyProps{ AutoScalingGroup: autoScalingGroup, TargetValue: jsii.Number(123), // the properties below are optional Cooldown: cdk.Duration_Minutes(jsii.Number(30)), CustomMetric: metric, DisableScaleIn: jsii.Boolean(false), EstimatedInstanceWarmup: cdk.Duration_*Minutes(jsii.Number(30)), PredefinedMetric: awscdk.Aws_autoscaling.PredefinedMetric_ASG_AVERAGE_CPU_UTILIZATION, ResourceLabel: jsii.String("resourceLabel"), }
type TerminationPolicy ¶ added in v2.4.0
type TerminationPolicy string
Specifies the termination criteria to apply before Amazon EC2 Auto Scaling chooses an instance for termination.
Example:
var vpc vpc var instanceType instanceType var machineImage iMachineImage autoscaling.NewAutoScalingGroup(this, jsii.String("ASG"), &AutoScalingGroupProps{ Vpc: Vpc, InstanceType: InstanceType, MachineImage: MachineImage, // ... TerminationPolicies: []terminationPolicy{ autoscaling.*terminationPolicy_OLDEST_INSTANCE, autoscaling.*terminationPolicy_DEFAULT, }, })
const ( // Terminate instances in the Auto Scaling group to align the remaining instances to the allocation strategy for the type of instance that is terminating (either a Spot Instance or an On-Demand Instance). TerminationPolicy_ALLOCATION_STRATEGY TerminationPolicy = "ALLOCATION_STRATEGY" // Terminate instances that are closest to the next billing hour. TerminationPolicy_CLOSEST_TO_NEXT_INSTANCE_HOUR TerminationPolicy = "CLOSEST_TO_NEXT_INSTANCE_HOUR" // Terminate instances according to the default termination policy. TerminationPolicy_DEFAULT TerminationPolicy = "DEFAULT" // Terminate the newest instance in the group. TerminationPolicy_NEWEST_INSTANCE TerminationPolicy = "NEWEST_INSTANCE" // Terminate the oldest instance in the group. TerminationPolicy_OLDEST_INSTANCE TerminationPolicy = "OLDEST_INSTANCE" // Terminate instances that have the oldest launch configuration. TerminationPolicy_OLDEST_LAUNCH_CONFIGURATION TerminationPolicy = "OLDEST_LAUNCH_CONFIGURATION" // Terminate instances that have the oldest launch template. TerminationPolicy_OLDEST_LAUNCH_TEMPLATE TerminationPolicy = "OLDEST_LAUNCH_TEMPLATE" )
type UpdatePolicy ¶
type UpdatePolicy interface { }
How existing instances should be updated.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" updatePolicy := awscdk.Aws_autoscaling.UpdatePolicy_ReplacingUpdate()
func UpdatePolicy_ReplacingUpdate ¶
func UpdatePolicy_ReplacingUpdate() UpdatePolicy
Create a new AutoScalingGroup and switch over to it.
func UpdatePolicy_RollingUpdate ¶
func UpdatePolicy_RollingUpdate(options *RollingUpdateOptions) UpdatePolicy
Replace the instances in the AutoScalingGroup one by one, or in batches.
type WarmPool ¶ added in v2.18.0
type WarmPool interface { awscdk.Resource // The environment this resource belongs to. // // For resources that are created and managed by the CDK // (generally, those created by creating new class instances like Role, Bucket, etc.), // this is always the same as the environment of the stack they belong to; // however, for imported resources // (those obtained from static methods like fromRoleArn, fromBucketName, etc.), // that might be different than the stack they were imported into. Env() *awscdk.ResourceEnvironment // The tree node. Node() constructs.Node // Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource. // // This value will resolve to one of the following: // - a concrete value (e.g. `"my-awesome-bucket"`) // - `undefined`, when a name should be generated by CloudFormation // - a concrete name generated automatically during synthesis, in // cross-environment scenarios. PhysicalName() *string // The stack in which this resource is defined. Stack() awscdk.Stack // Apply the given removal policy to this resource. // // The Removal Policy controls what happens to this resource when it stops // being managed by CloudFormation, either because you've removed it from the // CDK application or because you've made a change that requires the resource // to be replaced. // // The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS // account for data recovery and cleanup later (`RemovalPolicy.RETAIN`). ApplyRemovalPolicy(policy awscdk.RemovalPolicy) GeneratePhysicalName() *string // Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`). // // Normally, this token will resolve to `arnAttr`, but if the resource is // referenced across environments, `arnComponents` will be used to synthesize // a concrete ARN with the resource's physical name. Make sure to reference // `this.physicalName` in `arnComponents`. GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string // Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`). // // Normally, this token will resolve to `nameAttr`, but if the resource is // referenced across environments, it will be resolved to `this.physicalName`, // which will be a concrete name. GetResourceNameAttribute(nameAttr *string) *string // Returns a string representation of this construct. ToString() *string }
Define a warm pool.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var autoScalingGroup autoScalingGroup warmPool := awscdk.Aws_autoscaling.NewWarmPool(this, jsii.String("MyWarmPool"), &WarmPoolProps{ AutoScalingGroup: autoScalingGroup, // the properties below are optional MaxGroupPreparedCapacity: jsii.Number(123), MinSize: jsii.Number(123), PoolState: awscdk.*Aws_autoscaling.PoolState_HIBERNATED, ReuseOnScaleIn: jsii.Boolean(false), })
func NewWarmPool ¶ added in v2.18.0
func NewWarmPool(scope constructs.Construct, id *string, props *WarmPoolProps) WarmPool
type WarmPoolOptions ¶ added in v2.18.0
type WarmPoolOptions struct { // The maximum number of instances that are allowed to be in the warm pool or in any state except Terminated for the Auto Scaling group. // // If the value is not specified, Amazon EC2 Auto Scaling launches and maintains // the difference between the group's maximum capacity and its desired capacity. MaxGroupPreparedCapacity *float64 `field:"optional" json:"maxGroupPreparedCapacity" yaml:"maxGroupPreparedCapacity"` // The minimum number of instances to maintain in the warm pool. MinSize *float64 `field:"optional" json:"minSize" yaml:"minSize"` // The instance state to transition to after the lifecycle actions are complete. PoolState PoolState `field:"optional" json:"poolState" yaml:"poolState"` // Indicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in. // // If the value is not specified, instances in the Auto Scaling group will be terminated // when the group scales in. ReuseOnScaleIn *bool `field:"optional" json:"reuseOnScaleIn" yaml:"reuseOnScaleIn"` }
Options for a warm pool.
Example:
var autoScalingGroup autoScalingGroup autoScalingGroup.addWarmPool(&WarmPoolOptions{ MinSize: jsii.Number(1), ReuseOnScaleIn: jsii.Boolean(true), })
type WarmPoolProps ¶ added in v2.18.0
type WarmPoolProps struct { // The maximum number of instances that are allowed to be in the warm pool or in any state except Terminated for the Auto Scaling group. // // If the value is not specified, Amazon EC2 Auto Scaling launches and maintains // the difference between the group's maximum capacity and its desired capacity. MaxGroupPreparedCapacity *float64 `field:"optional" json:"maxGroupPreparedCapacity" yaml:"maxGroupPreparedCapacity"` // The minimum number of instances to maintain in the warm pool. MinSize *float64 `field:"optional" json:"minSize" yaml:"minSize"` // The instance state to transition to after the lifecycle actions are complete. PoolState PoolState `field:"optional" json:"poolState" yaml:"poolState"` // Indicates whether instances in the Auto Scaling group can be returned to the warm pool on scale in. // // If the value is not specified, instances in the Auto Scaling group will be terminated // when the group scales in. ReuseOnScaleIn *bool `field:"optional" json:"reuseOnScaleIn" yaml:"reuseOnScaleIn"` // The Auto Scaling group to add the warm pool to. AutoScalingGroup IAutoScalingGroup `field:"required" json:"autoScalingGroup" yaml:"autoScalingGroup"` }
Properties for a warm pool.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import "github.com/aws/aws-cdk-go/awscdk" var autoScalingGroup autoScalingGroup warmPoolProps := &WarmPoolProps{ AutoScalingGroup: autoScalingGroup, // the properties below are optional MaxGroupPreparedCapacity: jsii.Number(123), MinSize: jsii.Number(123), PoolState: awscdk.Aws_autoscaling.PoolState_HIBERNATED, ReuseOnScaleIn: jsii.Boolean(false), }
Source Files ¶
- AdjustmentTier.go
- AdjustmentType.go
- ApplyCloudFormationInitOptions.go
- AutoScalingGroup.go
- AutoScalingGroupProps.go
- AutoScalingGroupRequireImdsv2Aspect.go
- AutoScalingGroupRequireImdsv2Aspect__checks.go
- AutoScalingGroup__checks.go
- BaseTargetTrackingProps.go
- BasicLifecycleHookProps.go
- BasicScheduledActionProps.go
- BasicStepScalingPolicyProps.go
- BasicTargetTrackingScalingPolicyProps.go
- BindHookTargetOptions.go
- BlockDevice.go
- BlockDeviceVolume.go
- BlockDeviceVolume__checks.go
- CfnAutoScalingGroup.go
- CfnAutoScalingGroupProps.go
- CfnAutoScalingGroup_AcceleratorCountRequestProperty.go
- CfnAutoScalingGroup_AcceleratorTotalMemoryMiBRequestProperty.go
- CfnAutoScalingGroup_BaselineEbsBandwidthMbpsRequestProperty.go
- CfnAutoScalingGroup_InstanceRequirementsProperty.go
- CfnAutoScalingGroup_InstancesDistributionProperty.go
- CfnAutoScalingGroup_LaunchTemplateOverridesProperty.go
- CfnAutoScalingGroup_LaunchTemplateProperty.go
- CfnAutoScalingGroup_LaunchTemplateSpecificationProperty.go
- CfnAutoScalingGroup_LifecycleHookSpecificationProperty.go
- CfnAutoScalingGroup_MemoryGiBPerVCpuRequestProperty.go
- CfnAutoScalingGroup_MemoryMiBRequestProperty.go
- CfnAutoScalingGroup_MetricsCollectionProperty.go
- CfnAutoScalingGroup_MixedInstancesPolicyProperty.go
- CfnAutoScalingGroup_NetworkBandwidthGbpsRequestProperty.go
- CfnAutoScalingGroup_NetworkInterfaceCountRequestProperty.go
- CfnAutoScalingGroup_NotificationConfigurationProperty.go
- CfnAutoScalingGroup_TagPropertyProperty.go
- CfnAutoScalingGroup_TotalLocalStorageGBRequestProperty.go
- CfnAutoScalingGroup_VCpuCountRequestProperty.go
- CfnAutoScalingGroup__checks.go
- CfnLaunchConfiguration.go
- CfnLaunchConfigurationProps.go
- CfnLaunchConfiguration_BlockDeviceMappingProperty.go
- CfnLaunchConfiguration_BlockDeviceProperty.go
- CfnLaunchConfiguration_MetadataOptionsProperty.go
- CfnLaunchConfiguration__checks.go
- CfnLifecycleHook.go
- CfnLifecycleHookProps.go
- CfnLifecycleHook__checks.go
- CfnScalingPolicy.go
- CfnScalingPolicyProps.go
- CfnScalingPolicy_CustomizedMetricSpecificationProperty.go
- CfnScalingPolicy_MetricDataQueryProperty.go
- CfnScalingPolicy_MetricDimensionProperty.go
- CfnScalingPolicy_MetricProperty.go
- CfnScalingPolicy_MetricStatProperty.go
- CfnScalingPolicy_PredefinedMetricSpecificationProperty.go
- CfnScalingPolicy_PredictiveScalingConfigurationProperty.go
- CfnScalingPolicy_PredictiveScalingCustomizedCapacityMetricProperty.go
- CfnScalingPolicy_PredictiveScalingCustomizedLoadMetricProperty.go
- CfnScalingPolicy_PredictiveScalingCustomizedScalingMetricProperty.go
- CfnScalingPolicy_PredictiveScalingMetricSpecificationProperty.go
- CfnScalingPolicy_PredictiveScalingPredefinedLoadMetricProperty.go
- CfnScalingPolicy_PredictiveScalingPredefinedMetricPairProperty.go
- CfnScalingPolicy_PredictiveScalingPredefinedScalingMetricProperty.go
- CfnScalingPolicy_StepAdjustmentProperty.go
- CfnScalingPolicy_TargetTrackingConfigurationProperty.go
- CfnScalingPolicy__checks.go
- CfnScheduledAction.go
- CfnScheduledActionProps.go
- CfnScheduledAction__checks.go
- CfnWarmPool.go
- CfnWarmPoolProps.go
- CfnWarmPool_InstanceReusePolicyProperty.go
- CfnWarmPool__checks.go
- CommonAutoScalingGroupProps.go
- CpuUtilizationScalingProps.go
- CronOptions.go
- DefaultResult.go
- EbsDeviceOptions.go
- EbsDeviceOptionsBase.go
- EbsDeviceProps.go
- EbsDeviceSnapshotOptions.go
- EbsDeviceVolumeType.go
- Ec2HealthCheckOptions.go
- ElbHealthCheckOptions.go
- GroupMetric.go
- GroupMetric__checks.go
- GroupMetrics.go
- HealthCheck.go
- HealthCheck__checks.go
- IAutoScalingGroup.go
- IAutoScalingGroup__checks.go
- ILifecycleHook.go
- ILifecycleHookTarget.go
- ILifecycleHookTarget__checks.go
- InstancesDistribution.go
- LaunchTemplateOverrides.go
- LifecycleHook.go
- LifecycleHookProps.go
- LifecycleHookTargetConfig.go
- LifecycleHook__checks.go
- LifecycleTransition.go
- MetricAggregationType.go
- MetricTargetTrackingProps.go
- MixedInstancesPolicy.go
- Monitoring.go
- NetworkUtilizationScalingProps.go
- NotificationConfiguration.go
- OnDemandAllocationStrategy.go
- PoolState.go
- PredefinedMetric.go
- RenderSignalsOptions.go
- RequestCountScalingProps.go
- RollingUpdateOptions.go
- ScalingEvent.go
- ScalingEvents.go
- ScalingInterval.go
- ScalingProcess.go
- Schedule.go
- Schedule__checks.go
- ScheduledAction.go
- ScheduledActionProps.go
- ScheduledAction__checks.go
- Signals.go
- SignalsOptions.go
- Signals__checks.go
- SpotAllocationStrategy.go
- StepScalingAction.go
- StepScalingActionProps.go
- StepScalingAction__checks.go
- StepScalingPolicy.go
- StepScalingPolicyProps.go
- StepScalingPolicy__checks.go
- TargetTrackingScalingPolicy.go
- TargetTrackingScalingPolicyProps.go
- TargetTrackingScalingPolicy__checks.go
- TerminationPolicy.go
- UpdatePolicy.go
- UpdatePolicy__checks.go
- WarmPool.go
- WarmPoolOptions.go
- WarmPoolProps.go
- WarmPool__checks.go
- main.go