

# 查看基于资源的策略
<a name="rbp-view-policy"></a>

您可以查看附加到集群的基于资源的策略，以了解当前已实施的访问控制。

## AWS 管理控制台
<a name="rbp-view-console"></a>

**查看基于资源的策略**

1. 登录 AWS 管理控制台并打开 Aurora DSQL 控制台，网址为 [https://console.aws.amazon.com/dsql/](https://console.aws.amazon.com/dsql)。

1. 从集群列表中选择集群以打开集群详细信息页面。

1. 选择**权限**选项卡。

1. 在**基于资源的策略**部分查看附加的策略。

## AWS CLI
<a name="rbp-view-cli"></a>

使用 `get-cluster-policy` 命令来查看集群的基于资源的策略：

```
aws dsql get-cluster-policy --identifier {{your_cluster_id}}
```

## AWS SDK
<a name="rbp-view-sdk"></a>

------
#### [ Python ]

```
import boto3
import json

client = boto3.client('dsql')

response = client.get_cluster_policy(
    identifier='your_cluster_id'
)

# Parse and pretty-print the policy
policy = json.loads(response['policy'])
print(json.dumps(policy, indent=2))
```

------
#### [ Java ]

```
import software.amazon.awssdk.services.dsql.DsqlClient;
import software.amazon.awssdk.services.dsql.model.GetClusterPolicyRequest;
import software.amazon.awssdk.services.dsql.model.GetClusterPolicyResponse;

DsqlClient client = DsqlClient.create();

GetClusterPolicyRequest request = GetClusterPolicyRequest.builder()
    .identifier("your_cluster_id")
    .build();

GetClusterPolicyResponse response = client.getClusterPolicy(request);
System.out.println("Policy: " + response.policy());
```

------