

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 檢視資源型政策
<a name="rbp-view-policy"></a>

您可以檢視連接至叢集的資源型政策，以了解目前的存取控制。

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

**檢視資源型政策**

1. 登入 AWS 管理主控台，並在 https：//[https://console.aws.amazon.com/dsql/](https://console.aws.amazon.com/dsql) 開啟 Aurora 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 SDKs
<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());
```

------