Class CfnAutoScalingGroup
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.
Inherited Members
Namespace: Amazon.CDK.AWS.AutoScaling
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnAutoScalingGroup : CfnResource, IInspectable, ITaggable
Syntax (vb)
Public Class CfnAutoScalingGroup
Inherits CfnResource
Implements IInspectable, ITaggable
Remarks
For more information about Amazon EC2 Auto Scaling, see the Amazon EC2 Auto Scaling User Guide .
Amazon EC2 Auto Scaling configures instances launched as part of an Auto Scaling group using either a launch template or a launch configuration. We strongly recommend that you do not use launch configurations. For more information, see Launch configurations in the Amazon EC2 Auto Scaling User Guide .
For help migrating from launch configurations to launch templates, see Migrate AWS CloudFormation stacks from launch configurations to launch templates in the Amazon EC2 Auto Scaling User Guide .
CloudformationResource: AWS::AutoScaling::AutoScalingGroup
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AutoScaling;
var cfnAutoScalingGroup = new CfnAutoScalingGroup(this, "MyCfnAutoScalingGroup", new CfnAutoScalingGroupProps {
MaxSize = "maxSize",
MinSize = "minSize",
// the properties below are optional
AutoScalingGroupName = "autoScalingGroupName",
AvailabilityZones = new [] { "availabilityZones" },
CapacityRebalance = false,
Context = "context",
Cooldown = "cooldown",
DefaultInstanceWarmup = 123,
DesiredCapacity = "desiredCapacity",
DesiredCapacityType = "desiredCapacityType",
HealthCheckGracePeriod = 123,
HealthCheckType = "healthCheckType",
InstanceId = "instanceId",
InstanceMaintenancePolicy = new InstanceMaintenancePolicyProperty {
MaxHealthyPercentage = 123,
MinHealthyPercentage = 123
},
LaunchConfigurationName = "launchConfigurationName",
LaunchTemplate = new LaunchTemplateSpecificationProperty {
Version = "version",
// the properties below are optional
LaunchTemplateId = "launchTemplateId",
LaunchTemplateName = "launchTemplateName"
},
LifecycleHookSpecificationList = new [] { new LifecycleHookSpecificationProperty {
LifecycleHookName = "lifecycleHookName",
LifecycleTransition = "lifecycleTransition",
// the properties below are optional
DefaultResult = "defaultResult",
HeartbeatTimeout = 123,
NotificationMetadata = "notificationMetadata",
NotificationTargetArn = "notificationTargetArn",
RoleArn = "roleArn"
} },
LoadBalancerNames = new [] { "loadBalancerNames" },
MaxInstanceLifetime = 123,
MetricsCollection = new [] { new MetricsCollectionProperty {
Granularity = "granularity",
// the properties below are optional
Metrics = new [] { "metrics" }
} },
MixedInstancesPolicy = new MixedInstancesPolicyProperty {
LaunchTemplate = new LaunchTemplateProperty {
LaunchTemplateSpecification = new LaunchTemplateSpecificationProperty {
Version = "version",
// the properties below are optional
LaunchTemplateId = "launchTemplateId",
LaunchTemplateName = "launchTemplateName"
},
// the properties below are optional
Overrides = new [] { new LaunchTemplateOverridesProperty {
InstanceRequirements = new InstanceRequirementsProperty {
MemoryMiB = new MemoryMiBRequestProperty {
Max = 123,
Min = 123
},
VCpuCount = new VCpuCountRequestProperty {
Max = 123,
Min = 123
},
// the properties below are optional
AcceleratorCount = new AcceleratorCountRequestProperty {
Max = 123,
Min = 123
},
AcceleratorManufacturers = new [] { "acceleratorManufacturers" },
AcceleratorNames = new [] { "acceleratorNames" },
AcceleratorTotalMemoryMiB = new AcceleratorTotalMemoryMiBRequestProperty {
Max = 123,
Min = 123
},
AcceleratorTypes = new [] { "acceleratorTypes" },
AllowedInstanceTypes = new [] { "allowedInstanceTypes" },
BareMetal = "bareMetal",
BaselineEbsBandwidthMbps = new BaselineEbsBandwidthMbpsRequestProperty {
Max = 123,
Min = 123
},
BurstablePerformance = "burstablePerformance",
CpuManufacturers = new [] { "cpuManufacturers" },
ExcludedInstanceTypes = new [] { "excludedInstanceTypes" },
InstanceGenerations = new [] { "instanceGenerations" },
LocalStorage = "localStorage",
LocalStorageTypes = new [] { "localStorageTypes" },
MaxSpotPriceAsPercentageOfOptimalOnDemandPrice = 123,
MemoryGiBPerVCpu = new MemoryGiBPerVCpuRequestProperty {
Max = 123,
Min = 123
},
NetworkBandwidthGbps = new NetworkBandwidthGbpsRequestProperty {
Max = 123,
Min = 123
},
NetworkInterfaceCount = new NetworkInterfaceCountRequestProperty {
Max = 123,
Min = 123
},
OnDemandMaxPricePercentageOverLowestPrice = 123,
RequireHibernateSupport = false,
SpotMaxPricePercentageOverLowestPrice = 123,
TotalLocalStorageGb = new TotalLocalStorageGBRequestProperty {
Max = 123,
Min = 123
}
},
InstanceType = "instanceType",
LaunchTemplateSpecification = new LaunchTemplateSpecificationProperty {
Version = "version",
// the properties below are optional
LaunchTemplateId = "launchTemplateId",
LaunchTemplateName = "launchTemplateName"
},
WeightedCapacity = "weightedCapacity"
} }
},
// the properties below are optional
InstancesDistribution = new InstancesDistributionProperty {
OnDemandAllocationStrategy = "onDemandAllocationStrategy",
OnDemandBaseCapacity = 123,
OnDemandPercentageAboveBaseCapacity = 123,
SpotAllocationStrategy = "spotAllocationStrategy",
SpotInstancePools = 123,
SpotMaxPrice = "spotMaxPrice"
}
},
NewInstancesProtectedFromScaleIn = false,
NotificationConfiguration = new NotificationConfigurationProperty {
TopicArn = "topicArn",
// the properties below are optional
NotificationTypes = new [] { "notificationTypes" }
},
NotificationConfigurations = new [] { new NotificationConfigurationProperty {
TopicArn = "topicArn",
// the properties below are optional
NotificationTypes = new [] { "notificationTypes" }
} },
PlacementGroup = "placementGroup",
ServiceLinkedRoleArn = "serviceLinkedRoleArn",
Tags = new [] { new TagPropertyProperty {
Key = "key",
PropagateAtLaunch = false,
Value = "value"
} },
TargetGroupArns = new [] { "targetGroupArns" },
TerminationPolicies = new [] { "terminationPolicies" },
VpcZoneIdentifier = new [] { "vpcZoneIdentifier" }
});
Synopsis
Constructors
CfnAutoScalingGroup(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CfnAutoScalingGroup(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CfnAutoScalingGroup(Construct, String, ICfnAutoScalingGroupProps) |
Properties
AutoScalingGroupName | The name of the Auto Scaling group. |
AvailabilityZones | A list of Availability Zones where instances in the Auto Scaling group can be created. |
CapacityRebalance | Indicates whether Capacity Rebalancing is enabled. |
CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
CfnProperties | |
Context | Reserved. |
Cooldown | Only needed if you use simple scaling policies.. |
DefaultInstanceWarmup | 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 |
DesiredCapacity | 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. |
DesiredCapacityType | The unit of measurement for the value specified for desired capacity. |
HealthCheckGracePeriod | 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. |
HealthCheckType | A comma-separated value string of one or more health check types. |
InstanceId | The ID of the instance used to base the launch configuration on. |
InstanceMaintenancePolicy | An instance maintenance policy. |
LaunchConfigurationName | The name of the launch configuration to use to launch instances. |
LaunchTemplate | Information used to specify the launch template and version to use to launch instances. |
LifecycleHookSpecificationList | One or more lifecycle hooks to add to the Auto Scaling group before instances are launched. |
LoadBalancerNames | A list of Classic Load Balancers associated with this Auto Scaling group. |
MaxInstanceLifetime | The maximum amount of time, in seconds, that an instance can be in service. |
MaxSize | The maximum size of the group. |
MetricsCollection | Enables the monitoring of group metrics of an Auto Scaling group. |
MinSize | The minimum size of the group. |
MixedInstancesPolicy | An embedded object that specifies a mixed instances policy. |
NewInstancesProtectedFromScaleIn | Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in. |
NotificationConfiguration | (deprecated) A structure that specifies an Amazon SNS notification configuration for the |
NotificationConfigurations | Configures an Auto Scaling group to send notifications when specified events take place. |
PlacementGroup | The name of the placement group into which to launch your instances. |
ServiceLinkedRoleArn | The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS service on your behalf. |
Tags | Tag Manager which manages the tags for this resource. |
TagsRaw | One or more tags. |
TargetGroupArns | The Amazon Resource Names (ARN) of the Elastic Load Balancing target groups to associate with the Auto Scaling group. |
TerminationPolicies | A policy or a list of policies that are used to select the instance to terminate. |
VpcZoneIdentifier | A list of subnet IDs for a virtual private cloud (VPC) where instances in the Auto Scaling group can be created. |
Methods
Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
RenderProperties(IDictionary<String, Object>) |
Constructors
CfnAutoScalingGroup(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CfnAutoScalingGroup(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CfnAutoScalingGroup(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CfnAutoScalingGroup(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CfnAutoScalingGroup(Construct, String, ICfnAutoScalingGroupProps)
public CfnAutoScalingGroup(Construct scope, string id, ICfnAutoScalingGroupProps props)
Parameters
- scope Constructs.Construct
Scope in which this resource is defined.
- id System.String
Construct identifier for this resource (unique in its scope).
- props ICfnAutoScalingGroupProps
Resource properties.
Properties
AutoScalingGroupName
The name of the Auto Scaling group.
public virtual string AutoScalingGroupName { get; set; }
Property Value
System.String
Remarks
This name must be unique per Region per account.
AvailabilityZones
A list of Availability Zones where instances in the Auto Scaling group can be created.
public virtual string[] AvailabilityZones { get; set; }
Property Value
System.String[]
CapacityRebalance
Indicates whether Capacity Rebalancing is enabled.
public virtual object CapacityRebalance { get; set; }
Property Value
System.Object
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
System.String
CfnProperties
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
System.Collections.Generic.IDictionary<System.String, System.Object>
Overrides
Context
Reserved.
public virtual string Context { get; set; }
Property Value
System.String
Cooldown
Only needed if you use simple scaling policies..
public virtual string Cooldown { get; set; }
Property Value
System.String
DefaultInstanceWarmup
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.
public virtual Nullable<double> DefaultInstanceWarmup { get; set; }
Property Value
System.Nullable<System.Double>
DesiredCapacity
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.
public virtual string DesiredCapacity { get; set; }
Property Value
System.String
DesiredCapacityType
The unit of measurement for the value specified for desired capacity.
public virtual string DesiredCapacityType { get; set; }
Property Value
System.String
HealthCheckGracePeriod
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.
public virtual Nullable<double> HealthCheckGracePeriod { get; set; }
Property Value
System.Nullable<System.Double>
HealthCheckType
A comma-separated value string of one or more health check types.
public virtual string HealthCheckType { get; set; }
Property Value
System.String
InstanceId
The ID of the instance used to base the launch configuration on.
public virtual string InstanceId { get; set; }
Property Value
System.String
InstanceMaintenancePolicy
An instance maintenance policy.
public virtual object InstanceMaintenancePolicy { get; set; }
Property Value
System.Object
LaunchConfigurationName
The name of the launch configuration to use to launch instances.
public virtual string LaunchConfigurationName { get; set; }
Property Value
System.String
LaunchTemplate
Information used to specify the launch template and version to use to launch instances.
public virtual object LaunchTemplate { get; set; }
Property Value
System.Object
LifecycleHookSpecificationList
One or more lifecycle hooks to add to the Auto Scaling group before instances are launched.
public virtual object LifecycleHookSpecificationList { get; set; }
Property Value
System.Object
LoadBalancerNames
A list of Classic Load Balancers associated with this Auto Scaling group.
public virtual string[] LoadBalancerNames { get; set; }
Property Value
System.String[]
MaxInstanceLifetime
The maximum amount of time, in seconds, that an instance can be in service.
public virtual Nullable<double> MaxInstanceLifetime { get; set; }
Property Value
System.Nullable<System.Double>
MaxSize
The maximum size of the group.
public virtual string MaxSize { get; set; }
Property Value
System.String
MetricsCollection
Enables the monitoring of group metrics of an Auto Scaling group.
public virtual object MetricsCollection { get; set; }
Property Value
System.Object
MinSize
The minimum size of the group.
public virtual string MinSize { get; set; }
Property Value
System.String
MixedInstancesPolicy
An embedded object that specifies a mixed instances policy.
public virtual object MixedInstancesPolicy { get; set; }
Property Value
System.Object
NewInstancesProtectedFromScaleIn
Indicates whether newly launched instances are protected from termination by Amazon EC2 Auto Scaling when scaling in.
public virtual object NewInstancesProtectedFromScaleIn { get; set; }
Property Value
System.Object
NotificationConfiguration
(deprecated) A structure that specifies an Amazon SNS notification configuration for the NotificationConfigurations
property of the AWS::AutoScaling::AutoScalingGroup resource. For an example template snippet, see Auto scaling template snippets. For more information, see Get Amazon SNS notifications when your Auto Scaling group scales in the Amazon EC2 Auto Scaling User Guide.
public virtual object NotificationConfiguration { get; set; }
Property Value
System.Object
Remarks
Stability: Deprecated
NotificationConfigurations
Configures an Auto Scaling group to send notifications when specified events take place.
public virtual object NotificationConfigurations { get; set; }
Property Value
System.Object
PlacementGroup
The name of the placement group into which to launch your instances.
public virtual string PlacementGroup { get; set; }
Property Value
System.String
ServiceLinkedRoleArn
The Amazon Resource Name (ARN) of the service-linked role that the Auto Scaling group uses to call other AWS service on your behalf.
public virtual string ServiceLinkedRoleArn { get; set; }
Property Value
System.String
Tags
Tag Manager which manages the tags for this resource.
public virtual TagManager Tags { get; }
Property Value
TagsRaw
One or more tags.
public virtual CfnAutoScalingGroup.ITagPropertyProperty[] TagsRaw { get; set; }
Property Value
CfnAutoScalingGroup.ITagPropertyProperty[]
TargetGroupArns
The Amazon Resource Names (ARN) of the Elastic Load Balancing target groups to associate with the Auto Scaling group.
public virtual string[] TargetGroupArns { get; set; }
Property Value
System.String[]
TerminationPolicies
A policy or a list of policies that are used to select the instance to terminate.
public virtual string[] TerminationPolicies { get; set; }
Property Value
System.String[]
VpcZoneIdentifier
A list of subnet IDs for a virtual private cloud (VPC) where instances in the Auto Scaling group can be created.
public virtual string[] VpcZoneIdentifier { get; set; }
Property Value
System.String[]
Methods
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
tree inspector to collect and process attributes.
RenderProperties(IDictionary<String, Object>)
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props System.Collections.Generic.IDictionary<System.String, System.Object>
Returns
System.Collections.Generic.IDictionary<System.String, System.Object>