本文为您介绍RDS服务关联角色的应用场景以及如何删除服务关联角色。

背景信息

RDS当前支持两个服务关联角色:
  • RDS PostgreSQL服务关联角色(AliyunServiceRoleForRdsPgsqlOnEcs)
  • RDS PostgreSQL Proxy数据库代理服务关联角色(AliyunServiceRoleForRDSProxyOnEcs)

服务关联角色是在某些情况下,为了完成RDS自身的某个功能,需要获取其他云服务的访问权限,而提供的RAM角色。更多关于服务关联角色的信息请参见服务关联角色

AliyunServiceRoleForRdsPgsqlOnEcs介绍

角色名称:AliyunServiceRoleForRdsPgsqlOnEcs

角色权限策略:AliyunServiceRolePolicyForRdsPgsqlOnEcs

权限说明:

{
  "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"
        }
      }
    }
  ]
}

AliyunServiceRoleForRDSProxyOnEcs介绍

角色名称:AliyunServiceRoleForRDSProxyOnEcs

角色权限策略:AliyunServiceRoleForRDSProxyOnEcs

权限说明:
{
  "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"
        }
      }
    }
  ]
}

创建服务关联角色

您可以调用CreateServiceLinkedRole接口创建服务关联角色。

删除服务关联角色

如果您需要删除服务关联角色,需要先释放依赖这个服务角色的所有实例。