CmdID / aws / aws autoscaling
aws autoscaling describe-auto-scaling-groups
Gets information about the Auto Scaling groups in the account and Region. AWS CLI reference
5 examples 6 options Its page in the AWS CLI reference
Examples
Example 1: To describe the specified Auto Scaling group
The following describe-auto-scaling-groups example describes the specified Auto Scaling group.
aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names my-asgIdentify--auto-scaling-group-namesThe names of the Auto Scaling groups.Its output, shortened
{
"AutoScalingGroups": [
{
"AutoScalingGroupName": "my-asg",
"AutoScalingGroupARN": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:autoScalingGroupName/my-asg",
"LaunchTemplate": {
"LaunchTemplateName": "my-launch-template",
"Version": "1",
"LaunchTemplateId": "lt-1234567890abcde12"
},
"MinSize": 0,
"MaxSize": 1,
"DesiredCapacity": 1,
"DefaultCooldown": 300,
"AvailabilityZones": [
"us-west-2a",
"us-west-2b",
"us-west-2c"
],
"LoadBalancerNames": [],
"TargetGroupARNs": [],
"HealthCheckType": "EC2",
"HealthCheckGracePeriod": 0,
"Instances": [
{
"InstanceId": "i-06905f55584de02da",
"InstanceType": "t2.micro",
"AvailabilityZone": "us-west-2a",
"HealthStatus": "Healthy",
"LifecycleState": "InService",
… 22 more linesExample 2: To describe the first 100 specified Auto Scaling group
The following describe-auto-scaling-groups example describes the specified Auto Scaling groups. It allows you to specify up to 100 group names.
aws autoscaling describe-auto-scaling-groups --max-items 100 --auto-scaling-group-names "group1" "group2" "group3" "group4"Identify--auto-scaling-group-namesThe names of the Auto Scaling groups.Its output, shortened
{
"AutoScalingGroups": [
{
"AutoScalingGroupName": "group1",
"AutoScalingGroupARN": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:autoScalingGroupName/group1",
"LaunchTemplate": {
"LaunchTemplateName": "my-launch-template",
"Version": "1",
"LaunchTemplateId": "lt-1234567890abcde12"
},
"MinSize": 0,
"MaxSize": 1,
"DesiredCapacity": 0,
"DefaultCooldown": 300,
"AvailabilityZones": [
"us-west-2a",
"us-west-2b",
"us-west-2c"
],
"LoadBalancerNames": [],
"TargetGroupARNs": [],
"HealthCheckType": "EC2",
"HealthCheckGracePeriod": 0,
"Instances": [],
"CreatedTime": "2023-10-28T02:39:22.152Z",
"SuspendedProcesses": [],
"VPCZoneIdentifier": "subnet-5ea0c127,subnet-6194ea3b,subnet-c934b782",
"EnabledMetrics": [],
"Tags": [],
"TerminationPolicies": [
… 110 more linesExample 3: To describe an Auto Scaling group in the specified region
The following describe-auto-scaling-groups example describes the Auto Scaling groups in the specified region, up to a maximum of 75 groups.
aws autoscaling describe-auto-scaling-groups --max-items 75 --region us-west-2Identify--regionThe region to use.Its output, shortened
{
"AutoScalingGroups": [
{
"AutoScalingGroupName": "my-asg",
"AutoScalingGroupARN": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:a1b2c3d4-5678-90ab-cdef-EXAMPLE55555:autoScalingGroupName/my-asg",
"LaunchTemplate": {
"LaunchTemplateName": "my-launch-template",
"Version": "1",
"LaunchTemplateId": "lt-0123456789abcdef0"
},
"MinSize": 0,
"MaxSize": 1,
"DesiredCapacity": 1,
"DefaultCooldown": 300,
"AvailabilityZones": [
"us-west-2a",
"us-west-2b",
"us-west-2c"
],
"LoadBalancerNames": [],
"TargetGroupARNs": [],
"HealthCheckType": "EC2",
"HealthCheckGracePeriod": 0,
"Instances": [
{
"InstanceId": "i-0123456789abcdef0",
"InstanceType": "t2.micro",
"AvailabilityZone": "us-west-2a",
"HealthStatus": "Healthy",
"LifecycleState": "InService",
… 22 more linesExample 4: To describe the specified number of Auto Scaling group
The following describe-auto-scaling-groups example uses the --max-items option to return a specific number of Auto Scaling groups.
aws autoscaling describe-auto-scaling-groups --max-items 1IdentifyIts output, shortened
{
"AutoScalingGroups": [
{
"AutoScalingGroupName": "my-asg",
"AutoScalingGroupARN": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:autoScalingGroupName/my-asg",
"LaunchTemplate": {
"LaunchTemplateName": "my-launch-template",
"Version": "1",
"LaunchTemplateId": "lt-1234567890abcde12"
},
"MinSize": 0,
"MaxSize": 1,
"DesiredCapacity": 1,
"DefaultCooldown": 300,
"AvailabilityZones": [
"us-west-2a",
"us-west-2b",
"us-west-2c"
],
"LoadBalancerNames": [],
"TargetGroupARNs": [],
"HealthCheckType": "EC2",
"HealthCheckGracePeriod": 0,
"Instances": [
{
"InstanceId": "i-06905f55584de02da",
"InstanceType": "t2.micro",
"AvailabilityZone": "us-west-2a",
"HealthStatus": "Healthy",
"LifecycleState": "InService",
… 23 more linesIf the output includes a NextToken field, there are more groups. To get the additional groups, use the value of this field with the --starting-token option in a subsequent call as follows.
aws autoscaling describe-auto-scaling-groups --starting-token Z3M3LMPEXAMPLEIdentifySee example 1 for sample output.
Example 5: To describe Auto Scaling groups that use launch configurations
The following describe-auto-scaling-groups example uses the --query option to describe Auto Scaling groups that use launch configurations.
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[?LaunchConfigurationName!=`null`]'Identify--queryA JMESPath query to use in filtering the response data.Its output, shortened
[
{
"AutoScalingGroupName": "my-asg",
"AutoScalingGroupARN": "arn:aws:autoscaling:us-west-2:123456789012:autoScalingGroup:a1b2c3d4-5678-90ab-cdef-EXAMPLE11111:autoScalingGroupName/my-asg",
"LaunchConfigurationName": "my-lc",
"MinSize": 0,
"MaxSize": 1,
"DesiredCapacity": 1,
"DefaultCooldown": 300,
"AvailabilityZones": [
"us-west-2a",
"us-west-2b",
"us-west-2c"
],
"LoadBalancerNames": [],
"TargetGroupARNs": [],
"HealthCheckType": "EC2",
"HealthCheckGracePeriod": 0,
"Instances": [
{
"InstanceId": "i-088c57934a6449037",
"InstanceType": "t2.micro",
"AvailabilityZone": "us-west-2c",
"HealthStatus": "Healthy",
"LifecycleState": "InService",
"LaunchConfigurationName": "my-lc",
"ProtectedFromScaleIn": false
}
],
"CreatedTime": "2023-10-28T02:39:22.152Z",
… 12 more linesFor more information, see Filter AWS CLI output in the AWS Command Line Interface User Guide.
Options
--auto-scaling-group-namesThe names of the Auto Scaling groups.--filtersOne or more filters to limit the results based on specific tags.--include-instancesSpecifies whether to include information about Amazon EC2 instances in the response.--include-managed-resourcesSpecifies whether to include managed Auto Scaling groups in the response.--max-recordsThe maximum number of items to return with this call.--next-tokenThe token for the next set of items to return.