All Products
Search
Document Center

Resource Management:CreateServiceLinkedRole

Last Updated:Jun 05, 2024

Creates a service-linked role.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ram:CreateServiceLinkedRoleWrite
  • Role
    acs:ram:*:{#accountId}:role/*
  • ram:ServiceName
none

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