All Products
Search
Document Center

Resource Management:CreateServiceLinkedRole

Last Updated:Aug 28, 2026

Creates a service-linked role (SLR) for a specified Alibaba Cloud service.

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 supported service names, see Alibaba Cloud services that support service-linked roles.

polardb.aliyuncs.com

CustomSuffix

string

No

The suffix of the role name.

The role name including its suffix must be 1 to 64 characters in length. Valid characters: letters, digits, periods (.), and hyphens (-).

For example, if the suffix is Example, the role name is ServiceLinkedRoleName_Example.

Example

Description

string

No

The description of the service-linked role.

Required for service-linked roles that support custom suffixes. Otherwise, the preset value is used and cannot be modified.

Length: 1 to 1,024 characters.

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

For common request parameters, see Common parameters.

Response elements

Element

Type

Description

Example

object

The returned data.

RequestId

string

The request ID.

FE58D7CF-03BC-432A-B42D-BC3390C8C2E1

Role

object

The information about the role.

Arn

string

The Alibaba Cloud Resource Name (ARN) of the role.

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

AssumeRolePolicyDocument

string

The trust policy document 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, in 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.

  • true

  • false

true

RoleId

string

The ID of the role.

32833240981067****

RoleName

string

The name of the role.

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.