Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Querying DB Instances

Updated on 2025-02-10 GMT+08:00

Function

This API is used to query instances according to search criteria. Before calling this API:

NOTICE:

This API will be unavailable on March 31, 2025. You are advised to switch workloads to the new API (Querying DB instances) before then.

URI

  • URI format

    GET https://{endpoint}/mysql/v3/{project_id}/instances?id={id}&name={name}&type={type}&datastore_type={datastore_type}&vpc_id={vpc_id}&subnet_id={subnet_id}&offset={offset}&limit={limit}

  • Example

    GET https://{endpoint}/mysql/v3/97b026aa9cc4417888c14c84a1ad9860/instances?id=ed7cc6166ec24360a5ed5c5c9c2ed726in01&name=hy&type=Cluster&datastore_type=gaussdb-mysql&vpc_id=19e5d45d-70fd-4a91-87e9-b27e71c9891f&subnet_id=bd51fb45-2dcb-4296-8783-8623bfe89bb7&offset=0&limit=10

  • Parameter description
    Table 1 Parameter description

    Name

    Type

    Mandatory

    Description

    project_id

    String

    Yes

    Project ID of a tenant in a region.

    To obtain this value, see Obtaining a Project ID.

    id

    String

    No

    DB instance ID.

    The asterisk (*) is reserved for the system. If the instance ID starts with an asterisk (*), the value following asterisk (*) is used for fuzzy matching. Otherwise, the instance ID is used for exact matching.

    name

    String

    No

    DB instance name.

    The asterisk (*) is reserved for the system. If the instance name starts with an asterisk (*), the value following asterisk (*) is used for fuzzy matching. Otherwise, the instance name is used for exact matching.

    type

    String

    No

    DB instance type to be queried. Currently, only the cluster type is supported.

    datastore_type

    String

    No

    DB type. Currently, only gaussdb-mysql is supported.

    vpc_id

    String

    No

    VPC ID.

    • Method 1: Log in to the VPC console and view the VPC ID on the VPC details page.
    • Method 2: See "Querying VPCs" in the Virtual Private Cloud API Reference.

    subnet_id

    String

    No

    Network ID of the subnet.

    • Method 1: Log in to the VPC console and click the target subnet on the Subnets page. You can view the network ID on the displayed page.
    • Method 2: See "Querying Subnets" in the Virtual Private Cloud API Reference.

    offset

    Integer

    No

    Index offset. If offset is set to N, the resource query starts from the N+1 piece of data. The value is 0 by default, indicating that the query starts from the first piece of data. The value cannot be a negative number.

    limit

    Integer

    No

    Number of records to be queried. The default value is 100. The value must be a positive integer. The minimum value is 1 and the maximum value is 100.

Request

None.

Response

  • Normal response
    Table 2 Parameter description

    Name

    Type

    Description

    instances

    Array of objects

    Instance information.

    For details, see Table 3.

    total_count

    Integer

    Total number of records.

    Table 3 instances field data structure description

    Name

    Type

    Description

    id

    String

    DB instance ID.

    name

    String

    DB instance name.

    status

    String

    DB instance status.

    private_ips

    List<String>

    Private IP address for write. It is a blank string until an ECS is created.

    public_ips

    List<String>

    Public IP addresses.

    port

    String

    Database port.

    type

    String

    DB instance type. The value is Cluster.

    region

    String

    Region where the DB instance is deployed.

    datastore

    Object

    Database information.

    For details, see Table 4.

    created

    String

    Creation time in the "yyyy-mm-ddThh:mm:ssZ" format.

    T is the separator between the calendar and the hourly notation of time. Z indicates the time zone offset. For example, in the Beijing time zone, the time zone offset is shown as +0800.

    The value is empty unless the instance creation is complete.

    updated

    String

    Update time. The format is the same as that of the created field.

    The value is empty unless the instance creation is complete.

    db_user_name

    String

    Default username.

    vpc_id

    String

    VPC ID.

    subnet_id

    String

    Network ID of the subnet.

    security_group_id

    String

    Security group ID.

    flavor_ref

    String

    Specification code.

    For details, see Table 3.

    flavor_info

    Object

    Specification description.

    volume

    Object

    Volume information.

    For details, see Table 5.

    backup_strategy

    Object

    Backup policy.

    For details, see Table 7.

    enterprise_project_id

    String

    Enterprise project ID.

    time_zone

    String

    Time zone.

    charge_info

    Object

    Billing mode, which is yearly/monthly or pay-per-use. By default, pay-per-use is used.

    For details, see Table 8.

    Table 4 datastore field data structure description

    Name

    Type

    Description

    type

    String

    DB engine.

    version

    String

    DB version.

    Table 5 volume field data structure description

    Name

    Type

    Description

    type

    String

    Disk type.

    size

    String

    Used disk size in GB.

    Table 6 flavor_ref field data structure description

    Name

    Type

    Description

    vcpus

    String

    Number of vCPUs.

    ram

    String

    Memory size in GB.

    Table 7 backup_strategy field data structure description

    Name

    Type

    Description

    start_time

    String

    Backup time window. Automated backups will be triggered during the backup time window.

    keep_days

    String

    Backup retention days.

    Table 8 charge_info field data structure description

    Name

    Type

    Description

    charge_mode

    String

    Billing mode.

    Values:

    • prePaid: indicates the yearly/monthly billing mode.
    • postPaid: indicates the pay-per-use billing mode.
    NOTE:

    The value of region is used as an example in the following response.

  • Example normal response
    {
        "total_count":6,
        "instances":[
            {
                "id":"d738399de028480fabb2b8120d4e01a4in07",
                "status":"ACTIVE",
                "name":"oMoS_001",
                "port":3306,
                "type":"Cluster",
                "private_ips": ["192.168.0.142"],
                "public_ips": ["10.154.219.187"],
                "db_user_name": "root",
                "region": "aaa",
                "datastore": {"type": "gaussdb-mysql", "version":"8.0"},
                "created": "2018-08-20T02:33:49+0800",
                "updated": "2018-08-20T02:33:50+0800",
                "volume": {
                        "type": "POOL",
                        "used_size": 100
                },                         
                "vpc_id": "f7ee62e2-9705-4523-ba49-a85ea1a1fa87",
                "subnet_id": "140af7bf-a9da-4dcf-8837-34199fd6d186",
                "security_group_id":"c7f69884-fe2b-4630-8114-70a11499d902",
                "flavor_ref":"gaussdb.mysql.c3.small.4",
                "backup_strategy": {"start_time": "19:00-20:00", "keep_days": 7},                          
                "charge_info": {
                    "charge_mode": "postPaid"
                },
                "enterprise_project_id": "0",
                     "time_zone": "",
            }
        ]
    }

Status Code

For details, see Status Codes.

Error Code

For details, see Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback