调用AllocateInstancePublicConnection接口申请实例的外网地址。
注意事项
一个RDS实例仅允许申请一条外网连接地址。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | AllocateInstancePublicConnection |
系统规定参数,取值:AllocateInstancePublicConnection。 |
DBInstanceId | String | 是 | rm-uf6wjk5***** |
实例ID。 |
ConnectionStringPrefix | String | 是 | test1234 |
外网连接地址的前缀。完整外网连接地址为:前缀.引擎名.rds.aliyuncs.com。例如test1234.mysql.rds.aliyuncs.com。 说明 长度5~40,不能包含汉字和非法字符(~!#%^&*=+|{};:'",<>/?),建议由字母、数字、短横线(-)组成。
|
Port | String | 是 | 3306 |
外网连接端口,取值:1000~5999。 |
BabelfishPort | String | 否 | 1433 |
Babelfish for RDS PostgreSQL TDS端口号。 说明 该参数仅适用于RDS PostgreSQL实例,Babelfish for RDS PostgreSQL的更多介绍,请参见Babelfish简介。
|
GeneralGroupName | String | 否 | rgc-bp1tkv8***** |
专属集群MySQL通用版实例所属的组名。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
DbInstanceName | String | rm-bp1***** |
实例ID。 |
RequestId | String | 65BDA532-28AF-4122-AA39-B382721EEE64 |
请求ID。 |
ConnectionString | String | test*****.mysql.rds.aliyuncs.com |
数据库连接地址。 |
示例
请求示例
http(s)://rds.aliyuncs.com/?Action=AllocateInstancePublicConnection
&ConnectionStringPrefix=test1234
&DBInstanceId=rm-uf6wjk5*****
&Port=3306
&<公共请求参数>
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<AllocateInstancePublicConnectionResponse>
<DbInstanceName>rm-bp1*****</DbInstanceName>
<RequestId>65BDA532-28AF-4122-AA39-B382721EEE64</RequestId>
<ConnectionString>test*****.mysql.rds.aliyuncs.com</ConnectionString>
</AllocateInstancePublicConnectionResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"DbInstanceName" : "rm-bp1*****",
"RequestId" : "65BDA532-28AF-4122-AA39-B382721EEE64",
"ConnectionString" : "test*****.mysql.rds.aliyuncs.com"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | OtherEndpoint.Exist | Other endpoint exist. | 外网连接地址的前缀已存在 |
400 | IncorrectDBInstanceState | The current instance state does not support this operation. | 当前实例状态不支持此操作。 |
400 | ConnectionStringContainIllegalCharacterFault | The connection string contain Illegal character. | 连接字符串内容存在非法字符错误,请修改后重试。 |
400 | InvalidInstanceNetworkType | The specified InstanceNetworkType is invalid. | 指定的实例网络类型无效 |
400 | InvalidConnectionString.Format | Specified connection string is not valid. | 实例连接地址的字符串格式不正确。字符串前缀长度为5~40。 |
400 | InvalidPort.Malformed | Specified port is not valid. | 指定的端口无效。 |
400 | InvalidVpcIdRegion.NotSupported | The specified region does not allow you to create a VPC instance. | 操作失败,该地区不支持创建VPC实例。 |
400 | InvalidInstanceNetworkType.ValueNotSupported | The specified parameter "InstanceNetworkType" is not valid. | 网络类型验证失败,支持的网络类型为VPC和Classic。 |
403 | Invalid.DbInstanceNetType | The specified parameter DbInstanceNetType is not valid. | 实例网络类型无效。请设置为Internet(经典网络)或Intranet(专有网络)。 |
403 | OperationDenied.SwitchToVPC | Specified instance cannot be switched to VPC. | 当前实例无法切换VPC。 |
访问错误中心查看更多错误码。