

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

# 了解 Amazon DocumentDB Amazon Resource Name (ARNs)
<a name="documentdb-arns"></a>

您在 中建立的資源 AWS 都會以 Amazon Resource Name (ARN) 唯一識別。對於某些 Amazon DocumentDB （具有 MongoDB 相容性） 操作，您必須指定其 ARN，以唯一識別 Amazon DocumentDB 資源。例如，當您新增標籤至資源時，您必須提供資源的 ARN。

**Topics**
+ [建構 ARN](#documentdb-arns-constructing)
+ [尋找 ARN](#documentdb-arns-find)

## 建構 Amazon DocumentDB 資源的 ARN
<a name="documentdb-arns-constructing"></a>

您可以使用下列語法建構 Amazon DocumentDB 資源的 ARN。Amazon DocumentDB 共用 Amazon Relational Database Service (Amazon RDS) ARNs。Amazon DocumentDB ARNs包含 `rds`，而非 `docdb`。

`arn:aws:rds:region:account_number:resource_type:resource_id`


| 區域名稱 | 區域 | 可用區域 （運算） | 
| --- | --- | --- | 
| 美國東部 (俄亥俄) | `us-east-2` | 3 | 
| 美國東部 (維吉尼亞北部) | `us-east-1` | 6 | 
| 美國西部 (奧勒岡) | `us-west-2` | 4 | 
| 非洲 (開普敦) | `af-south-1` | 3 | 
| 南美洲 (聖保羅) | `sa-east-1` | 3 | 
| 亞太地區 (香港) | `ap-east-1` | 3 | 
| 亞太地區 (海德拉巴) | `ap-south-2` | 3 | 
| 亞太地區 (馬來西亞) | `ap-southeast-5` | 3 | 
| 亞太地區 (孟買) | `ap-south-1` | 3 | 
| 亞太地區 (大阪) | `ap-northeast-3` | 3 | 
| 亞太地區 (首爾) | `ap-northeast-2` | 4 | 
| 亞太地區 (新加坡) | `ap-southeast-1` | 3 | 
| 亞太地區 (悉尼) | `ap-southeast-2` | 3 | 
| 亞太地區 (雅加達) | `ap-southeast-3` | 3 | 
| 亞太地區 (墨爾本) | `ap-southeast-4` | 3 | 
| 亞太區域 (泰國) | `ap-southeast-7` | 3 | 
| 亞太地區 (東京) | `ap-northeast-1` | 3 | 
| 加拿大 (中部) | `ca-central-1` | 3 | 
| 中國 (北京) 區域 | `cn-north-1` | 3 | 
| 中國 (寧夏) | `cn-northwest-1` | 3 | 
| 歐洲 (法蘭克福) | `eu-central-1` | 3 | 
| 歐洲 (蘇黎世) | `eu-central-2` | 3 | 
| 歐洲 (愛爾蘭) | `eu-west-1` | 3 | 
| 歐洲 (倫敦) | `eu-west-2` | 3 | 
| 歐洲 (米蘭) | `eu-south-1` | 3 | 
| Europe (Paris) | `eu-west-3` | 3 | 
| 歐洲 (西班牙) | `eu-south-2` | 3 | 
| 歐洲 (斯德哥爾摩) | `eu-north-1` | 3 | 
| 墨西哥 (中部) | `mx-central-1` | 3 | 
| 中東 (阿拉伯聯合大公國) | `me-central-1` | 3 | 
| 以色列 (特拉維夫) | `il-central-1` | 3 | 
| AWS GovCloud （美國西部） | `us-gov-west-1` | 3 | 
| AWS GovCloud （美國東部） | `us-gov-east-1` | 3 | 

**注意**  
Amazon DocumentDB 架構會區隔儲存和運算。對於儲存層，Amazon DocumentDB 會在三個 AWS 可用區域 (AZs) 中複寫六份資料副本。上表中所列的可用區域是您可在指定區域用於佈建運算執行個體的可用區域數量。例如，如果您在 ap-northeast-1 中啟動 Amazon DocumentDB 叢集，您的儲存體將跨三個可用AZs複寫六種方式，但您的運算執行個體只能在兩個可用AZs使用。

下表顯示您在建構特定 Amazon DocumentDB 資源的 ARN 時應使用的格式。Amazon DocumentDB 共用 Amazon RDS ARNs的格式。Amazon DocumentDB ARNs包含 `rds`，而非 `docdb`。


| 資源類型 | ARN 格式/範例 | 
| --- | --- | 
|  執行個體 (`db`)  |  `arn:aws:rds:region:account_number:db:resource_id` <pre>arn:aws:rds:us-east-1:1234567890:db:sample-db-instance</pre>  | 
|  叢集 (`cluster`)  |  `arn:aws:rds:region:account_number:cluster:resource_id` <pre>arn:aws:rds:us-east-1:1234567890:cluster:sample-db-cluster</pre>  | 
|  叢集參數群組 (`cluster-pg`)  |  `arn:aws:rds:region:account_number:cluster-pg:resource_id` <pre>arn:aws:rds:us-east-1:1234567890:cluster-pg:sample-db-cluster-parameter-group</pre>  | 
|  安全群組 (`secgrp`)  |  `arn:aws:rds:region:account_number:secgrp:resource_id` <pre>arn:aws:rds:us-east-1:1234567890:secgrp:sample-public-secgrp</pre>  | 
|  叢集快照 (`cluster-snapshot`)  |  `arn:aws:rds:region:account_number:cluster-snapshot:resource_id` <pre>arn:aws:rds:us-east-1:1234567890:cluster-snapshot:sample-db-cluster-snapshot</pre>  | 
|  子網路群組 (`subgrp`)  |  `arn:aws:rds:region:account_number:subgrp:resource_id` <pre>arn:aws:rds:us-east-1:1234567890:subgrp:sample-subnet-10</pre>  | 

## 尋找 Amazon DocumentDB 資源 ARN
<a name="documentdb-arns-find"></a>

您可以使用 AWS 管理主控台 或 尋找 Amazon DocumentDB 資源的 ARN AWS CLI。

------
#### [ Using the AWS 管理主控台 ]

若要使用主控台尋找 ARN，請瀏覽至您需要 ARN 的資源，然後檢視該資源的詳細資訊。

例如，您可以選取叢集詳細資訊頁面上的**組態**索引標籤，以取得叢集的 ARN。您可以在**組態和狀態**區段中找到 ARN，如下列螢幕擷取畫面所示。

![\[主控台螢幕擷取畫面，顯示組態中的 ARN 以及詳細資訊窗格的狀態區段。\]](http://docs.aws.amazon.com/zh_tw/documentdb/latest/developerguide/images/documentdb-arn.png)


------
#### [ Using the AWS CLI ]

若要使用特定 Amazon DocumentDB 資源 AWS CLI 的 取得 ARN，請使用該資源的 `describe`操作。下表顯示每個 AWS CLI 操作以及與 操作搭配使用以取得 ARN 的 ARN 屬性。


| AWS CLI 命令 | ARN 屬性 | 
| --- | --- | 
|  `describe-db-instances`  |  `DBInstanceArn`  | 
|  `describe-db-clusters`  |  `DBClusterArn`  | 
|  `describe-db-parameter-groups`  |  `DBParameterGroupArn`  | 
|  `describe-db-cluster-parameter-groups`  |  `DBClusterParameterGroupArn`  | 
|  `describe-db-security-groups`  |  `DBSecurityGroupArn`  | 
|  `describe-db-snapshots`  |  `DBSnapshotArn`  | 
|  `describe-db-cluster-snapshots`  |  `DBClusterSnapshotArn`  | 
|  `describe-db-subnet-groups`  |  `DBSubnetGroupArn`  | 

**Example - 尋找叢集的 ARN**  
下列 AWS CLI 操作會尋找叢集 的 ARN`sample-cluster`。  
針對 Linux、macOS 或 Unix：  

```
aws docdb describe-db-clusters \
    --db-cluster-identifier sample-cluster \
    --query 'DBClusters[*].DBClusterArn'
```
針對 Windows：  

```
aws docdb describe-db-clusters ^
    --db-cluster-identifier sample-cluster \
    --query 'DBClusters[*].DBClusterArn'
```
此操作的輸出將會如下所示 (JSON 格式)。  

```
[
    "arn:aws:rds:us-east-1:123456789012:cluster:sample-cluster"
]
```

**Example - 尋找多個參數群組的 ARN**  
針對 Linux、macOS 或 Unix：  

```
aws docdb describe-db-cluster-parameter-groups \
   --query 'DBClusterParameterGroups[*].DBClusterParameterGroupArn'
```
針對 Windows：  

```
aws docdb describe-db-cluster-parameter-groups ^
   --query 'DBClusterParameterGroups[*].DBClusterParameterGroupArn'
```
此操作的輸出將會如下所示 (JSON 格式)。  

```
[
    "arn:aws:rds:us-east-1:123456789012:cluster-pg:custom3-6-param-grp",
    "arn:aws:rds:us-east-1:123456789012:cluster-pg:default.aurora5.6",
    "arn:aws:rds:us-east-1:123456789012:cluster-pg:default.docdb3.6"
]
```

------