Updated on 2024-06-07 GMT+08:00

Changing Read/Write Permissions

Function

This API is used to change read/write permissions of RDS for MySQL DB instances to meet your workload requirements. After a DB instance is set to read-only, data cannot be written to it.

  • Before calling an API, you need to understand the API in Authentication.

Constraints

  • This API is available to RDS for MySQL only.
  • This API is available to only single and primary/standby DB instances.
  • This operation cannot be performed when the DB instance is in any of the following statuses: creating, changing instance class, frozen, and abnormal.
  • If your instance becomes read-only for other reasons (such as full storage and DRS migration), it cannot be changed to readable and writable through this API.
  • This API is only used to configure read/write permissions for primary DB instances.
  • Changing read/write permissions is in OBT in some regions. If this function is not available in your region, contact customer service to configure a whitelist.

URI

  • URI format

    PUT /v3/{project_id}/instances/{instance_id}/readonly-status

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Project ID of a tenant in a region.

    For details about how to obtain the project ID, see Obtaining a Project ID.

    instance_id

    Yes

    Instance ID.

Request

Table 2 Parameters

Parameter

Mandatory

Type

Description

readonly

Yes

Boolean

Whether to set the instance to read-only.

  • true: indicates that the instance will be set to read-only.
  • false: indicates that the instance will be set to read/write.

Example Request

Set a DB instance to read-only.
PUT https://{endpoint}/v3/054ea741f700d4a32f1bc00f5c80dd4c/instances/5b409baece064984a1b3eef6addae50cin01/readonly-status

{
    "readonly" : true 
}

Response

  • Normal response
    Table 3 Parameter description

    Parameter

    Type

    Description

    job_id

    String

    Task ID.

  • Example normal response
    {
        "job_id": "2b414788a6004883a02390e2eb0ea227"
    }

Status Code

Error Code

For details, see Error Codes.