Updated on 2026-05-30 GMT+08:00

Setting an Instance to Read-Only

Function

This API is used to set an instance to read-only.

Constraints

  • After an instance is set to read-only, newly created schemas still support read and write operations. You need to set the instance to read-only again.

  • When an instance is set to read-only, its schema SQL blacklist cannot be modified. You can manually delete the schema SQL blacklist to cancel the read-only status.

API Calling

For details, see Calling APIs.

Authorization Information

Each account has permissions to call all APIs, but IAM users must have the required permissions specifically assigned.

  • If you are using role/policy-based authorization, see the required permissions in Permissions Policies and Supported Actions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    ddm:instance:setReadOnly

    Write

    instance *

    • g:EnterpriseProjectId

    • g:ResourceTag/<tag-key>

    ddm:instance:modify

    -

URI

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

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

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

Constraints

N/A

Range

The value contains 32 characters. Only letters and digits are allowed.

Default Value

N/A

instance_id

Yes

String

Definition

Instance ID, which uniquely identifies an instance.

Constraints

N/A

Range

The value contains 36 characters with a suffix of in09. Only letters and digits are allowed.

Default Value

N/A

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

readonly

Yes

Boolean

Definition

Whether the instance is set to read-only.

  • true: The instance is set to read-only.

  • false: The read-only status is canceled.

Constraints

N/A

Range

true or false

Default Value

N/A

Example Request

Setting an instance to read-only

PUT https://{endpoint}/v3/a8e2a5e2a6xxxxxxxxxx5af5b9ddabe5/instances/849c450a43xxxxxxxxxxf33cff5f0717pr09/readonly-status

{
  "readonly" : true
}

Response Parameters

  • Normal response
Table 3 Response body parameters

Parameter

Type

Description

job_id

String

Definition

Workflow ID.

Range

N/A

Example Response

  • Normal response example
    {
      "job_id" : "075fabcf-c4f0-4dc3-a734-65449f5cd277"
    }

Status Codes

Error Codes

For details, see Error Codes.