This topic describes the use scenarios of the service-linked roles that are supported by ApsaraDB RDS instances. This topic also describes how to delete the service-linked roles.

Background information

ApsaraDB RDS supports the following service-linked roles:
  • AliyunServiceRoleForRdsPgsqlOnEcs, which is used for ApsaraDB RDS for PostgreSQL instances
  • AliyunServiceRoleForRDSProxyOnEcs, which is used for the database proxy feature of ApsaraDB RDS for PostgreSQL.

ApsaraDB RDS may require access to other Alibaba Cloud services to provide specific features. You can assign a service-linked role to ApsaraDB RDS to obtain the permissions that are required to access other Alibaba Cloud services. A service-linked role is a RAM role. For more information about service-linked roles, see Service-linked roles.

Introduction to AliyunServiceRoleForRdsPgsqlOnEcs

Name: AliyunServiceRoleForRdsPgsqlOnEcs

Attached policy: AliyunServiceRolePolicyForRdsPgsqlOnEcs

Permissions:

{
  "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": "pgsql-onecs.rds.aliyuncs.com"
        }
      }
    }
  ]
}

Introduction to AliyunServiceRoleForRDSProxyOnEcs

Name: AliyunServiceRoleForRDSProxyOnEcs

Attached policy: AliyunServiceRoleForRDSProxyOnEcs

Permissions:
{
  "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 a service-linked role

You can call the createservicelinkedrole interface to create a service association role.

Delete a service-linked role

Before you delete a service-linked role, you must release all instances that are associated with the service-linked role.