Service-linked roles

Updated at:

ApsaraDB RDS uses service-linked roles to access other Alibaba Cloud services on your behalf. Each role is a RAM role with a predefined access policy — RDS creates and uses the role automatically, so you don't need to configure permissions manually.

ApsaraDB RDS supports three service-linked roles:

Role name

Used by

AliyunServiceRoleForRds

ApsaraDB RDS for MySQL

AliyunServiceRoleForRdsPgsqlOnEcs

ApsaraDB RDS for PostgreSQL

AliyunServiceRoleForRDSProxyOnEcs

Database proxy for ApsaraDB RDS for PostgreSQL

For more information on service-linked roles in Alibaba Cloud, see Service-linked roles.

AliyunServiceRoleForRds

Role details

Field

Value

Role name

AliyunServiceRoleForRds

Access policy

AliyunServiceRolePolicyForRds

Used by

ApsaraDB RDS for MySQL

Permissions

The policy grants RDS for MySQL access to ECS networking resources, VPC topology, and the ability to delete this role when no longer needed.

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:CreateNetworkInterface",
                "ecs:DeleteNetworkInterface",
                "ecs:AttachNetworkInterface",
                "ecs:DetachNetworkInterface",
                "ecs:DescribeNetworkInterfaces",
                "ecs:CreateNetworkInterfacePermission",
                "ecs:DescribeNetworkInterfacePermissions",
                "ecs:CreateSecurityGroup",
                "ecs:DeleteSecurityGroup",
                "ecs:DescribeSecurityGroupAttribute",
                "ecs:DescribeSecurityGroups",
                "ecs:ModifySecurityGroupAttribute",
                "ecs:AuthorizeSecurityGroup",
                "ecs:AuthorizeSecurityGroupEgress",
                "ecs:RevokeSecurityGroup",
                "ecs:RevokeSecurityGroupEgress",
                "ecs:DescribeKeyPairs",
                "ecs:ModifyImageSharePermission",
                "ecs:DescribeImages"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "vpc:DescribeVSwitches",
                "vpc:AssociateEipAddress",
                "vpc:DescribeVpcs"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": "ram:DeleteServiceLinkedRole",
            "Resource": "*",
            "Effect": "Allow",
            "Condition": {
                "StringEquals": {
                    "ram:ServiceName": "rds-ecs-service.rds.aliyuncs.com"
                }
            }
        }
    ]
}

Create the role

This role is created automatically when you create a database in the console. Follow the on-screen instructions to grant the authorization. For more information, see Create a database.

Delete the role

Before deleting this role, delete all ApsaraDB RDS for MySQL databases that depend on it.

  1. Delete each dependent database. See Delete a database.

  2. Delete the service-linked role. See Delete a service-linked role.

Tip: If you're unsure whether this role is still in use, try deleting it. If the deletion fails, the error message indicates which resources depend on the role.

AliyunServiceRoleForRdsPgsqlOnEcs

Role details

Field

Value

Role name

AliyunServiceRoleForRdsPgsqlOnEcs

Access policy

AliyunServiceRolePolicyForRdsPgsqlOnEcs

Used by

ApsaraDB RDS for PostgreSQL

Permissions

The policy grants RDS for PostgreSQL access to ECS networking resources, Key Management Service (KMS) for encryption, VPC topology, and the ability to delete this role when no longer needed.

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:CreateNetworkInterface",
                "ecs:DeleteNetworkInterface",
                "ecs:AttachNetworkInterface",
                "ecs:DetachNetworkInterface",
                "ecs:DescribeNetworkInterfaces",
                "ecs:CreateNetworkInterfacePermission",
                "ecs:DescribeNetworkInterfacePermissions",
                "ecs:CreateSecurityGroup",
                "ecs:DeleteSecurityGroup",
                "ecs:DescribeSecurityGroupAttribute",
                "ecs:DescribeSecurityGroups",
                "ecs:ModifySecurityGroupAttribute",
                "ecs:AuthorizeSecurityGroup",
                "ecs:AuthorizeSecurityGroupEgress",
                "ecs:RevokeSecurityGroup",
                "ecs:RevokeSecurityGroupEgress"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "kms:Listkeys",
                "kms:Listaliases",
                "kms:ListResourceTags",
                "kms:DescribeKey",
                "kms:UntagResource",
                "kms:TagResource",
                "kms:DescribeAccountKmsStatus"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "kms:Encrypt",
                "kms:Decrypt",
                "kms:GenerateDataKey"
            ],
            "Resource": "*",
            "Effect": "Allow",
            "Condition": {
                "StringEqualsIgnoreCase": {
                    "kms:tag/acs:rds:instance-encryption": "true"
                }
            }
        },
        {
            "Action": [
                "vpc:DescribeVSwitches",
                "vpc:DescribeVpcs"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": "ram:DeleteServiceLinkedRole",
            "Resource": "*",
            "Effect": "Allow",
            "Condition": {
                "StringEquals": {
                    "ram:ServiceName": "pgsql-onecs.rds.aliyuncs.com"
                }
            }
        }
    ]
}

Create the role

This role is created automatically when you create an ApsaraDB RDS for PostgreSQL instance. Follow the on-screen instructions in the console to grant the authorization. For more information, see Create an ApsaraDB RDS for PostgreSQL instance.

Delete the role

Before deleting this role, release all ApsaraDB RDS for PostgreSQL instances that depend on it.

  1. Release each dependent instance. See Release an instance.

  2. Delete the service-linked role. See Delete a service-linked role.

Tip: If you're unsure whether this role is still in use, try deleting it. If the deletion fails, the error message indicates which resources depend on the role.

AliyunServiceRoleForRDSProxyOnEcs

Role details

Field

Value

Role name

AliyunServiceRoleForRDSProxyOnEcs

Access policy

AliyunServiceRolePolicyForRDSProxyOnEcs

Used by

Database proxy for ApsaraDB RDS for PostgreSQL

Permissions

The policy grants the database proxy access to ECS networking resources, VPC topology, and the ability to delete this role when no longer needed.

{
    "Version": "1",
    "Statement": [
        {
            "Action": [
                "ecs:CreateNetworkInterface",
                "ecs:DeleteNetworkInterface",
                "ecs:AttachNetworkInterface",
                "ecs:DetachNetworkInterface",
                "ecs:DescribeNetworkInterfaces",
                "ecs:CreateNetworkInterfacePermission",
                "ecs:DescribeNetworkInterfacePermissions",
                "ecs:CreateSecurityGroup",
                "ecs:DeleteSecurityGroup",
                "ecs:DescribeSecurityGroupAttribute",
                "ecs:DescribeSecurityGroups",
                "ecs:ModifySecurityGroupAttribute",
                "ecs:AuthorizeSecurityGroup",
                "ecs:AuthorizeSecurityGroupEgress",
                "ecs:RevokeSecurityGroup",
                "ecs:RevokeSecurityGroupEgress"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": [
                "vpc:DescribeVSwitches",
                "vpc:DescribeVpcs"
            ],
            "Resource": "*",
            "Effect": "Allow"
        },
        {
            "Action": "ram:DeleteServiceLinkedRole",
            "Resource": "*",
            "Effect": "Allow",
            "Condition": {
                "StringEquals": {
                    "ram:ServiceName": "rdsproxy-onecs.rds.aliyuncs.com"
                }
            }
        }
    ]
}

Create the role

This role is created automatically when you enable the database proxy for an ApsaraDB RDS for PostgreSQL instance. Follow the on-screen instructions in the console to grant the authorization. For more information, see Enable the database proxy.

Delete the role

Important

Do not delete this role if you plan to continue using the database proxy or Serverless instances.

Before deleting this role, disable all database proxies that depend on it.

  1. Disable the database proxy. See Disable the database proxy.

  2. Delete the service-linked role. See Delete a service-linked role.

Tip: If you're unsure whether this role is still in use, try deleting it. If the deletion fails, the error message indicates which resources depend on the role.

API reference

Use the CreateServiceLinkedRole operation to create a service-linked role for an ApsaraDB RDS instance.

Parameter

Description

Example

RegionId

The region ID. Call DescribeRegions to get available region IDs.

cn-hangzhou

ServiceLinkedRole

The role to create: AliyunServiceRoleForRds, AliyunServiceRoleForRdsPgsqlOnEcs, or AliyunServiceRoleForRDSProxyOnEcs.

AliyunServiceRoleForRdsPgsqlOnEcs