tencent cloud

Feedback

DescribeAutoScalingGroups

Last updated: 2024-10-25 15:16:09

    1. API Description

    Domain name for API request: as.tencentcloudapi.com.

    This API (DescribeAutoScalingGroups) is used to query the information of auto scaling groups.

    • You can query the details of auto scaling groups based on information such as auto scaling group ID, auto scaling group name, or launch configuration ID. For more information on filters, see Filter.
    • If the parameter is empty, a certain number (specified by Limit and 20 by default) of auto scaling groups of the current user will be returned.

    A maximum of 60 requests can be initiated per second for this API.

    We recommend you to use API Explorer
    Try it
    API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

    2. Input Parameters

    The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

    Parameter Name Required Type Description
    Action Yes String Common Params. The value used for this API: DescribeAutoScalingGroups.
    Version Yes String Common Params. The value used for this API: 2018-04-19.
    Region Yes String Common Params. For more information, please see the list of regions supported by the product.
    AutoScalingGroupIds.N No Array of String Queries by one or more auto scaling group IDs in the format of asg-nkdwoui0. The maximum quantity per request is 100. This parameter does not support specifying both AutoScalingGroupIds and Filters at the same time.
    Filters.N No Array of Filter Filters.
  • auto-scaling-group-id - String - Required: No - (Filter) Filter by auto scaling group ID.
  • auto-scaling-group-name - String - Required: No - (Filter) Filter by auto scaling group name.
  • vague-auto-scaling-group-name - String - Required: No - (Filter) Fuzzy search by auto scaling group name.
  • launch-configuration-id - String - Required: No - (Filter) Filter by launch configuration ID.
  • tag-key - String - Required: No - (Filter) Filter by tag key.
  • tag-value - String - Required: No - (Filter) Filter by tag value.
  • tag:tag-key - String - Required: No - (Filter) Filter by tag key-value pair. The tag-key should be replaced with a specified tag key. For more information, see example 2.

  • The maximum number of Filters in each request is 10. The upper limit for Filter.Values is 5. This parameter cannot specify AutoScalingGroupIds and Filters at the same time.
    Limit No Integer Number of returned results. Default value: 20. Maximum value: 100. For more information on Limit, see the relevant section in the API overview.
    Offset No Integer Offset. Default value: 0. For more information on Offset, see the relevant section in the API overview.

    3. Output Parameters

    Parameter Name Type Description
    AutoScalingGroupSet Array of AutoScalingGroup List of auto scaling group details.
    TotalCount Integer Number of eligible auto scaling groups.
    RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

    4. Example

    Example1 Querying scaling groups

    This example shows you how to query a scaling group by ID.

    Input Example

    POST / HTTP/1.1
    Host: as.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeAutoScalingGroups
    <Common request parameters>
    
    {
        "AutoScalingGroupIds": [
            "asg-pts6qcgp"
        ]
    }
    

    Output Example

    {
        "Response": {
            "AutoScalingGroupSet": [
                {
                    "InActivityStatus": "NOT_IN_ACTIVITY",
                    "LoadBalancerIdSet": [],
                    "RetryPolicy": "IMMEDIATE_RETRY",
                    "InServiceInstanceCount": 0,
                    "CreatedTime": "2022-04-21T03:21:14Z",
                    "SpotMixedAllocationPolicy": {
                        "CompensateWithBaseInstance": null,
                        "SpotAllocationStrategy": null,
                        "OnDemandPercentageAboveBaseCapacity": null,
                        "BaseCapacity": null
                    },
                    "VpcId": "vpc-lceuvai4",
                    "InstanceAllocationPolicy": "LAUNCH_CONFIGURATION",
                    "Tags": [],
                    "LaunchConfigurationId": "asc-mo1woym9",
                    "MaxSize": 1,
                    "MultiZoneSubnetPolicy": "PRIORITY",
                    "SubnetIdSet": [
                        "subnet-6qqolfi7"
                    ],
                    "HealthCheckType": "CLB",
                    "LoadBalancerHealthCheckGracePeriod": 0,
                    "ForwardLoadBalancerSet": [
                        {
                            "TargetAttributes": [
                                {
                                    "Port": 8080,
                                    "Weight": 10
                                }
                            ],
                            "Region": "ap-shanghai",
                            "LocationId": "loc-5dovrfov",
                            "ListenerId": "lbl-i4p05pmv",
                            "LoadBalancerId": "lb-pbx8nq2p"
                        }
                    ],
                    "ProjectId": 0,
                    "AutoScalingGroupName": "testasg",
                    "MinSize": 0,
                    "ServiceSettings": {
                        "ReplaceMonitorUnhealthy": false,
                        "ReplaceLoadBalancerUnhealthy": false,
                        "ScalingMode": "CLASSIC_SCALING"
                    },
                    "LaunchConfigurationName": "test",
                    "CapacityRebalance": false,
                    "TerminationPolicySet": [
                        "OLDEST_INSTANCE"
                    ],
                    "AutoScalingGroupStatus": "NORMAL",
                    "InstanceCount": 0,
                    "DesiredCapacity": 0,
                    "AutoScalingGroupId": "asg-pts6qcgp",
                    "Ipv6AddressCount": 0,
                    "DefaultCooldown": 300,
                    "EnabledStatus": "ENABLED",
                    "ZoneSet": []
                }
            ],
            "TotalCount": 1,
            "RequestId": "53a76c96-a88c-4972-8488-66d6c15a080f"
        }
    }
    

    Example2 Querying scaling groups bound with the tag

    This example shows you how to query scaling groups bound with the tag city:shenzhen.

    Input Example

    POST / HTTP/1.1
    Host: as.tencentcloudapi.com
    Content-Type: application/json
    X-TC-Action: DescribeAutoScalingGroups
    <Common request parameters>
    
    {
        "Limit": "1",
        "Filters": [
            {
                "Values": [
                    "shenzhen"
                ],
                "Name": "tag:city"
            }
        ],
        "Offset": "0"
    }
    

    Output Example

    {
        "Response": {
            "AutoScalingGroupSet": [
                {
                    "InActivityStatus": "NOT_IN_ACTIVITY",
                    "LoadBalancerIdSet": [],
                    "RetryPolicy": "IMMEDIATE_RETRY",
                    "InServiceInstanceCount": 0,
                    "CreatedTime": "2019-10-29T02:21:26Z",
                    "SpotMixedAllocationPolicy": {
                        "CompensateWithBaseInstance": null,
                        "SpotAllocationStrategy": null,
                        "OnDemandPercentageAboveBaseCapacity": null,
                        "BaseCapacity": null
                    },
                    "VpcId": "vpc-qmjyqjnk",
                    "InstanceAllocationPolicy": "LAUNCH_CONFIGURATION",
                    "Tags": [
                        {
                            "Key": "city",
                            "Value": "shenzhen"
                        }
                    ],
                    "LaunchConfigurationId": "asc-3d9e2zfx",
                    "MaxSize": 10,
                    "MultiZoneSubnetPolicy": "PRIORITY",
                    "SubnetIdSet": [
                        "subnet-3cpb9yfp",
                        "subnet-c98udmmr",
                        "subnet-1xsr551x",
                        "subnet-o3ibshdr",
                        "subnet-6c7q2jhz"
                    ],
                    "HealthCheckType": "CVM",
                    "LoadBalancerHealthCheckGracePeriod": 0,
                    "ForwardLoadBalancerSet": [
                        {
                            "TargetAttributes": [
                                {
                                    "Port": 8080,
                                    "Weight": 10
                                }
                            ],
                            "Region": "ap-shanghai",
                            "LocationId": "",
                            "ListenerId": "lbl-aiwdu9bd",
                            "LoadBalancerId": "lb-k264wzwj"
                        },
                        {
                            "TargetAttributes": [
                                {
                                    "Port": 80,
                                    "Weight": 10
                                }
                            ],
                            "Region": "ap-shanghai",
                            "LocationId": "loc-qmxmx085",
                            "ListenerId": "lbl-ldjbrn65",
                            "LoadBalancerId": "lb-k264wzwj"
                        }
                    ],
                    "ProjectId": 0,
                    "AutoScalingGroupName": "sz-asg",
                    "MinSize": 0,
                    "ServiceSettings": {
                        "ReplaceMonitorUnhealthy": false,
                        "ReplaceLoadBalancerUnhealthy": false,
                        "ScalingMode": "CLASSIC_SCALING"
                    },
                    "LaunchConfigurationName": "sz-asc",
                    "CapacityRebalance": false,
                    "TerminationPolicySet": [
                        "OLDEST_INSTANCE"
                    ],
                    "AutoScalingGroupStatus": "NORMAL",
                    "InstanceCount": 0,
                    "DesiredCapacity": 0,
                    "AutoScalingGroupId": "asg-h71x7a3f",
                    "Ipv6AddressCount": 0,
                    "DefaultCooldown": 300,
                    "EnabledStatus": "ENABLED",
                    "ZoneSet": []
                }
            ],
            "TotalCount": 1,
            "RequestId": "53a76c96-a88c-4972-8488-66d6c15a080f"
        }
    }
    

    5. Developer Resources

    SDK

    TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

    Command Line Interface

    6. Error Code

    The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

    Error Code Description
    InvalidParameter.ActionNotFound Invalid Action request.
    InvalidParameter.Conflict Multiple parameters specified conflict and cannot co-exist.
    InvalidParameterConflict The two parameters specified conflict and cannot co-exist.
    InvalidParameterValue.Filter Invalid filter.
    InvalidParameterValue.InvalidAutoScalingGroupId Invalid scaling group ID.
    InvalidParameterValue.InvalidFilter Invalid filter condition.
    InvalidParameterValue.InvalidLaunchConfigurationId Invalid launch configuration ID.
    InvalidParameterValue.LimitExceeded The value exceeds the limit.
    InvalidParameterValue.TooLong Too many values.
    InvalidPermission The account does not support this operation.
    LimitExceeded.FilterValuesTooLong Too many values for the specified filter
    UnsupportedOperation Unsupported operation.