allocate_instance_public_connection
Assign a public connection to an Alibaba Cloud RDS instance by specifying the region, instance ID, and connection string prefix. Returns the configured connection details.
Instructions
allocate db instance public connection.
Args:
region_id: The region ID of the RDS instance.
db_instance_id: The ID of the RDS instance.
connection_string_prefix: The prefix of connection string.
Returns:
dict[str, Any]: The response.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connection_string_prefix | No | ||
| db_instance_id | Yes | ||
| port | No | 3306 | |
| region_id | Yes |
Implementation Reference
- The main handler function that implements the 'allocate_instance_public_connection' tool. It uses the Alibaba Cloud RDS SDK to create a public connection for the specified DB instance, handling parameters like connection string prefix and port.@mcp.tool() async def allocate_instance_public_connection( region_id: str, db_instance_id: str, connection_string_prefix: str = None, port: str = '3306' ): """ allocate db instance public connection. Args: region_id: The region ID of the RDS instance. db_instance_id: The ID of the RDS instance. connection_string_prefix: The prefix of connection string. Returns: dict[str, Any]: The response. """ try: if connection_string_prefix is None: connection_string_prefix = db_instance_id + "-public" client = get_rds_client(region_id) request = rds_20140815_models.AllocateInstancePublicConnectionRequest( dbinstance_id=db_instance_id, connection_string_prefix=connection_string_prefix, port=port ) response = await client.allocate_instance_public_connection_async(request) return response.body.to_map() except Exception as e: raise e