All Products
Search
Document Center

Resource Management:CreateServiceLinkedRole

Last Updated:Feb 13, 2025

Creates a service-linked role.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
ServiceNamestringYes

The name of the service.

For more information about the service name, see Alibaba Cloud services that support service-linked roles.

polardb.aliyuncs.com
CustomSuffixstringNo

The suffix of the role name.

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

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

Example
DescriptionstringNo

The description of the service-linked role.

You must configure this parameter for service-linked roles that support custom suffixes. Otherwise, the preset value is used and cannot be modified.

The description must be 1 to 1,024 characters in length.

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

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

Response parameters

ParameterTypeDescriptionExample
object
Roleobject

The information about the role.

AssumeRolePolicyDocumentstring

The document of the trust policy for the role.

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

The role name that uses a domain name as the suffix.

AliyunServiceRoleForPolarDB@role.test.onaliyunservice.com
Descriptionstring

The description of the role.

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

The name of the role.

AliyunServiceRoleForPolarDB
CreateDatestring

The time when the role was created. The time is displayed in UTC.

2020-06-30T08:14:16Z
Arnstring

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

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

The ID of the role.

32833240981067****
IsServiceLinkedRoleboolean

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
RequestIdstring

The ID of the request.

FE58D7CF-03BC-432A-B42D-BC3390C8C2E1

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameter.CustomSuffix.NotAllowedCustom suffix is not allowed for this Service Linked Role.Custom suffix is not allowed for this Service Linked Role.
400InvalidParameter.CustomSuffix.InvalidCharsThe parameter CustomSuffix contains invalid characters.The parameter CustomSuffix contains invalid characters.
400InvalidParameter.CustomSuffix.LengthThe maximum length of the parameter CustomSuffix is exceeded.The maximum length of the parameter CustomSuffix is exceeded.
400InvalidParameter.Description.NotAllowedCustom description is not allowed for default service linked role.-
400InvalidParameter.Description.LengthThe 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.
404EntityNotExist.ServiceThe service does not exist.The service does not exist.
409EntityAlreadyExists.RoleThe role already exists.The role already exists.
409LimitExceeded.RoleThe maximum number of roles is exceeded.The maximum number of roles is exceeded.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history