• Relational Database Service

rds
  1. Help Center
  2. Relational Database Service
  3. API Reference
  4. API v1
  5. DB Instance Management
  6. Binding or Unbinding an EIP

Binding or Unbinding an EIP

Function

This API is used to bind or unbind an EIP.

URI

  • URI format

    PATH: /rds/{versionId}/{project_id}/instances/{instanceId}/action

    Method: POST

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    versionId

    Yes

    Specifies the API version. It is case-sensitive and the value is v1.

    project_id

    Yes

    Specifies the project ID of a tenant in a region.

    instanceId

    Yes

    Specifies the DB instance ID.

  • Restrictions

    First, invoke the VPC API to query EIPs by referring to section "Querying Elastic IP Addresses" in the Virtual Private Cloud API Reference. If no EIP is available for the tenant, invoke the VPC API to create an EIP by referring to section "Applying for an Elastic IP Address" in the Virtual Private Cloud API Reference.

    EIPs cannot be bound to or unbound from primary/standby DB instances of earlier versions.

Request

  • Parameter description
    Table 2 Parameter description

    Name

    Mandatory

    Type

    Description

    setPublicIp

    Yes

    Dictionary data structure. For details, see Table 3.

    Returns EIP information.

    Table 3 setPublicIp field data structure description

    Name

    Mandatory

    Type

    Description

    action

    Yes

    String

    If this parameter is enablePublicAccess, the EIP is bound to the target DB instance.

    If this parameter is disablePublicAccess, the EIP is unbound from the target DB instance.

    publicIP

    Yes

    String

    Specifies the EIP obtained by invoking the VPC API. This parameter is not contained in the request when unbinding the EIP.

    publicIPId

    Yes

    String

    Specifies the EIP ID obtained by invoking the VPC API. This parameter is not contained in the request when unbinding the EIP.

  • Request example
    Binding an EIP:
    {
        "setPublicIp":{
            "action":"enablePublicAccess",
            "publicIP":"10.145.49.92",
            "publicIPId":"4c9c30f5-54fb-4e44-8c6e-df4ea8790e93"
        }
    }

    Unbinding an EIP:

    {
        "setPublicIp":{
            "action":"disablePublicAccess"
        }
    }

Normal Response

{}

Abnormal Response

For details, see Abnormal Request Results.