All Products
Search
Document Center

Resource Management:UpdateControlPolicy

Last Updated:Sep 02, 2026

Modifies a custom control policy by calling UpdateControlPolicy.

Operation description

This topic provides an example on how to modify the name of the control policy cp-jExXAqIYkwHN**** to NewControlPolicy.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

resourcemanager:UpdateControlPolicy

update

*ControlPolicy

acs:resourcemanager:*:{#accountId}:policy/controlpolicy/{#PolicyId}

None None

Request parameters

Parameter

Type

Required

Description

Example

PolicyId

string

Yes

The ID of the control policy.

cp-jExXAqIYkwHN****

NewPolicyName

string

No

The new Policy Name of the control policy.

The name must be 1 to 128 characters in length, must start with a letter, and can contain letters, digits, and hyphens (-).

NewControlPolicy

NewDescription

string

No

The new description of the control policy.

The description must be 1 to 1,024 characters in length, must start with a letter, and can contain letters, digits, underscores (_), and hyphens (-).

ExampleControlPolicy

NewPolicyDocument

string

No

The new document of the control policy.

The maximum length is 4,096 characters.

For information about the control policy language, see Control policy language.

For examples of control policies, see Examples of custom control policies.

{"Version":"1","Statement":[{"Effect":"Deny","Action":["ram:UpdateRole","ram:DeleteRole","ram:AttachPolicyToRole","ram:DetachPolicyFromRole"],"Resource":"acs:ram:*:*:role/ResourceDirectoryAccountAccessRole"}]}

For more information about common request parameters, see Common parameters.

Response elements

Element

Type

Description

Example

object

The response parameters.

ControlPolicy

object

The details of the control policy.

UpdateDate

string

The time when the control policy was updated. The time is displayed in UTC in RFC 3339 format, indicated by Z.

2021-03-18T10:04:55Z

Description

string

The description of the control policy.

ExampleControlPolicy

EffectScope

string

The effective scope of the control policy. Valid values:

  • All: The control policy takes effect for Alibaba Cloud accounts, Resource Access Management (RAM) users, and RAM roles.

  • RAM: The control policy takes effect only for RAM users and RAM roles.

RAM

AttachmentCount

string

The number of times the control policy is referenced.

0

PolicyName

string

The Policy Name of the control policy.

NewControlPolicy

PolicyId

string

The ID of the control policy.

cp-jExXAqIYkwHN****

CreateDate

string

The time when the control policy was created. The time is displayed in UTC in RFC 3339 format, indicated by Z.

2021-03-18T09:24:19Z

PolicyType

string

The type of the control policy. Valid values:

  • System: system control policy.

  • Custom: custom control policy.

Custom

RequestId

string

The request ID.

2DFCE4C9-04A9-4C83-BB14-FE791275EC53

Examples

Success response

JSON format

{
  "ControlPolicy": {
    "UpdateDate": "2021-03-18T10:04:55Z",
    "Description": "ExampleControlPolicy",
    "EffectScope": "RAM",
    "AttachmentCount": "0",
    "PolicyName": "NewControlPolicy",
    "PolicyId": "cp-jExXAqIYkwHN****",
    "CreateDate": "2021-03-18T09:24:19Z",
    "PolicyType": "Custom"
  },
  "RequestId": "2DFCE4C9-04A9-4C83-BB14-FE791275EC53"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter.NewPolicyDocument.Length Unable to save your policy. A policy contains a maximum of 4096 characters. Failed to save the policy. The policy document cannot exceed 4,096 characters in length.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.