All Products
Search
Document Center

Resource Management:CreateServiceLinkedRole

Last Updated:Oct 26, 2026

Creates a service-linked role.

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

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

ServiceName

string

Yes

The service name. For more information, see Cloud services that support service-linked roles.

polardb.aliyuncs.com

CustomSuffix

string

No

The suffix of the role name. The total length of the role name, including the suffix, is 1 to 64 characters and can contain letters, digits, periods (.), and hyphens (-). For example, if the suffix is Example, the role name is ServiceLinkedRoleName_Example, and the maximum length cannot exceed 64 characters.

Example

Description

string

No

The description of the service-linked role. You can specify a role description only for service-linked roles that allow custom suffixes. Otherwise, the role description uses a preset value and cannot be modified. The description is 1 to 1,024 characters in length.

Service Linked Role for PolarDB. PolarDB will use this role to access your resources in other services.

Response elements

Element

Type

Description

Example

object

The returned result.

RequestId

string

The request ID.

FE58D7CF-03BC-432A-B42D-BC3390C8C2E1

Role

object

The role information.

Arn

string

The resource descriptor of the role.

acs:ram::177242285274****:role/aliyunserviceroleforpolardb

AssumeRolePolicyDocument

string

The trust policy content of the role.

{\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"polardb.aliyuncs.com\"]}}],\"Version\":\"1\"}

CreateDate

string

The time when the role was created (UTC).

2020-06-30T08:14:16Z

Description

string

The description of the role.

Service Linked Role for PolarDB. PolarDB will use this role to access your resources in other services.

IsServiceLinkedRole

boolean

Indicates whether the role is a service-linked role. Valid values:

  • true: The role is a service-linked role.

  • false: The role is not a service-linked role.

true

RoleId

string

The role ID.

32833240981067****

RoleName

string

The role name.

AliyunServiceRoleForPolarDB

RolePrincipalName

string

The role name with a domain name suffix.

AliyunServiceRoleForPolarDB@role.test.onaliyunservice.com

Examples

Success response

JSON format

{
  "RequestId": "FE58D7CF-03BC-432A-B42D-BC3390C8C2E1",
  "Role": {
    "Arn": "acs:ram::177242285274****:role/aliyunserviceroleforpolardb",
    "AssumeRolePolicyDocument": "{\\\"Statement\\\":[{\\\"Action\\\":\\\"sts:AssumeRole\\\",\\\"Effect\\\":\\\"Allow\\\",\\\"Principal\\\":{\\\"Service\\\":[\\\"polardb.aliyuncs.com\\\"]}}],\\\"Version\\\":\\\"1\\\"}",
    "CreateDate": "2020-06-30T08:14:16Z",
    "Description": "Service Linked Role for PolarDB. PolarDB will use this role to access your resources in other services.",
    "IsServiceLinkedRole": true,
    "RoleId": "32833240981067****",
    "RoleName": "AliyunServiceRoleForPolarDB",
    "RolePrincipalName": "AliyunServiceRoleForPolarDB@role.test.onaliyunservice.com"
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter.CustomSuffix.NotAllowed Custom suffix is not allowed for this Service Linked Role. Custom suffix is not allowed for this Service Linked Role.
400 InvalidParameter.CustomSuffix.InvalidChars The parameter CustomSuffix contains invalid characters. The parameter CustomSuffix contains invalid characters.
400 InvalidParameter.CustomSuffix.Length The maximum length of the parameter CustomSuffix is exceeded. The maximum length of the parameter CustomSuffix is exceeded.
400 InvalidParameter.Description.NotAllowed Custom description is not allowed for default service linked role.
400 InvalidParameter.Description.Length The maximum length of the description is exceeded. It must not exceed 1024 characters. The maximum length of the description is exceeded. It must not exceed 1024 characters.
404 EntityNotExist.Service The service does not exist. The service does not exist.
409 EntityAlreadyExists.Role The role already exists. The role already exists.
409 LimitExceeded.Role The maximum number of roles is exceeded. The maximum number of roles is exceeded.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.