AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
This is the response object from the CreateAutoScalingGroup operation.
Namespace: Amazon.AutoScaling.Model
Assembly: AWSSDK.AutoScaling.dll
Version: 3.x.y.z
public class CreateAutoScalingGroupResponse : AmazonWebServiceResponse
The CreateAutoScalingGroupResponse type exposes the following members
Name | Description | |
---|---|---|
CreateAutoScalingGroupResponse() |
Name | Type | Description | |
---|---|---|---|
ContentLength | System.Int64 | Inherited from Amazon.Runtime.AmazonWebServiceResponse. | |
HttpStatusCode | System.Net.HttpStatusCode | Inherited from Amazon.Runtime.AmazonWebServiceResponse. | |
ResponseMetadata | Amazon.Runtime.ResponseMetadata | Inherited from Amazon.Runtime.AmazonWebServiceResponse. |
This example creates an Auto Scaling group.
var client = new AmazonAutoScalingClient(); var response = client.CreateAutoScalingGroup(new CreateAutoScalingGroupRequest { AutoScalingGroupName = "my-auto-scaling-group", DefaultInstanceWarmup = 120, LaunchTemplate = new LaunchTemplateSpecification { LaunchTemplateName = "my-template-for-auto-scaling", Version = "$Default" }, MaxInstanceLifetime = 2592000, MaxSize = 3, MinSize = 1, VPCZoneIdentifier = "subnet-057fa0918fEXAMPLE" });
This example creates an Auto Scaling group and attaches the specified target group.
var client = new AmazonAutoScalingClient(); var response = client.CreateAutoScalingGroup(new CreateAutoScalingGroupRequest { AutoScalingGroupName = "my-auto-scaling-group", HealthCheckGracePeriod = 300, HealthCheckType = "ELB", LaunchTemplate = new LaunchTemplateSpecification { LaunchTemplateName = "my-template-for-auto-scaling", Version = "$Default" }, MaxSize = 3, MinSize = 1, TargetGroupARNs = new List<string> { "arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067" }, VPCZoneIdentifier = "subnet-057fa0918fEXAMPLE, subnet-610acd08EXAMPLE" });
This example creates an Auto Scaling group with a mixed instances policy. It specifies the c5.large, c5a.large, and c6g.large instance types and defines a different launch template for the c6g.large instance type.
var client = new AmazonAutoScalingClient(); var response = client.CreateAutoScalingGroup(new CreateAutoScalingGroupRequest { AutoScalingGroupName = "my-asg", DesiredCapacity = 3, MaxSize = 5, MinSize = 1, MixedInstancesPolicy = new MixedInstancesPolicy { InstancesDistribution = new InstancesDistribution { OnDemandBaseCapacity = 1, OnDemandPercentageAboveBaseCapacity = 50, SpotAllocationStrategy = "price-capacity-optimized" }, LaunchTemplate = new LaunchTemplate { LaunchTemplateSpecification = new LaunchTemplateSpecification { LaunchTemplateName = "my-launch-template-for-x86", Version = "$Default" }, Overrides = new List<LaunchTemplateOverrides> { new LaunchTemplateOverrides { InstanceType = "c6g.large", LaunchTemplateSpecification = new LaunchTemplateSpecification { LaunchTemplateName = "my-launch-template-for-arm", Version = "$Default" } }, new LaunchTemplateOverrides { InstanceType = "c5.large" }, new LaunchTemplateOverrides { InstanceType = "c5a.large" } } } }, VPCZoneIdentifier = "subnet-057fa0918fEXAMPLE, subnet-610acd08EXAMPLE" });
This example creates an Auto Scaling group using attribute-based instance type selection. It requires the instance types to have a minimum of four vCPUs and a maximum of eight vCPUs, a minimum of 16,384 MiB of memory, and an Intel manufactured CPU.
var client = new AmazonAutoScalingClient(); var response = client.CreateAutoScalingGroup(new CreateAutoScalingGroupRequest { AutoScalingGroupName = "my-asg", DesiredCapacity = 4, DesiredCapacityType = "units", MaxSize = 100, MinSize = 0, MixedInstancesPolicy = new MixedInstancesPolicy { InstancesDistribution = new InstancesDistribution { OnDemandPercentageAboveBaseCapacity = 50, SpotAllocationStrategy = "price-capacity-optimized" }, LaunchTemplate = new LaunchTemplate { LaunchTemplateSpecification = new LaunchTemplateSpecification { LaunchTemplateName = "my-template-for-auto-scaling", Version = "$Default" }, Overrides = new List<LaunchTemplateOverrides> { new LaunchTemplateOverrides { InstanceRequirements = new InstanceRequirements { CpuManufacturers = new List<string> { "intel" }, MemoryMiB = new MemoryMiBRequest { Min = 16384 }, VCpuCount = new VCpuCountRequest { Max = 8, Min = 4 } } } } } }, VPCZoneIdentifier = "subnet-057fa0918fEXAMPLE, subnet-610acd08EXAMPLE" });
.NET Core App:
Supported in: 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5, 4.0, 3.5