

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

# 使用 IAM 政策管理對 Amazon Neptune 資料庫的存取
<a name="security-iam-access-manage"></a>

[IAM 政策](https://docs.aws.amazon.com/kms/latest/developerguide/iam-policies.html)是 JSON 物件，可定義使用動作和資源的許可。

您可以透過建立政策並將其連接到身分或資源 AWS 來控制 AWS 中的存取。政策定義與身分或資源相關聯的許可。當委託人提出請求時 AWS ， 會評估這些政策。大多數政策會以 JSON 文件 AWS 形式存放在 中。如需進一步了解 JSON 政策文件，請參閱《*IAM 使用者指南*》中的 [JSON 政策概觀](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#access_policies-json)。

管理員會使用政策，透過定義哪些**主體**可在哪些**條件**下對哪些**資源**執行**動作**，以指定可存取的範圍。

預設情況下，使用者和角色沒有許可。IAM 管理員會建立 IAM 政策並將其新增至角色，供使用者後續擔任。IAM 政策定義動作的許可，無論採用何種方式執行。

## 身分型政策
<a name="security_iam_access-manage-id-based-policies"></a>

身分型政策是附加至身分 (使用者、使用者群組或角色) 的 JSON 許可政策文件。這類政策控制身分可對哪些資源執行哪些動作，以及適用的條件。如需了解如何建立身分型政策，請參閱《*IAM 使用者指南*》中的[透過客戶管理政策定義自訂 IAM 許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html)。

身分型政策可分為*內嵌政策* (直接內嵌於單一身分) 與*受管政策* (可附加至多個身分的獨立政策)。如需了解如何在受管政策及內嵌政策之間做選擇，請參閱《IAM 使用者指南》**中的[在受管政策與內嵌政策之間選擇](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-choosing-managed-or-inline.html)。

## 搭配 AWS 組織使用服務控制政策 (SCP)
<a name="security_iam_access-manage-scp"></a>

服務控制政策 SCPs) 是 JSON 政策，可指定 中組織或組織單位 (OU) 的最大許可[AWS Organizations](https://aws.amazon.com/organizations/)。 AWS Organizations 是一種服務，用於分組和集中管理您企業擁有的多個 AWS 帳戶。若您啟用組織中的所有功能，您可以將服務控制政策 (SCP) 套用到任何或所有帳戶。SCP 會限制成員帳戶中實體的許可，包括每個 AWS 帳戶根使用者。如需 Organizations 和 SCPs的詳細資訊，請參閱 AWS Organizations 《 使用者指南》中的 [ SCPs的運作方式](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_about-scps.html)。

在 AWS 組織內 AWS 的帳戶中部署 Amazon Neptune 的客戶可以利用 SCPs 來控制哪些帳戶可以使用 Neptune。為了確保存取成員帳戶中的 Neptune，請務必：
+  允許存取 Neptune 資料庫操作`neptune-db:*`的 `rds:*`和 。請參閱[為什麼使用 Neptune 資料庫需要 Amazon RDS 許可和資源？](https://aws.amazon.com/neptune/faqs/)以取得為什麼 Neptune 資料庫需要 Amazon RDS 許可的詳細資訊。
+  允許存取 `neptune-graph:*` 以進行 Neptune Analytics 操作。

## 使用 Amazon Neptune 主控台所需的許可
<a name="security-iam-access-manage-console"></a>

對於使用 Amazon Neptune 主控台的使用者，該使用者必須擁有一組符合最低限制的許可。這些許可允許使用者描述其 AWS 帳戶的 Neptune 資源，並提供其他相關資訊，包括 Amazon EC2 安全性和網路資訊。

如果您建立比最基本必要許可更嚴格的 IAM 政策，則對於採取該 IAM 政策的使用者而言，主控台就無法如預期運作。為了確保這些使用者仍可使用 Neptune 主控台，也請將 `NeptuneReadOnlyAccess` 受管政策連線至使用者，如 [使用 AWS 受管政策存取 Amazon Neptune 資料庫](security-iam-access-managed-policies.md) 中所述。

對於僅呼叫 AWS CLI 或 Amazon Neptune API 的使用者，您不需要允許最低主控台許可。

## 將 IAM 政策附加至 IAM 使用者
<a name="iam-auth-policy-attaching"></a>

若要套用受管或自訂政策，請將它附加至 IAM 使用者。如需此主題的教學，請參閱 [IAM 使用者指南](https://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_managed-policies.html)中的*建立和連接您的第一個客戶受管政策*。

在您進行教學課程時，可使用本節所示的其中一個政策範例做為起點，並依您的需求進行自訂。教學課程結束時，您將有一個連接政策的 IAM 使用者可使用 `neptune-db:*` 動作。

**重要**  
最多需要 10 分鐘才能將 IAM 政策的變更套用到指定的 Neptune 資源。
已套用到 Neptune 資料庫叢集的 IAM 政策也會套用到該叢集中的所有執行個體。

## 使用不同種類的 IAM 政策來控制對 Neptune 的存取
<a name="iam-auth-policy"></a>

若要提供 Neptune 管理動作或 Neptune 資料庫叢集中資料的存取權，您可以將政策附加至 IAM 使用者或角色。如需如何將 IAM 政策附加至使用者的相關資訊，請參閱 [將 IAM 政策附加至 IAM 使用者](#iam-auth-policy-attaching)。如需將政策附加到角色的相關資訊，請參閱《IAM 使用者指南》**中的[新增與移除 IAM 政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_manage-attach-detach.html)。

如需對 Neptune 的一般存取，您可以使用 Neptune 的其中一個[受管政策](security-iam-access-managed-policies.md)。如需更受限制的存取，您可以使用 Neptune 支援的[管理動作](neptune-iam-admin-actions.md)和[資源](iam-admin-resources.md)來建立自己的自訂政策。

在自訂 IAM 政策中，您可以使用兩個不同種類的政策陳述式，控制 Neptune 資料庫叢集的不同存取模式：
+ [管理政策陳述式](iam-admin-policies.md) – 管理政策陳述式可讓您存取 [Neptune 管理 API](api.md)，您可以使用這些 API 來建立、設定和管理資料庫叢集及其執行個體。

  因為 Neptune 與 Amazon RDS 共用功能，所以 Neptune 政策中的管理動作、資源和條件金鑰會依設計使用 `rds:` 字首。
+ [資料存取政策聲明](iam-data-access-policies.md) – 資料存取政策陳述式會使用[資料存取動作](iam-dp-actions.md)、[資源](iam-data-resources.md)和[條件金鑰](iam-data-condition-keys.md#iam-neptune-condition-keys)，控制如何存取資料庫叢集包含的資料。

  Neptune 資料存取動作、資源和條件金鑰會使用 `neptune-db:` 字首。

## 在 Amazon Neptune 中使用 IAM 條件內容金鑰
<a name="iam-using-condition-keys"></a>

您可以在控制 Neptune 存取權的 IAM 政策陳述式中指定條件。然後，政策陳述式只有在條件成立時才會生效。

例如，您可能想要政策陳述式只在特定日期之後生效，或者只有在請求中存在特定值時才允許存取。

若要表示條件，請在政策陳述式的 [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html) 中使用預先定義的條件金鑰，搭配 [IAM 條件政策運算子](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html)，例如等於或小於。

若您在陳述式中指定多個 `Condition` 元素，或是在單一 `Condition` 元素中指定多個索引鍵， AWS 會使用邏輯 `AND` 操作評估他們。如果您為單一條件索引鍵指定多個值， 會使用邏輯`OR`操作 AWS 評估條件。必須符合所有條件，才會授與陳述式的許可。

 您也可以在指定條件時使用預留位置變數。例如，您可以只在使用者使用其 IAM 使用者名稱標記時，將存取資源的許可授予該 IAM 使用者。如需詳細資訊，請參閱《IAM 使用者指南》**中的 [IAM 政策元素：變數和標籤](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html)。

條件金鑰的資料類型會判斷您可以使用哪些條件運算子，來將請求中的值與政策陳述式中的值比較。如果您使用與該資料類型不相容的條件運算子，則比對一律失敗且政策陳述式永不套用。

Neptune 支援管理政策陳述式與資料存取政策陳述式各有不同的條件金鑰集：
+ [管理政策陳述式的條件金鑰](iam-admin-condition-keys.md)
+ [資料存取政策的條件金鑰](iam-data-condition-keys.md#iam-neptune-condition-keys)

## 支援 Amazon Neptune 中的 IAM 政策和存取控制功能
<a name="neptune-iam-policy-support"></a>

下表顯示 Neptune 針對管理政策陳述式和資料存取政策陳述式支援的 IAM 功能：


**您可以搭配 Neptune 使用的 IAM 功能**  

| IAM 功能 | 管理 | 資料存取 | 
| --- | --- | --- | 
| [身分型政策](#security_iam_access-manage-id-based-policies) | 是 | 是 | 
| [資源型政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_identity-vs-resource.html) | 否 | 否 | 
| [政策動作](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_action.html) | 是 | 是 | 
| [政策資源](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html) | 是 | 是 | 
| [全域條件鍵](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html) | 是 | (子集) | 
| [標籤型條件金鑰](iam-admin-condition-keys.md#iam-rds-tag-based-condition-keys) | 是 | 否 | 
| [存取控制清單 (ACL)](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acls.html) | 否 | 否 | 
| [服務控制政策 (SCP)](#security_iam_access-manage-scp) | 是 | 是 | 
| [服務連結角色](security-iam-service-linked-roles.md) | 是 | 否 | 

## IAM 政策限制
<a name="iam-policy-limits"></a>

最多需要 10 分鐘才能將 IAM 政策的變更套用到指定的 Neptune 資源。

已套用到 Neptune 資料庫叢集的 IAM 政策也會套用到該叢集中的所有執行個體。

Neptune 目前不支援資料平面層級的跨帳戶存取控制。只有在大量載入和使用角色鏈結時，才支援跨帳戶存取控制。如需詳細資訊，請參閱[大量載入教學課程。 ](https://docs.aws.amazon.com//neptune/latest/userguide/bulk-load-tutorial-chain-roles.html#bulk-load-tutorial-chain-cross-account)

# 使用 AWS 受管政策存取 Amazon Neptune 資料庫
<a name="security-iam-access-managed-policies"></a>

AWS 提供由 建立和管理的獨立 IAM 政策，以解決許多常見的使用案例 AWS。受管政策授與常見使用案例中必要的許可，讓您免於查詢需要哪些許可。如需詳細資訊，請參閱《*IAM 使用者指南*》中的 [AWS 受管政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies)。

您可以連接到帳戶中使用者的下列 AWS 受管政策適用於使用 Amazon Neptune 管理 APIs：
+ **[NeptuneReadOnlyAccess](read-only-access-iam-managed-policy.md)** — 針對根 AWS 帳戶中的管理和資料存取目的，授予所有 Neptune 資源的唯讀存取權。
+ **[NeptuneFullAccess](full-access-iam-managed-policy.md)** — 針對根 AWS 帳戶中的管理和資料存取目的，授予所有 Neptune 資源的完整存取權。如果您需要從 AWS CLI 或 SDK 的完整 Neptune 存取，但不用於 AWS 管理主控台 存取，則建議使用此選項。
+ **[NeptuneConsoleFullAccess](console-full-access-iam-managed-policy.md)** — 授予根 AWS 帳戶中所有 Neptune 管理動作和資源的完整存取權，但不授予任何資料存取動作或資源的完整存取權。它也會包括額外的許可，簡化來自主控台的 Neptune 存取，包括有限的 IAM 和 Amazon EC2 (VPC) 許可。
+ **[NeptuneGraphReadOnlyAccess](graph-read-only-access-iam-managed-policy.md)** — 提供對所有 Amazon Neptune Analytics 資源的唯讀存取，以及相依服務的唯讀許可
+ **[AWSServiceRoleForNeptuneGraphPolicy](aws-service-role-for-neptune-graph-policy.md)** — 可讓 Neptune Analytics 圖形發佈 CloudWatch 操作和用量指標及日誌。

Neptune IAM 角色和政策會授與 Amazon RDS 資源的部分存取權，因為 Neptune 和 Amazon RD 共用操作技術以提供某些管理功能。這包括管理 API 許可，這就是為什麼 Neptune 管理動作具有 `rds:` 字首的原因。

## Neptune AWS 受管政策的更新
<a name="neptune-managed-policy-updates"></a>

下表追蹤 Neptune 受管政策的更新，從 Neptune 開始追蹤這些變更的時間開始：


| 政策 | Description | Date | 
| --- | --- | --- | 
| AWS Amazon Neptune 的 受管政策 - 更新至現有政策 | `NeptuneReadOnlyAcess` 和 `NeptuneFullAccess`受管政策現在會在政策陳述式中包含 `Sid`（陳述式 ID) 做為識別符。 | 2024-01-22 | 
| [NeptuneGraphReadOnlyAccess](read-only-access-iam-managed-policy.md) (己發行) | 發行以提供 Neptune Analytics 圖形和資源的唯讀存取權。 | 2023-11-29 | 
| [AWSServiceRoleForNeptuneGraphPolicy](aws-service-role-for-neptune-graph-policy.md) (己發行) | 發行以允許 Neptune Analytics 圖形存取 CloudWatch 以發布操作和用量指標及日誌。請參閱 [Neptune Analytics 中的使用服務連結角色 (SLR)](https://docs.aws.amazon.com/neptune-analytics/latest/userguide/nan-service-linked-roles.html)。 | 2023-11-29 | 
| [NeptuneConsoleFullAccess](console-full-access-iam-managed-policy.md) (已新增許可) | 新增的許可權提供與 Neptune Analytics 圖形互動所需的所有存取權。 | 2023 年 11 月 29 日 | 
| [NeptuneFullAccess](full-access-iam-managed-policy.md) (已新增許可) | 已新增資料存取許可和新全球資料庫 API 的許可。 | 2022-07-28 | 
| [NeptuneConsoleFullAccess](console-full-access-iam-managed-policy.md) (已新增許可) | 已新增新全球資料庫 API 的許可。 | 2022-07-21 | 
| Neptune 已開始追蹤變更 | Neptune 開始追蹤其 AWS 受管政策的變更。 | 2022-07-21 | 

# 使用 AWS 受管政策`NeptuneReadOnlyAccess`授予 Amazon Neptune 資料庫
<a name="read-only-access-iam-managed-policy"></a>

下列 [NeptuneReadOnlyAccess](https://console.aws.amazon.com/iam/home#policies/NeptuneReadOnlyAccess) 受管政策基於管理和資料存取目的，授與所有 Neptune 動作和資源的唯讀存取權。。

**注意**  
此政策已於 2022 年 7 月 21 日更新，以包含唯讀資料存取許可以及唯讀管理許可，也包含全球資料庫動作的許可。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowReadOnlyPermissionsForRDS",
            "Effect": "Allow",
            "Action": [
                "rds:DescribeAccountAttributes",
                "rds:DescribeCertificates",
                "rds:DescribeDBClusterParameterGroups",
                "rds:DescribeDBClusterParameters",
                "rds:DescribeDBClusterSnapshotAttributes",
                "rds:DescribeDBClusterSnapshots",
                "rds:DescribeDBClusters",
                "rds:DescribeDBEngineVersions",
                "rds:DescribeDBInstances",
                "rds:DescribeDBLogFiles",
                "rds:DescribeDBParameterGroups",
                "rds:DescribeDBParameters",
                "rds:DescribeDBSubnetGroups",
                "rds:DescribeEventCategories",
                "rds:DescribeEventSubscriptions",
                "rds:DescribeEvents",
                "rds:DescribeGlobalClusters",
                "rds:DescribeOrderableDBInstanceOptions",
                "rds:DescribePendingMaintenanceActions",
                "rds:DownloadDBLogFilePortion",
                "rds:ListTagsForResource"
            ],
            "Resource": "*"
        },
        {
            "Sid": "AllowReadOnlyPermissionsForCloudwatch",
            "Effect": "Allow",
            "Action": [
                "cloudwatch:GetMetricStatistics",
                "cloudwatch:ListMetrics"
            ],
            "Resource": "*"
        },
        {
            "Sid": "AllowReadOnlyPermissionsForEC2",
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeAccountAttributes",
                "ec2:DescribeAvailabilityZones",
                "ec2:DescribeInternetGateways",
                "ec2:DescribeSecurityGroups",
                "ec2:DescribeSubnets",
                "ec2:DescribeVpcAttribute",
                "ec2:DescribeVpcs"
            ],
            "Resource": "*"
        },
        {
            "Sid": "AllowReadOnlyPermissionsForKMS",
            "Effect": "Allow",
            "Action": [
                "kms:ListKeys",
                "kms:ListRetirableGrants",
                "kms:ListAliases",
                "kms:ListKeyPolicies"
            ],
            "Resource": "*"
        },
        {
            "Sid": "AllowReadOnlyPermissionsForLogs",
            "Effect": "Allow",
            "Action": [
                "logs:DescribeLogStreams",
                "logs:GetLogEvents"
            ],
            "Resource": [
                "arn:aws:logs:*:*:log-group:/aws/rds/*:log-stream:*",
                "arn:aws:logs:*:*:log-group:/aws/neptune/*:log-stream:*"
            ]
        },
        {
            "Sid": "AllowReadOnlyPermissionsForNeptuneDB",
            "Effect": "Allow",
            "Action": [
                "neptune-db:Read*",
                "neptune-db:Get*",
                "neptune-db:List*"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}
```

------

# 使用 AWS 受管政策`NeptuneFullAccess`授予 Amazon Neptune 資料庫
<a name="full-access-iam-managed-policy"></a>

下列 [NeptuneFullAccess](https://console.aws.amazon.com/iam/home#policies/NeptuneFullAccess) 受管政策基於管理和資料存取目的，授與所有 Neptune 動作和資源的完整存取權。。如果您需要從 AWS CLI 或 SDK 進行完整存取，但不需要從 進行完整存取，則建議使用此選項 AWS 管理主控台。

**注意**  
此政策已於 2022 年 7 月 21 日更新，以包含完整資料存取許可以及完整管理許可，也包含全球資料庫動作的許可。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowNeptuneCreate",
            "Effect": "Allow",
            "Action": [
                "rds:CreateDBCluster",
                "rds:CreateDBInstance"
            ],
            "Resource": [
                "arn:aws:rds:*:*:*"
            ],
            "Condition": {
                "StringEquals": {
                    "rds:DatabaseEngine": [
                        "graphdb",
                        "neptune"
                    ]
                }
            }
        },
        {
            "Sid": "AllowManagementPermissionsForRDS",
            "Effect": "Allow",
            "Action": [
                "rds:AddRoleToDBCluster",
                "rds:AddSourceIdentifierToSubscription",
                "rds:AddTagsToResource",
                "rds:ApplyPendingMaintenanceAction",
                "rds:CopyDBClusterParameterGroup",
                "rds:CopyDBClusterSnapshot",
                "rds:CopyDBParameterGroup",
                "rds:CreateDBClusterEndpoint",
                "rds:CreateDBClusterParameterGroup",
                "rds:CreateDBClusterSnapshot",
                "rds:CreateDBParameterGroup",
                "rds:CreateDBSubnetGroup",
                "rds:CreateEventSubscription",
                "rds:CreateGlobalCluster",
                "rds:DeleteDBCluster",
                "rds:DeleteDBClusterEndpoint",
                "rds:DeleteDBClusterParameterGroup",
                "rds:DeleteDBClusterSnapshot",
                "rds:DeleteDBInstance",
                "rds:DeleteDBParameterGroup",
                "rds:DeleteDBSubnetGroup",
                "rds:DeleteEventSubscription",
                "rds:DeleteGlobalCluster",
                "rds:DescribeDBClusterEndpoints",
                "rds:DescribeAccountAttributes",
                "rds:DescribeCertificates",
                "rds:DescribeDBClusterParameterGroups",
                "rds:DescribeDBClusterParameters",
                "rds:DescribeDBClusterSnapshotAttributes",
                "rds:DescribeDBClusterSnapshots",
                "rds:DescribeDBClusters",
                "rds:DescribeDBEngineVersions",
                "rds:DescribeDBInstances",
                "rds:DescribeDBLogFiles",
                "rds:DescribeDBParameterGroups",
                "rds:DescribeDBParameters",
                "rds:DescribeDBSecurityGroups",
                "rds:DescribeDBSubnetGroups",
                "rds:DescribeEngineDefaultClusterParameters",
                "rds:DescribeEngineDefaultParameters",
                "rds:DescribeEventCategories",
                "rds:DescribeEventSubscriptions",
                "rds:DescribeEvents",
                "rds:DescribeGlobalClusters",
                "rds:DescribeOptionGroups",
                "rds:DescribeOrderableDBInstanceOptions",
                "rds:DescribePendingMaintenanceActions",
                "rds:DescribeValidDBInstanceModifications",
                "rds:DownloadDBLogFilePortion",
                "rds:FailoverDBCluster",
                "rds:FailoverGlobalCluster",
                "rds:ListTagsForResource",
                "rds:ModifyDBCluster",
                "rds:ModifyDBClusterEndpoint",
                "rds:ModifyDBClusterParameterGroup",
                "rds:ModifyDBClusterSnapshotAttribute",
                "rds:ModifyDBInstance",
                "rds:ModifyDBParameterGroup",
                "rds:ModifyDBSubnetGroup",
                "rds:ModifyEventSubscription",
                "rds:ModifyGlobalCluster",
                "rds:PromoteReadReplicaDBCluster",
                "rds:RebootDBInstance",
                "rds:RemoveFromGlobalCluster",
                "rds:RemoveRoleFromDBCluster",
                "rds:RemoveSourceIdentifierFromSubscription",
                "rds:RemoveTagsFromResource",
                "rds:ResetDBClusterParameterGroup",
                "rds:ResetDBParameterGroup",
                "rds:RestoreDBClusterFromSnapshot",
                "rds:RestoreDBClusterToPointInTime",
                "rds:StartDBCluster",
                "rds:StopDBCluster"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "AllowOtherDepedentPermissions",
            "Effect": "Allow",
            "Action": [
                "cloudwatch:GetMetricStatistics",
                "cloudwatch:ListMetrics",
                "ec2:DescribeAccountAttributes",
                "ec2:DescribeAvailabilityZones",
                "ec2:DescribeSecurityGroups",
                "ec2:DescribeSubnets",
                "ec2:DescribeVpcAttribute",
                "ec2:DescribeVpcs",
                "kms:ListAliases",
                "kms:ListKeyPolicies",
                "kms:ListKeys",
                "kms:ListRetirableGrants",
                "logs:DescribeLogStreams",
                "logs:GetLogEvents",
                "sns:ListSubscriptions",
                "sns:ListTopics",
                "sns:Publish"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Sid": "AllowPassRoleForNeptune",
            "Effect": "Allow",
            "Action": "iam:PassRole",
            "Resource": "*",
            "Condition": {
                "StringEquals": {
                    "iam:passedToService": "rds.amazonaws.com"
                }
            }
        },
        {
            "Sid": "AllowCreateSLRForNeptune",
            "Effect": "Allow",
            "Action": "iam:CreateServiceLinkedRole",
            "Resource": "arn:aws:iam::*:role/aws-service-role/rds.amazonaws.com/AWSServiceRoleForRDS",
            "Condition": {
                "StringLike": {
                    "iam:AWSServiceName": "rds.amazonaws.com"
                }
            }
        },
        {
            "Sid": "AllowDataAccessForNeptune",
            "Effect": "Allow",
            "Action": [
                "neptune-db:*"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}
```

------

# `NeptuneConsoleFullAccess` 使用 AWS 受管政策授予
<a name="console-full-access-iam-managed-policy"></a>

下列 [NeptuneConsoleFullAccess](https://console.aws.amazon.com/iam/home#policies/NeptuneConsoleFullAccess) 受管政策基於管理目的，但不基於資料存取目的，授與所有 Neptune 動作和資源的完整存取權。。它也會包括額外的許可，簡化來自主控台的 Neptune 存取，包括有限的 IAM 和 Amazon EC2 (VPC) 許可。

**注意**  
此政策已於 2023-11-29 更新，包含與 Neptune Analytics 圖形互動所需的許可權。  
此政策已於 2022-07-21 更新，包含全球資料庫動作的許可。

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "AllowNeptuneCreate",
      "Effect": "Allow",
      "Action": [
        "rds:CreateDBCluster",
        "rds:CreateDBInstance"
      ],
      "Resource": [
        "arn:aws:rds:*:*:*"
      ],
      "Condition": {
        "StringEquals": {
          "rds:DatabaseEngine": [
            "graphdb",
            "neptune"
          ]
        }
      }
    },
    {
      "Sid": "AllowManagementPermissionsForRDS",
      "Action": [
        "rds:AddRoleToDBCluster",
        "rds:AddSourceIdentifierToSubscription",
        "rds:AddTagsToResource",
        "rds:ApplyPendingMaintenanceAction",
        "rds:CopyDBClusterParameterGroup",
        "rds:CopyDBClusterSnapshot",
        "rds:CopyDBParameterGroup",
        "rds:CreateDBClusterParameterGroup",
        "rds:CreateDBClusterSnapshot",
        "rds:CreateDBParameterGroup",
        "rds:CreateDBSubnetGroup",
        "rds:CreateEventSubscription",
        "rds:DeleteDBCluster",
        "rds:DeleteDBClusterParameterGroup",
        "rds:DeleteDBClusterSnapshot",
        "rds:DeleteDBInstance",
        "rds:DeleteDBParameterGroup",
        "rds:DeleteDBSubnetGroup",
        "rds:DeleteEventSubscription",
        "rds:DescribeAccountAttributes",
        "rds:DescribeCertificates",
        "rds:DescribeDBClusterParameterGroups",
        "rds:DescribeDBClusterParameters",
        "rds:DescribeDBClusterSnapshotAttributes",
        "rds:DescribeDBClusterSnapshots",
        "rds:DescribeDBClusters",
        "rds:DescribeDBEngineVersions",
        "rds:DescribeDBInstances",
        "rds:DescribeDBLogFiles",
        "rds:DescribeDBParameterGroups",
        "rds:DescribeDBParameters",
        "rds:DescribeDBSecurityGroups",
        "rds:DescribeDBSubnetGroups",
        "rds:DescribeEngineDefaultClusterParameters",
        "rds:DescribeEngineDefaultParameters",
        "rds:DescribeEventCategories",
        "rds:DescribeEventSubscriptions",
        "rds:DescribeEvents",
        "rds:DescribeOptionGroups",
        "rds:DescribeOrderableDBInstanceOptions",
        "rds:DescribePendingMaintenanceActions",
        "rds:DescribeValidDBInstanceModifications",
        "rds:DownloadDBLogFilePortion",
        "rds:FailoverDBCluster",
        "rds:ListTagsForResource",
        "rds:ModifyDBCluster",
        "rds:ModifyDBClusterParameterGroup",
        "rds:ModifyDBClusterSnapshotAttribute",
        "rds:ModifyDBInstance",
        "rds:ModifyDBParameterGroup",
        "rds:ModifyDBSubnetGroup",
        "rds:ModifyEventSubscription",
        "rds:PromoteReadReplicaDBCluster",
        "rds:RebootDBInstance",
        "rds:RemoveRoleFromDBCluster",
        "rds:RemoveSourceIdentifierFromSubscription",
        "rds:RemoveTagsFromResource",
        "rds:ResetDBClusterParameterGroup",
        "rds:ResetDBParameterGroup",
        "rds:RestoreDBClusterFromSnapshot",
        "rds:RestoreDBClusterToPointInTime"
      ],
      "Effect": "Allow",
      "Resource": [
        "*"
      ]
    },
    {
      "Sid": "AllowOtherDepedentPermissions",
      "Action": [
        "cloudwatch:GetMetricStatistics",
        "cloudwatch:ListMetrics",
        "ec2:AllocateAddress",
        "ec2:AssignIpv6Addresses",
        "ec2:AssignPrivateIpAddresses",
        "ec2:AssociateAddress",
        "ec2:AssociateRouteTable",
        "ec2:AssociateSubnetCidrBlock",
        "ec2:AssociateVpcCidrBlock",
        "ec2:AttachInternetGateway",
        "ec2:AttachNetworkInterface",
        "ec2:CreateCustomerGateway",
        "ec2:CreateDefaultSubnet",
        "ec2:CreateDefaultVpc",
        "ec2:CreateInternetGateway",
        "ec2:CreateNatGateway",
        "ec2:CreateNetworkInterface",
        "ec2:CreateRoute",
        "ec2:CreateRouteTable",
        "ec2:CreateSecurityGroup",
        "ec2:CreateSubnet",
        "ec2:CreateVpc",
        "ec2:CreateVpcEndpoint",
        "ec2:CreateVpcEndpoint",
        "ec2:DescribeAccountAttributes",
        "ec2:DescribeAccountAttributes",
        "ec2:DescribeAddresses",
        "ec2:DescribeAvailabilityZones",
        "ec2:DescribeAvailabilityZones",
        "ec2:DescribeCustomerGateways",
        "ec2:DescribeInstances",
        "ec2:DescribeNatGateways",
        "ec2:DescribeNetworkInterfaces",
        "ec2:DescribePrefixLists",
        "ec2:DescribeRouteTables",
        "ec2:DescribeSecurityGroupReferences",
        "ec2:DescribeSecurityGroups",
        "ec2:DescribeSecurityGroups",
        "ec2:DescribeSubnets",
        "ec2:DescribeSubnets",
        "ec2:DescribeVpcAttribute",
        "ec2:DescribeVpcAttribute",
        "ec2:DescribeVpcEndpoints",
        "ec2:DescribeVpcs",
        "ec2:DescribeVpcs",
        "ec2:ModifyNetworkInterfaceAttribute",
        "ec2:ModifySubnetAttribute",
        "ec2:ModifyVpcAttribute",
        "ec2:ModifyVpcEndpoint",
        "iam:ListRoles",
        "kms:ListAliases",
        "kms:ListKeyPolicies",
        "kms:ListKeys",
        "kms:ListRetirableGrants",
        "logs:DescribeLogStreams",
        "logs:GetLogEvents",
        "sns:ListSubscriptions",
        "sns:ListTopics",
        "sns:Publish"
      ],
      "Effect": "Allow",
      "Resource": [
        "*"
      ]
    },
    {
      "Sid": "AllowPassRoleForNeptune",
      "Action": "iam:PassRole",
      "Effect": "Allow",
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "iam:passedToService": "rds.amazonaws.com"
        }
      }
    },
    {
      "Sid": "AllowCreateSLRForNeptune",
      "Action": "iam:CreateServiceLinkedRole",
      "Effect": "Allow",
      "Resource": "arn:aws:iam::*:role/aws-service-role/rds.amazonaws.com/AWSServiceRoleForRDS",
      "Condition": {
        "StringLike": {
          "iam:AWSServiceName": "rds.amazonaws.com"
        }
      }
    },
    {
      "Sid": "AllowManagementPermissionsForNeptuneAnalytics",
      "Effect": "Allow",
      "Action": [
        "neptune-graph:CreateGraph",
        "neptune-graph:DeleteGraph",
        "neptune-graph:GetGraph",
        "neptune-graph:ListGraphs",
        "neptune-graph:UpdateGraph",
        "neptune-graph:ResetGraph",
        "neptune-graph:CreateGraphSnapshot",
        "neptune-graph:DeleteGraphSnapshot",
        "neptune-graph:GetGraphSnapshot",
        "neptune-graph:ListGraphSnapshots",
        "neptune-graph:RestoreGraphFromSnapshot",
        "neptune-graph:CreatePrivateGraphEndpoint",
        "neptune-graph:GetPrivateGraphEndpoint",
        "neptune-graph:ListPrivateGraphEndpoints",
        "neptune-graph:DeletePrivateGraphEndpoint",
        "neptune-graph:CreateGraphUsingImportTask",
        "neptune-graph:GetImportTask",
        "neptune-graph:ListImportTasks",
        "neptune-graph:CancelImportTask"
      ],
      "Resource": [
        "arn:aws:neptune-graph:*:*:*"
      ]
    },
    {
      "Sid": "AllowPassRoleForNeptuneAnalytics",
      "Effect": "Allow",
      "Action": "iam:PassRole",
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "iam:passedToService": "neptune-graph.amazonaws.com"
        }
      }
    },
    {
      "Sid": "AllowCreateSLRForNeptuneAnalytics",
      "Effect": "Allow",
      "Action": "iam:CreateServiceLinkedRole",
      "Resource": "arn:aws:iam::*:role/aws-service-role/neptune-graph.amazonaws.com/AWSServiceRoleForNeptuneGraph",
      "Condition": {
        "StringLike": {
          "iam:AWSServiceName": "neptune-graph.amazonaws.com"
        }
      }
    }
  ]
}
```

------

# `NeptuneGraphReadOnlyAccess` 使用 AWS 受管政策授予
<a name="graph-read-only-access-iam-managed-policy"></a>

以下 [NeptuneGraphReadOnlyAccess](https://console.aws.amazon.com/iam/home#policies/NeptuneGraphReadOnlyAccess) 受管政策提供對所有 Amazon Neptune Analytics 資源的唯讀許可，以及相依服務的唯讀許可。

此政策包含執行以下動作的許可：
+ **對於 Amazon EC2** — 擷取 VPC、子網路、安全群組和可用區域的相關資訊。
+ **對於 AWS KMS** – 擷取 KMS 金鑰和別名的相關資訊。
+ **對於 CloudWatch** — 擷取有關 CloudWatch 指標的資訊。
+ **對於 CloudWatch Logs** — 擷取有關 CloudWatch 日誌串流和事件的資訊。

**注意**  
這項政策已於 2023-11-29 發布。

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "AllowReadOnlyPermissionsForNeptuneGraph",
      "Effect": "Allow",
      "Action": [
        "neptune-graph:Get*",
        "neptune-graph:List*",
        "neptune-graph:Read*"
      ],
      "Resource": "*"
    },
    {
      "Sid": "AllowReadOnlyPermissionsForEC2",
      "Effect": "Allow",
      "Action": [
        "ec2:DescribeVpcEndpoints",
        "ec2:DescribeVpcAttribute",
        "ec2:DescribeSecurityGroups",
        "ec2:DescribeSubnets",
        "ec2:DescribeVpcs",
        "ec2:DescribeAvailabilityZones"
      ],
      "Resource": "*"
    },
    {
      "Sid": "AllowReadOnlyPermissionsForKMS",
      "Effect": "Allow",
      "Action": [
        "kms:ListKeys",
        "kms:ListAliases"
      ],
      "Resource": "*"
    },
    {
      "Sid": "AllowReadOnlyPermissionsForCloudwatch",
      "Effect": "Allow",
      "Action": [
        "cloudwatch:GetMetricData",
        "cloudwatch:ListMetrics",
        "cloudwatch:GetMetricStatistics"
      ],
      "Resource": "*"
    },
    {
      "Sid": "AllowReadOnlyPermissionsForLogs",
      "Effect": "Allow",
      "Action": [
        "logs:DescribeLogStreams",
        "logs:GetLogEvents"
      ],
      "Resource": [
        "arn:aws:logs:*:*:log-group:/aws/neptune/*:log-stream:*"
      ]
    }
  ]
}
```

------

# 使用 授予 Neptune 圖形的存取權 `AWSServiceRoleForNeptuneGraphPolicy`
<a name="aws-service-role-for-neptune-graph-policy"></a>

以下的 [AWSServiceRoleForNeptuneGraphPolicy](https://console.aws.amazon.com/iam/home#policies/AWSServiceRoleForNeptuneGraphPolicy) 受管政策可讓您存取 CloudWatch 的圖形，以發佈操作和用量指標與日誌。請參閱 [nan-service-linked-roles](https://docs.aws.amazon.com/neptune-analytics/latest/userguide/nan-service-linked-roles.html)。

**注意**  
這項已政策於 2023-11-29 發布。

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "GraphMetrics",
      "Effect": "Allow",
      "Action": [
        "cloudwatch:PutMetricData"
      ],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "cloudwatch:namespace": [
            "AWS/Neptune",
            "AWS/Usage"
          ]
        }
      }
    },
    {
      "Sid": "GraphLogGroup",
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogGroup"
      ],
      "Resource": [
        "arn:aws:logs:*:*:log-group:/aws/neptune/*"
      ],
      "Condition": {
        "StringEquals": {
          "aws:ResourceAccount": "${aws:PrincipalAccount}"
        }
      }
    },
    {
      "Sid": "GraphLogEvents",
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogStream",
        "logs:PutLogEvents",
        "logs:DescribeLogStreams"
      ],
      "Resource": [
        "arn:aws:logs:*:*:log-group:/aws/neptune/*:log-stream:*"
      ],
      "Condition": {
        "StringEquals": {
          "aws:ResourceAccount": "${aws:PrincipalAccount}"
        }
      }
    }
  ]
}
```

------



# 使用 IAM 條件內容索引鍵自訂對 Amazon Neptune 資源的存取
<a name="iam-condition-keys"></a>

您可以在 IAM 政策中指定條件，控制對 Neptune 管理動作和資源的存取。然後，政策陳述式只有在條件成立時才會生效。

例如，您可能想要政策陳述式只在特定日期之後生效，或者只有在 API 請求中存在特定值時才允許存取。

若要表示條件，請在政策陳述式的 [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html) 中使用預先定義的條件金鑰，搭配 [IAM 條件政策運算子](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html)，例如等於或小於。

若您在陳述式中指定多個 `Condition` 元素，或是在單一 `Condition` 元素中指定多個索引鍵， AWS 會使用邏輯 `AND` 操作評估他們。如果您為單一條件索引鍵指定多個值， 會使用邏輯`OR`操作 AWS 評估條件。必須符合所有條件，才會授與陳述式的許可。

 您也可以在指定條件時使用預留位置變數。例如，您可以只在使用者使用其 IAM 使用者名稱標記時，將存取資源的許可授予該 IAM 使用者。如需詳細資訊，請參閱《IAM 使用者指南》**中的 [IAM 政策元素：變數和標籤](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html)。

條件金鑰的資料類型會判斷您可以使用哪些條件運算子，來將請求中的值與政策陳述式中的值比較。如果您使用與該資料類型不相容的條件運算子，則比對一律失敗且政策陳述式永不套用。

**Neptune 管理政策陳述式的 IAM 條件金鑰**
+ [全域條件金鑰](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)   –   您可以在 Neptune 管理政策陳述式中使用大多數 AWS 全域條件金鑰。
+ [服務特定條件金鑰](iam-admin-condition-keys.md)   –   這些是針對特定 AWS 服務定義的金鑰。[用於管理 Amazon Neptune 的 IAM 條件金鑰](iam-admin-condition-keys.md) 中列出了 Neptune 針對管理政策陳述式支援的條件金鑰。

**Neptune 資料存取政策陳述式的 IAM 條件金鑰**
+ [全域條件金鑰](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html) – [AWS 資料存取政策陳述式中 Neptune 支援的全域條件內容索引鍵](iam-data-condition-keys.md#iam-data-global-condition-keys) 中列出了 Neptune 在資料存取政策陳述式中所支援的這些金鑰的子集。
+ [條件金鑰](iam-data-condition-keys.md) 中列出了 Neptune 針對資料存取政策陳述式定義的服務特定條件金鑰。

# 建立自訂 IAM 政策陳述式以管理 Amazon Neptune
<a name="iam-admin-policies"></a>

管理政策陳述式可讓您控制 IAM 使用者可以做什麼來管理 Neptune 資料庫。

Neptune 管理政策陳述式會授與 Neptune 支援的一或多個[管理動作](neptune-iam-admin-actions.md)和[管理資源](iam-admin-resources.md)的存取權。您也可以使用 [條件金鑰](iam-admin-condition-keys.md) 讓管理許可更具體。

**注意**  
因為 Neptune 與 Amazon RDS 共用功能，所以管理政策陳述式中的管理動作、資源和服務特定條件金鑰會依設計使用 `rds:` 字首。

**Topics**
+ [用於管理 Amazon Neptune 的 IAM 動作](neptune-iam-admin-actions.md)
+ [用於管理 Amazon Neptune 的 IAM 資源類型](iam-admin-resources.md)
+ [用於管理 Amazon Neptune 的 IAM 條件金鑰](iam-admin-condition-keys.md)
+ [建立 Amazon Neptune 的 IAM 管理政策陳述式](iam-admin-policy-examples.md)

# 用於管理 Amazon Neptune 的 IAM 動作
<a name="neptune-iam-admin-actions"></a>

您可以在 IAM 政策陳述式的 `Action` 元素中使用下面列出的管理動作，來控制對 [Neptune 管理 API](api.md) 的存取。在政策中使用動作時，通常會允許或拒絕存取相同名稱的 API 操作或 CLI 命令。不過，在某些情況下，單一動作可控制對多個操作的存取。或者，某些操作需要多種不同的動作。

下列清單中的 `Resource type` 欄位指示每個動作是否支援資源層級許可。如果此欄位沒有值，您必須在政策陳述式的 `Resource` 元素中指定所有資源 ("\$1")。如果資料欄包含資源類型，則您可以在具有該動作的陳述式中指定該類型的資源 ARN。[此頁面](iam-admin-resources.md)上列出了 Neptune 管理資源類型。

下列清單中的必要資源會以星號 (\$1) 表示。如果您在使用此動作的陳述式中指定資源層級許可 ARN，則它必須屬於此類型。某些動作支援多種資源類型。如果資源類型是選用的 (換句話說，沒有以星號標記)，則您不必包含它。

如需此處所列欄位的詳細資訊，請參閱《[IAM 使用者指南](https://docs.aws.amazon.com/IAM/latest/UserGuide/)》中的[動作表](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_actions-resources-contextkeys.html#actions_table)。

## rds:AddRoleToDBCluster
<a name="neptune-iam-admin-actions-AddRoleToDBCluster"></a>

`AddRoleToDBCluster` 會將 IAM 角色與 Neptune 資料庫叢集建立關聯。

*存取層級：*`Write`。

*相依動作：*`iam:PassRole`。

*資源類型：*[cluster](iam-admin-resources.md#neptune-cluster-resource) (必要)。

## rds:AddSourceIdentifierToSubscription
<a name="neptune-iam-admin-actions-AddSourceIdentifierToSubscription"></a>

`AddSourceIdentifierToSubscription` 會將來源識別符新增至現有的 Neptune 事件通知訂閱。

*存取層級：*`Write`。

*資源類型：*[es](iam-admin-resources.md#neptune-es-resource) (必要)

## rds:AddTagsToResource
<a name="neptune-iam-admin-actions-AddTagsToResource"></a>

`AddTagsToResource` 會將 IAM 角色與 Neptune 資料庫叢集建立關聯。

*存取層級：*`Write`。

*資源類型：*
+ [db](iam-admin-resources.md#neptune-db-resource)
+ [es](iam-admin-resources.md#neptune-es-resource)
+ [pg](iam-admin-resources.md#neptune-pg-resource)
+ [cluster-snapshot](iam-admin-resources.md#neptune-cluster-snapshot-resource)
+ [subgrp](iam-admin-resources.md#neptune-subgrp-resource)

*條件金鑰：*
+ [aws:RequestTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_RequestTag)
+ [aws:TagKeys](iam-admin-condition-keys.md#admin-aws_TagKeys)

## rds:ApplyPendingMaintenanceAction
<a name="neptune-iam-admin-actions-ApplyPendingMaintenanceAction"></a>

`ApplyPendingMaintenanceAction` 會將待定維護動作套用到資源。

*存取層級：*`Write`。

*資源類型：*[db](iam-admin-resources.md#neptune-db-resource) (必要)。

## rds:CopyDBClusterParameterGroup
<a name="neptune-iam-admin-actions-CopyDBClusterParameterGroup"></a>

`CopyDBClusterParameterGroup` 會複製指定的資料庫叢集參數群組。

*存取層級：*`Write`。

*資源類型：*[cluster-pg](iam-admin-resources.md#neptune-cluster-pg-resource) (必要)。

## rds:CopyDBClusterSnapshot
<a name="neptune-iam-admin-actions-CopyDBClusterSnapshot"></a>

`CopyDBClusterSnapshot` 會複製資料庫叢集的快照。

*存取層級：*`Write`。

*資源類型：*[cluster-snapshot](iam-admin-resources.md#neptune-cluster-snapshot-resource) (必要)。

## rds:CopyDBParameterGroup
<a name="neptune-iam-admin-actions-CopyDBParameterGroup"></a>

`CopyDBParameterGroup` 會複製指定的資料庫參數群組。

*存取層級：*`Write`。

*資源類型：*[pg](iam-admin-resources.md#neptune-pg-resource) (必要)。

## rds:CreateDBCluster
<a name="neptune-iam-admin-actions-CreateDBCluster"></a>

`CreateDBCluster` 會建立新的 Neptune 資料庫叢集。

*存取層級：*`Tagging`。

*相依動作：*`iam:PassRole`。

*資源類型：*
+ [cluster](iam-admin-resources.md#neptune-cluster-resource) (必要)。
+ [cluster-pg](iam-admin-resources.md#neptune-cluster-pg-resource) (必要)。
+ [subgrp](iam-admin-resources.md#neptune-subgrp-resource) (必要)。

*條件金鑰：*
+ [aws:RequestTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_RequestTag)
+ [aws:TagKeys](iam-admin-condition-keys.md#admin-aws_TagKeys)
+ [neptune-rds\$1DatabaseEngine](iam-admin-condition-keys.md#admin-rds_DatabaseEngine)

## rds:CreateDBClusterParameterGroup
<a name="neptune-iam-admin-actions-CreateDBClusterParameterGroup"></a>

`CreateDBClusterParameterGroup` 會建立新的資料庫叢集參數群組。

*存取層級：*`Tagging`。

*資源類型：*[cluster-pg](iam-admin-resources.md#neptune-cluster-pg-resource) (必要)。

*條件金鑰：*
+ [aws:RequestTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_RequestTag)
+ [aws:TagKeys](iam-admin-condition-keys.md#admin-aws_TagKeys)

## rds:CreateDBClusterSnapshot
<a name="neptune-iam-admin-actions-CreateDBClusterSnapshot"></a>

`CreateDBClusterSnapshot` 會建立資料庫叢集的快照。

*存取層級：*`Tagging`。

*資源類型：*
+ [cluster](iam-admin-resources.md#neptune-cluster-resource) (必要)。
+ [cluster-snapshot](iam-admin-resources.md#neptune-cluster-snapshot-resource) (必要)。

*條件金鑰：*
+ [aws:RequestTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_RequestTag)
+ [aws:TagKeys](iam-admin-condition-keys.md#admin-aws_TagKeys)

## rds:CreateDBInstance
<a name="neptune-iam-admin-actions-CreateDBInstance"></a>

`CreateDBInstance` 會建立新的資料庫執行個體。

*存取層級：*`Tagging`。

*相依動作：*`iam:PassRole`。

*資源類型：*
+ [db](iam-admin-resources.md#neptune-db-resource) (必要)。
+ [pg](iam-admin-resources.md#neptune-pg-resource) (必要)。
+ [subgrp](iam-admin-resources.md#neptune-subgrp-resource) (必要)。

*條件金鑰：*
+ [aws:RequestTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_RequestTag)
+ [aws:TagKeys](iam-admin-condition-keys.md#admin-aws_TagKeys)

## rds:CreateDBParameterGroup
<a name="neptune-iam-admin-actions-CreateDBParameterGroup"></a>

`CreateDBParameterGroup` 會建立新的資料庫參數群組。

*存取層級：*`Tagging`。

*資源類型：*[pg](iam-admin-resources.md#neptune-pg-resource) (必要)。

*條件金鑰：*
+ [aws:RequestTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_RequestTag)
+ [aws:TagKeys](iam-admin-condition-keys.md#admin-aws_TagKeys)

## rds:CreateDBSubnetGroup
<a name="neptune-iam-admin-actions-CreateDBSubnetGroup"></a>

`CreateDBSubnetGroup` 會建立新的資料庫子網路群組。

*存取層級：*`Tagging`。

*資源類型：*[subgrp](iam-admin-resources.md#neptune-subgrp-resource) (必要)。

*條件金鑰：*
+ [aws:RequestTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_RequestTag)
+ [aws:TagKeys](iam-admin-condition-keys.md#admin-aws_TagKeys)

## rds:CreateEventSubscription
<a name="neptune-iam-admin-actions-CreateEventSubscription"></a>

`CreateEventSubscription` 會建立 Neptune 事件通知訂閱。

*存取層級：*`Tagging`。

*資源類型：*[es](iam-admin-resources.md#neptune-es-resource) (必要)

*條件金鑰：*
+ [aws:RequestTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_RequestTag)
+ [aws:TagKeys](iam-admin-condition-keys.md#admin-aws_TagKeys)

## rds:DeleteDBCluster
<a name="neptune-iam-admin-actions-DeleteDBCluster"></a>

`DeleteDBCluster` 會刪除現有的 Neptune 資料庫叢集。

*存取層級：*`Write`。

*資源類型：*
+ [cluster](iam-admin-resources.md#neptune-cluster-resource) (必要)。
+ [cluster-snapshot](iam-admin-resources.md#neptune-cluster-snapshot-resource) (必要)。

## rds:DeleteDBClusterParameterGroup
<a name="neptune-iam-admin-actions-DeleteDBClusterParameterGroup"></a>

`DeleteDBClusterParameterGroup` 會刪除指定的資料庫叢集參數群組。

*存取層級：*`Write`。

*資源類型：*[cluster-pg](iam-admin-resources.md#neptune-cluster-pg-resource) (必要)。

## rds:DeleteDBClusterSnapshot
<a name="neptune-iam-admin-actions-DeleteDBClusterSnapshot"></a>

`DeleteDBClusterSnapshot` 會刪除資料庫叢集快照。

*存取層級：*`Write`。

*資源類型：*[cluster-snapshot](iam-admin-resources.md#neptune-cluster-snapshot-resource) (必要)。

## rds:DeleteDBInstance
<a name="neptune-iam-admin-actions-DeleteDBInstance"></a>

`DeleteDBInstance` 會刪除指定的資料庫執行個體。

*存取層級：*`Write`。

*資源類型：*[db](iam-admin-resources.md#neptune-db-resource) (必要)。

## rds:DeleteDBParameterGroup
<a name="neptune-iam-admin-actions-DeleteDBParameterGroup"></a>

`DeleteDBParameterGroup` 會刪除指定的 DBParameterGroup。

*存取層級：*`Write`。

*資源類型：*[pg](iam-admin-resources.md#neptune-pg-resource) (必要)。

## rds:DeleteDBSubnetGroup
<a name="neptune-iam-admin-actions-DeleteDBSubnetGroup"></a>

`DeleteDBSubnetGroup` 會刪除資料庫子網路群組。

*存取層級：*`Write`。

*資源類型：*[subgrp](iam-admin-resources.md#neptune-subgrp-resource) (必要)。

## rds:DeleteEventSubscription
<a name="neptune-iam-admin-actions-DeleteEventSubscription"></a>

`DeleteEventSubscription` 會刪除事件通知訂閱。

*存取層級：*`Write`。

*資源類型：*[es](iam-admin-resources.md#neptune-es-resource) (必要)

## rds:DescribeDBClusterParameterGroups
<a name="neptune-iam-admin-actions-DescribeDBClusterParameterGroups"></a>

`DescribeDBClusterParameterGroups` 會傳回 DBClusterParameterGroup 描述的清單。

*存取層級：*`List`。

*資源類型：*[cluster-pg](iam-admin-resources.md#neptune-cluster-pg-resource) (必要)。

## rds:DescribeDBClusterParameters
<a name="neptune-iam-admin-actions-DescribeDBClusterParameters"></a>

`DescribeDBClusterParameters` 會傳回特定資料庫叢集參數群組的詳細參數清單。

*存取層級：*`List`。

*資源類型：*[cluster-pg](iam-admin-resources.md#neptune-cluster-pg-resource) (必要)。

## rds:DescribeDBClusterSnapshotAttributes
<a name="neptune-iam-admin-actions-DescribeDBClusterSnapshotAttributes"></a>

`DescribeDBClusterSnapshotAttributes` 會傳回手動資料庫叢集快照之資料庫叢集快照屬性名稱和值的清單。

*存取層級：*`List`。

*資源類型：*[cluster-snapshot](iam-admin-resources.md#neptune-cluster-snapshot-resource) (必要)。

## rds:DescribeDBClusterSnapshots
<a name="neptune-iam-admin-actions-DescribeDBClusterSnapshots"></a>

`DescribeDBClusterSnapshots` 會傳回資料庫叢集快照的相關資訊。

*存取層級：*`Read`。

## rds:DescribeDBClusters
<a name="neptune-iam-admin-actions-DescribeDBClusters"></a>

`DescribeDBClusters` 會傳回佈建 Neptune 資料庫叢集的相關資訊。

*存取層級：*`List`。

*資源類型：*[cluster](iam-admin-resources.md#neptune-cluster-resource) (必要)。

## rds:DescribeDBEngineVersions
<a name="neptune-iam-admin-actions-DescribeDBEngineVersions"></a>

`DescribeDBEngineVersions` 會傳回可用的資料庫引擎清單。

*存取層級：*`List`。

*資源類型：*[pg](iam-admin-resources.md#neptune-pg-resource) (必要)。

## rds:DescribeDBInstances
<a name="neptune-iam-admin-actions-DescribeDBInstances"></a>

`DescribeDBInstances` 會傳回資料庫執行個體的相關資訊。

*存取層級：*`List`。

*資源類型：*[es](iam-admin-resources.md#neptune-es-resource) (必要)

## rds:DescribeDBParameterGroups
<a name="neptune-iam-admin-actions-DescribeDBParameterGroups"></a>

`DescribeDBParameterGroups` 會傳回 DBParameterGroup 描述的清單。

*存取層級：*`List`。

*資源類型：*[pg](iam-admin-resources.md#neptune-pg-resource) (必要)。

## rds:DescribeDBParameters
<a name="neptune-iam-admin-actions-DescribeDBParameters"></a>

`DescribeDBParameters` 會傳回特定資料庫參數群組的詳細參數清單。

*存取層級：*`List`。

*資源類型：*[pg](iam-admin-resources.md#neptune-pg-resource) (必要)。

## rds:DescribeDBSubnetGroups
<a name="neptune-iam-admin-actions-DescribeDBSubnetGroups"></a>

`DescribeDBSubnetGroups` 會傳回 DBSubnetGroup 描述的清單。

*存取層級：*`List`。

*資源類型：*[subgrp](iam-admin-resources.md#neptune-subgrp-resource) (必要)。

## rds:DescribeEventCategories
<a name="neptune-iam-admin-actions-DescribeEventCategories"></a>

`DescribeEventCategories` 會傳回所有事件來源類型或特定來源類型 (如果指定) 的類別清單。

*存取層級：*`List`。

## rds:DescribeEventSubscriptions
<a name="neptune-iam-admin-actions-DescribeEventSubscriptions"></a>

`DescribeEventSubscriptions` 會列出客戶帳戶的所有訂閱描述。

*存取層級：*`List`。

*資源類型：*[es](iam-admin-resources.md#neptune-es-resource) (必要)

## rds:DescribeEvents
<a name="neptune-iam-admin-actions-DescribeEvents"></a>

`DescribeEvents` 會傳回過去 14 天與資料庫執行個體、資料庫安全群組和資料庫參數群組相關的事件。

*存取層級：*`List`。

*資源類型：*[es](iam-admin-resources.md#neptune-es-resource) (必要)

## rds:DescribeOrderableDBInstanceOptions
<a name="neptune-iam-admin-actions-DescribeOrderableDBInstanceOptions"></a>

`DescribeOrderableDBInstanceOptions` 會傳回指定引擎的可排序資料庫執行個體選項清單。

*存取層級：*`List`。

## rds:DescribePendingMaintenanceActions
<a name="neptune-iam-admin-actions-DescribePendingMaintenanceActions"></a>

`DescribePendingMaintenanceActions` 會傳回至少有一個待處理維護動作的資源清單 (例如，資料庫執行個體)。

*存取層級：*`List`。

*資源類型：*[db](iam-admin-resources.md#neptune-db-resource) (必要)。

## rds:DescribeValidDBInstanceModifications
<a name="neptune-iam-admin-actions-DescribeValidDBInstanceModifications"></a>

`DescribeValidDBInstanceModifications` 會列出您對資料庫執行個體可做的修改。

*存取層級：*`List`。

*資源類型：*[db](iam-admin-resources.md#neptune-db-resource) (必要)。

## rds:FailoverDBCluster
<a name="neptune-iam-admin-actions-FailoverDBCluster"></a>

`FailoverDBCluster` 會強制資料庫叢集進行容錯移轉。

*存取層級：*`Write`。

*資源類型：*[cluster](iam-admin-resources.md#neptune-cluster-resource) (必要)。

## rds:ListTagsForResource
<a name="neptune-iam-admin-actions-ListTagsForResource"></a>

`ListTagsForResource` 會列出 Neptune 資源的所有標籤。

*存取層級：*`Read`。

*資源類型：*
+ [cluster-snapshot](iam-admin-resources.md#neptune-cluster-snapshot-resource)
+ [db](iam-admin-resources.md#neptune-db-resource)
+ [es](iam-admin-resources.md#neptune-es-resource)
+ [pg](iam-admin-resources.md#neptune-pg-resource)
+ [subgrp](iam-admin-resources.md#neptune-subgrp-resource)

## rds:ModifyDBCluster
<a name="neptune-iam-admin-actions-ModifyDBCluster"></a>

`ModifyDBCluster`

修改 Neptune 資料庫叢集的設定。

*存取層級：*`Write`。

*相依動作：*`iam:PassRole`。

*資源類型：*
+ [cluster](iam-admin-resources.md#neptune-cluster-resource) (必要)。
+ [cluster-pg](iam-admin-resources.md#neptune-cluster-pg-resource) (必要)。

## rds:ModifyDBClusterParameterGroup
<a name="neptune-iam-admin-actions-ModifyDBClusterParameterGroup"></a>

`ModifyDBClusterParameterGroup` 會修改資料庫叢集參數群組的參數。

*存取層級：*`Write`。

*資源類型：*[cluster-pg](iam-admin-resources.md#neptune-cluster-pg-resource) (必要)。

## rds:ModifyDBClusterSnapshotAttribute
<a name="neptune-iam-admin-actions-ModifyDBClusterSnapshotAttribute"></a>

`ModifyDBClusterSnapshotAttribute` 會在手動資料庫叢集快照中新增或移除屬性和值。

*存取層級：*`Write`。

*資源類型：*[cluster-snapshot](iam-admin-resources.md#neptune-cluster-snapshot-resource) (必要)。

## rds:ModifyDBInstance
<a name="neptune-iam-admin-actions-ModifyDBInstance"></a>

`ModifyDBInstance` 會修改資料庫執行個體的設定。

*存取層級：*`Write`。

*相依動作：*`iam:PassRole`。

*資源類型：*
+ [db](iam-admin-resources.md#neptune-db-resource) (必要)。
+ [pg](iam-admin-resources.md#neptune-pg-resource) (必要)。

## rds:ModifyDBParameterGroup
<a name="neptune-iam-admin-actions-ModifyDBParameterGroup"></a>

`ModifyDBParameterGroup` 會修改資料庫參數群組的參數。

*存取層級：*`Write`。

*資源類型：*[pg](iam-admin-resources.md#neptune-pg-resource) (必要)。

## rds:ModifyDBSubnetGroup
<a name="neptune-iam-admin-actions-ModifyDBSubnetGroup"></a>

`ModifyDBSubnetGroup` 會修改現有的資料庫子網路群組。

*存取層級：*`Write`。

*資源類型：*[subgrp](iam-admin-resources.md#neptune-subgrp-resource) (必要)。

## rds:ModifyEventSubscription
<a name="neptune-iam-admin-actions-ModifyEventSubscription"></a>

`ModifyEventSubscription` 會修改現有的 Neptune 事件通知訂閱。

*存取層級：*`Write`。

*資源類型：*[es](iam-admin-resources.md#neptune-es-resource) (必要)

## rds:RebootDBInstance
<a name="neptune-iam-admin-actions-RebootDBInstance"></a>

`RebootDBInstance` 會重新啟動執行個體的資料庫引擎服務。

*存取層級：*`Write`。

*資源類型：*[db](iam-admin-resources.md#neptune-db-resource) (必要)。

## rds:RemoveRoleFromDBCluster
<a name="neptune-iam-admin-actions-RemoveRoleFromDBCluster"></a>

`RemoveRoleFromDBCluster` 取消 AWS Identity and Access Management (IAM) 角色與 Amazon Neptune 資料庫叢集的關聯。

*存取層級：*`Write`。

*相依動作：*`iam:PassRole`。

*資源類型：*[cluster](iam-admin-resources.md#neptune-cluster-resource) (必要)。

## rds:RemoveSourceIdentifierFromSubscription
<a name="neptune-iam-admin-actions-RemoveSourceIdentifierFromSubscription"></a>

`RemoveSourceIdentifierFromSubscription` 會從現有的 Neptune 事件通知訂閱移除來源識別符。

*存取層級：*`Write`。

*資源類型：*[es](iam-admin-resources.md#neptune-es-resource) (必要)

## rds:RemoveTagsFromResource
<a name="neptune-iam-admin-actions-RemoveTagsFromResource"></a>

`RemoveTagsFromResource` 會從 Neptune 資源中移除中繼資料標籤。

*存取層級：*`Tagging`。

*資源類型：*
+ [cluster-snapshot](iam-admin-resources.md#neptune-cluster-snapshot-resource)
+ [db](iam-admin-resources.md#neptune-db-resource)
+ [es](iam-admin-resources.md#neptune-es-resource)
+ [pg](iam-admin-resources.md#neptune-pg-resource)
+ [subgrp](iam-admin-resources.md#neptune-subgrp-resource)

*條件金鑰：*
+ [aws:RequestTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_RequestTag)
+ [aws:TagKeys](iam-admin-condition-keys.md#admin-aws_TagKeys)

## rds:ResetDBClusterParameterGroup
<a name="neptune-iam-admin-actions-ResetDBClusterParameterGroup"></a>

`ResetDBClusterParameterGroup` 會將資料庫叢集參數群組的參數修改為預設值。

*存取層級：*`Write`。

*資源類型：*[cluster-pg](iam-admin-resources.md#neptune-cluster-pg-resource) (必要)。

## rds:ResetDBParameterGroup
<a name="neptune-iam-admin-actions-ResetDBParameterGroup"></a>

`ResetDBParameterGroup` 會將資料庫參數群組的參數修改為引擎/系統的預設值。

*存取層級：*`Write`。

*資源類型：*[pg](iam-admin-resources.md#neptune-pg-resource) (必要)。

## rds:RestoreDBClusterFromSnapshot
<a name="neptune-iam-admin-actions-RestoreDBClusterFromSnapshot"></a>

`RestoreDBClusterFromSnapshot` 會從資料庫叢集快照建立新的資料庫叢集。

*存取層級：*`Write`。

*相依動作：*`iam:PassRole`。

*資源類型：*
+ [cluster](iam-admin-resources.md#neptune-cluster-resource) (必要)。
+ [cluster-snapshot](iam-admin-resources.md#neptune-cluster-snapshot-resource) (必要)。

*條件金鑰：*
+ [aws:RequestTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_RequestTag)
+ [aws:TagKeys](iam-admin-condition-keys.md#admin-aws_TagKeys)

## rds:RestoreDBClusterToPointInTime
<a name="neptune-iam-admin-actions-RestoreDBClusterToPointInTime"></a>

`RestoreDBClusterToPointInTime` 會將資料庫叢集還原到任意時間點。

*存取層級：*`Write`。

*相依動作：*`iam:PassRole`。

*資源類型：*
+ [cluster](iam-admin-resources.md#neptune-cluster-resource) (必要)。
+ [subgrp](iam-admin-resources.md#neptune-subgrp-resource) (必要)。

*條件金鑰：*
+ [aws:RequestTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_RequestTag)
+ [aws:TagKeys](iam-admin-condition-keys.md#admin-aws_TagKeys)

## rds:StartDBCluster
<a name="neptune-iam-admin-actions-StartDBCluster"></a>

`StartDBCluster` 會啟動指定的資料庫叢集。

*存取層級：*`Write`。

*資源類型：*[cluster](iam-admin-resources.md#neptune-cluster-resource) (必要)。

## rds:StopDBCluster
<a name="neptune-iam-admin-actions-StopDBCluster"></a>

`StopDBCluster` 會停止指定的資料庫叢集。

*存取層級：*`Write`。

*資源類型：*[cluster](iam-admin-resources.md#neptune-cluster-resource) (必要)。

# 用於管理 Amazon Neptune 的 IAM 資源類型
<a name="iam-admin-resources"></a>

Neptune 支援下表中的資源類型，用於 IAM 管理政策陳述式的 `Resource` 元素。如需 `Resource` 元素的詳細資訊，請參閱 [IAM JSON 政策元素：Resource](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_resource.html)。

[Neptune 管理動作清單](neptune-iam-admin-actions.md)會識別可隨每個動作指定的資源類型。資源類型也會確定您可在政策中包括哪些條件金鑰，如下表的最後一欄所指定。

下表中的 `ARN` 欄會指定參考此類型資源必須使用的 Amazon Resource Name (ARN) 格式。` $ ` 後面的部分必須取代為您案例的實際值。例如，如果您在 ARN 中看到 `$user-name`，您必須將該字串取代為實際 IAM 使用者的名稱，或取代為包含 IAM 使用者名稱的政策變數。如需 ARN 的詳細資訊，請參閱 [IAM ARN](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-arns) 和 [在 Amazon Neptune 中使用管理 ARN](tagging-arns.md)。

` Condition Keys ` 欄會指定只有在此陳述式中同時包含此資源和相容的支援動作時，您才能在 IAM 政策陳述式中包含的條件內容金鑰。


****  

| 資源類型 | ARN | 條件金鑰 | 
| --- | --- | --- | 
|  `cluster` (資料庫叢集)  | arn:partition:rds:region:account-id:cluster:instance-name |  [aws:ResourceTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_ResourceTag) [rds:cluster-tag/*tag-key*](iam-admin-condition-keys.md#admin-rds_cluster-tag)  | 
|  `cluster-pg` (資料庫叢集參數群組)  | arn:partition:rds:region:account-id:cluster-pg:neptune-DBClusterParameterGroupName |  [aws:ResourceTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_ResourceTag)  | 
|  `cluster-snapshot` (資料庫叢集快照)  | arn:partition:rds:region:account-id:cluster-snapshot:neptune-DBClusterSnapshotName |  [aws:ResourceTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_ResourceTag) [rds:cluster-snapshot-tag/*tag-key*](iam-admin-condition-keys.md#admin-rds_cluster-snapshot-tag)  | 
|  `db` (資料庫執行個體)  | arn:partition:rds:region:account-id:db:neptune-DbInstanceName |  [aws:ResourceTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_ResourceTag) [rds:DatabaseClass](iam-admin-condition-keys.md#admin-rds_DatabaseClass) [rds:DatabaseEngine](iam-admin-condition-keys.md#admin-rds_DatabaseEngine) [rds:db-tag/*tag-key*](iam-admin-condition-keys.md#admin-rds_db-tag)  | 
|  `es` (事件訂閱)  | arn:partition:rds:region:account-id:es:neptune-CustSubscriptionId  |  [aws:ResourceTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_ResourceTag) [rds:es-tag/*tag-key*](iam-admin-condition-keys.md#admin-rds_es-tag)  | 
|  `pg` (資料庫參數群組)  | arn:partition:rds:region:account-id:pg:neptune-ParameterGroupName |  [aws:ResourceTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_ResourceTag) [rds:pg-tag/*tag-key*](iam-admin-condition-keys.md#admin-rds_pg-tag)  | 
|  `subgrp` (資料庫子網路群組)  | arn:partition:rds:region:account-id:subgrp:neptune-DBSubnetGroupName\$1 |  [aws:ResourceTag/*tag-key*](iam-admin-condition-keys.md#admin-aws_ResourceTag) [rds:subgrp-tag/*tag-key*](iam-admin-condition-keys.md#admin-rds_subgrp-tag)  | 

# 用於管理 Amazon Neptune 的 IAM 條件金鑰
<a name="iam-admin-condition-keys"></a>

[使用條件金鑰](security-iam-access-manage.md#iam-using-condition-keys)，您可以在 IAM 政策陳述式中指定條件，以便陳述式只在條件成立時才生效。您可以在 Neptune 管理政策陳述式中使用的條件金鑰分為下列類別：
+ [全域條件索引鍵](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)   –   這些是由 定義 AWS ，可用於 AWS 服務。大部分可以用於 Neptune 管理政策陳述式。
+ [管理資源屬性條件金鑰](#iam-rds-property-condition-keys) – [下面](#iam-rds-property-condition-keys)列出的這些金鑰是以管理資源的屬性為基礎。
+ [標籤型存取條件金鑰](#iam-rds-tag-based-condition-keys) – [下面](#iam-rds-tag-based-condition-keys)列出的這些金鑰是以附加至管理資源的 [AWS 標籤](https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html)為基礎。

## Neptune 管理資源屬性條件金鑰
<a name="iam-rds-property-condition-keys"></a>


| 條件索引鍵 | 描述 | Type | 
| --- | --- | --- | 
| rds:DatabaseClass | 依資料庫執行個體類別的類型篩選存取 | String | 
| rds:DatabaseEngine | 依資料庫引擎來篩選存取權限。如需可能的值，請參閱建立資料庫執行個體 API 中的引擎參數 | 字串 | 
| rds:DatabaseName | 依資料庫執行個體上的資料庫使用者定義名稱來篩選存取權限。 | 字串 | 
| rds:EndpointType | 依端點類型篩選存取權限。READER、WRITER、CUSTOM 的其中一個 | String | 
| rds:Vpc | 依此值指定資料庫執行個體是否在 Amazon Virtual Private Cloud (Amazon VPC) 中執行來篩選存取權限。若要指示資料庫執行個體在 Amazon VPC 中執行，請指定 true。 | Boolean | 

## 管理標籤型條件金鑰
<a name="iam-rds-tag-based-condition-keys"></a>

Amazon Neptune 支援在 IAM 政策中使用自訂標籤來指定條件，以透過 [管理 API 參考](api.md) 控制對 Neptune 的存取。

例如，如果您將名為 `environment` 的標籤新增至資料庫執行個體，而此標籤具有 `beta`、`staging` 和 `production` 等值，則您可以建立一個政策，根據該標籤的值限制對執行個體的存取。

**重要**  
如果您使用標記來管理對 Neptune 資源的存取，請務必保護對標籤的存取。您可以建立 `AddTagsToResource` 和 `RemoveTagsFromResource` 動作的政策，來限制對標籤的存取。  
例如，您可以使用下列政策，拒絕使用者可對所有資源新增或移除標籤的能力。然後，您可以建立政策來允許特定使用者新增或移除標籤。  

****  

```
{ "Version":"2012-10-17",		 	 	 
  "Statement":[
    { "Sid": "DenyTagUpdates",
      "Effect": "Deny",
      "Action": [
        "rds:AddTagsToResource",
        "rds:RemoveTagsFromResource"
      ],
      "Resource":"*"
    }
  ]
}
```

下列標籤型條件金鑰僅會在管理政策陳述式中使用管理資源。


**標籤型管理條件金鑰**  

| 條件索引鍵 | 描述 | Type | 
| --- | --- | --- | 
|   [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-requesttag](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-requesttag)  | 根據請求中存在的標籤金鑰值對來篩選存取。 | String | 
|   [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-resourcetag](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-resourcetag)  | 根據附加到資源的標籤金鑰值對來篩選存取。 | String | 
|   [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keyss](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keyss)  | 根據請求中存在的標籤金鑰來篩選存取。 | String | 
| rds:cluster-pg-tag/\$1\$1TagKey\$1 | 依附加到資料庫叢集參數群組的標籤來篩選存取。 | String | 
| rds:cluster-snapshot-tag/\$1\$1TagKey\$1 | 依附加到資料庫叢集快照的標籤來篩選存取。 | String | 
| rds:cluster-tag/\$1\$1TagKey\$1 | 依附加到資料庫叢集的標籤來篩選存取。 | String | 
| rds:db-tag/\$1\$1TagKey\$1 | 依附加到資料庫執行個體的標籤來篩選存取。 | String | 
| rds:es-tag/\$1\$1TagKey\$1 | 依附加到事件訂閱的標籤來篩選存取。 | String | 
| rds:pg-tag/\$1\$1TagKey\$1 | 依附加到資料庫參數群組的標籤來篩選存取。 | String | 
| rds:req-tag/\$1\$1TagKey\$1 | 依限制可用來標記資源的一組標籤金鑰和值來篩選存取。 | String | 
| rds:secgrp-tag/\$1\$1TagKey\$1 | 依附加到資料庫安全群組的標籤來篩選存取。 | String | 
| rds:snapshot-tag/\$1\$1TagKey\$1 | 依附加到資料庫快照的標籤來篩選存取。 | String | 
| rds:subgrp-tag/\$1\$1TagKey\$1 | 依附加至資料庫子網路群組的標籤來篩選存取權限 | String | 

# 建立 Amazon Neptune 的 IAM 管理政策陳述式
<a name="iam-admin-policy-examples"></a>

## 一般管理政策範例
<a name="iam-admin-policy-general-examples"></a>

以下範例說明如何建立 Neptune 管理政策，授與對資料庫叢集執行各種管理動作的許可。

### 防止 IAM 使用者刪除所指定資料庫執行個體的政策
<a name="iam-admin-policy-not-delete-instance"></a>

以下是防止 IAM 使用者刪除所指定 Neptune 資料庫執行個體的範例政策：

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "DenyDeleteOneInstance",
      "Effect": "Deny",
      "Action": "rds:DeleteDBInstance",
      "Resource": "arn:aws:rds:us-west-2:123456789012:db:my-instance-name"
    }
  ]
}
```

------

### 授與許可來建立新資料庫執行個體的政策
<a name="iam-admin-policy-to-create-instances"></a>

以下是允許 IAM 使用者在指定的 Neptune 資料庫叢集中建立資料庫執行個體的範例政策：

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "AllowCreateInstance",
      "Effect": "Allow",
      "Action": "rds:CreateDBInstance",
      "Resource": "arn:aws:rds:us-west-2:123456789012:cluster:my-cluster"
    }
  ]
}
```

------

### 授與許可來建立使用特定資料庫參數群組之新資料庫執行個體的政策
<a name="iam-admin-policy-to-create-instances-with-pg"></a>

以下範例政策允許 IAM 使用者僅使用指定的資料庫參數群組，在指定的 Neptune 資料庫叢集 (此處的 `us-west-2`) 中建立資料庫執行個體。

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "AllowCreateInstanceWithPG",
      "Effect": "Allow",
      "Action": "rds:CreateDBInstance",
      "Resource": [
        "arn:aws:rds:us-west-2:123456789012:cluster:my-cluster",
        "arn:aws:rds:us-west-2:123456789012:pg:my-instance-pg"
      ]
    }
  ]
}
```

------

### 授與許可來描述任何資源的政策
<a name="iam-admin-policy-to-describe"></a>

以下是允許 IAM 使用者描述任何 Neptune 資源的範例政策。

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AllowDescribe",
            "Effect": "Allow",
            "Action": "rds:Describe*",
            "Resource": "*"
        }
    ]
}
```

------

## 標籤型管理政策範例
<a name="iam-admin-policy-tagging-examples"></a>

以下範例說明如何建立 Neptune 管理政策，使用標籤來篩選資料庫叢集上各種管理動作的許可。

### 範例 1：使用可以採取多個值的自訂標籤，對資源上的動作授與許可
<a name="security-iam-tag-examples-1"></a>

以下政策允許在 `env` 標籤設定為 `dev` 或 `test` 的任何資料庫執行個體上使用 `ModifyDBInstance`、`CreateDBInstance` 或 `DeleteDBInstance` API：

------
#### [ JSON ]

****  

```
{ "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "AllowDevTestAccess",
      "Effect": "Allow",
      "Action": [
        "rds:ModifyDBInstance",
        "rds:CreateDBInstance",
        "rds:DeleteDBInstance"
      ],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "rds:db-tag/env": [
              "dev",
              "test"
          ],
          "rds:DatabaseEngine": "neptune"
        }
      }
    }
  ]
}
```

------

### 範例 2：限制可用來標記資源的一組標籤金鑰和值
<a name="security-iam-tag-examples-2"></a>

此政策會使用 `Condition` 金鑰，允許將具有金鑰 `env` 和值 `test`、`qa` 或 `dev` 的標籤新增至資源：

------
#### [ JSON ]

****  

```
{ "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "AllowTagAccessForDevResources",
      "Effect": "Allow",
      "Action": [
        "rds:AddTagsToResource",
        "rds:RemoveTagsFromResource"
      ],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "rds:req-tag/env": [
            "test",
            "qa",
            "dev"
          ],
          "rds:DatabaseEngine": "neptune"
        }
      }
    }
  ]
}
```

------

### 範例 3：允許根據 `aws:ResourceTag` 完整存取 Neptune 資源
<a name="security-iam-tag-examples-3"></a>

以下政策與上述第一個範例類似，但會改用 `aws:ResourceTag`：

------
#### [ JSON ]

****  

```
{ "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "AllowFullAccessToDev",
      "Effect": "Allow",
      "Action": [
        "rds:*"
      ],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "aws:ResourceTag/env": "dev",
          "rds:DatabaseEngine": "neptune"
        }
      }
    }
  ]
}
```

------

# 建立自訂 IAM 政策陳述式以存取 Amazon Neptune 中的資料
<a name="iam-data-access-policies"></a>

Neptune 資料存取政策陳述式會使用[資料存取動作](iam-dp-actions.md)、[資源](iam-data-resources.md)和[條件金鑰](iam-data-condition-keys.md#iam-neptune-condition-keys)，它們前面全都會加上字首 `neptune-db:`。

**Topics**
+ [在 Neptune 資料存取政策陳述式中使用查詢動作](#iam-data-query-actions)
+ [Amazon Neptune 中資料存取的 IAM 動作](iam-dp-actions.md)
+ [用於存取 Amazon Neptune 中資料的 IAM 資源類型](iam-data-resources.md)
+ [用於存取 Amazon Neptune 中資料的 IAM 條件金鑰](iam-data-condition-keys.md)
+ [在 Amazon Neptune 中建立 IAM 資料存取政策](iam-data-access-examples.md)

## 在 Neptune 資料存取政策陳述式中使用查詢動作
<a name="iam-data-query-actions"></a>

有三個 Neptune 查詢動作可以用於資料存取政策陳述式，即 `ReadDataViaQuery`、`WriteDataViaQuery` 和 `DeleteDataViaQuery`。特定查詢可能需要許可才能執行其中多個動作，而且必須允許這些動作的哪個組合才能執行查詢，可能並不總是顯而易見。

在執行查詢之前，Neptune 會確定執行查詢每個步驟所需的許可，並將這些許可合併成查詢所需的完整許可集。請注意，這個完整許可集包括查詢可能**會執行的所有動作，這不一定是查詢在資料上執行時將實際執行的動作集。

這表示若要允許給定的查詢執行，您必須為查詢可能執行的每個動作提供許可，不論查詢是否實際執行這些動作。

以下是一些範例 Gremlin 查詢，其中更詳細地解釋了此情況：
+ 

  ```
  g.V().count()
  ```

  `g.V()` 和 `count()` 只需要讀取存取權，因此整體查詢只需要 `ReadDataViaQuery` 存取權。
+ 

  ```
  g.addV()
  ```

  `addV()` 需要在插入新頂點之前檢查具有給定 ID 的頂點是否存在。這表示它同時需要 `ReadDataViaQuery` 和 `WriteDataViaQuery` 存取權。
+ 

  ```
  g.V('1').as('a').out('created').addE('createdBy').to('a')
  ```

  `g.V('1').as('a')` 和 `out('created')` 只需要讀取存取權，但 `addE().from('a')` 同時需要讀取和寫入存取權，因為 `addE()` 需要讀取 `from` 和 `to` 頂點，並檢查具有相同 ID 的邊緣是否已經存在，然後再新增邊緣。因此，整體查詢同時需要 `ReadDataViaQuery` 和 `WriteDataViaQuery` 存取權。
+ 

  ```
  g.V().drop()
  ```

  `g.V()` 僅需要讀取存取權。`drop()` 同時需要讀取和刪除存取權，因為其需要在刪除頂點或邊緣之前讀取它，所以整體查詢同時需要 `ReadDataViaQuery` 和 `DeleteDataViaQuery` 存取權。
+ 

  ```
  g.V('1').property(single, 'key1', 'value1')
  ```

  `g.V('1')` 只需要讀取存取權，但 `property(single, 'key1', 'value1')` 需要讀取、寫入和刪除存取權。在這裡，`property()` 步驟會插入金鑰和值，如果它們不存在於頂點的 話，但如果它們確實已經存在，它會刪除現有的屬性值，並在其位置插入一個新值。因此，整個查詢需要 `ReadDataViaQuery`、`WriteDataViaQuery` 和 `DeleteDataViaQuery` 存取權。

  任何包含 `property()` 步驟的查詢都需要 `ReadDataViaQuery`、`WriteDataViaQuery` 和 `DeleteDataViaQuery` 許可。

以下是一些 openCypher 範例：
+ 

  ```
  MATCH (n)
  RETURN n
  ```

  此查詢讀取資料庫中的所有節點並傳回它們，這只需要 `ReadDataViaQuery` 存取權。
+ 

  ```
  MATCH (n:Person)
  SET n.dept = 'AWS'
  ```

  此查詢需要 `ReadDataViaQuery`、`WriteDataViaQuery` 和 `DeleteDataViaQuery` 存取權。它會讀取標籤為 'Person' 的所有節點，並將具有金鑰 `dept` 和值 `AWS` 的新屬性新增至其中，或者如果 `dept` 屬性已經存在，則其會刪除舊值並改為插入 `AWS`。此外，如果要設定的值為 `null`，則 `SET` 會完全刪除屬性。

   因為 `SET` 子句在某些情況下可能需要刪除現有值，所以它**始終**需要 `DeleteDataViaQuery` 許可以及 `ReadDataViaQuery` 和 `WriteDataViaQuery` 許可。
+ 

  ```
  MATCH (n:Person)
  DETACH DELETE n
  ```

  此查詢需要 `ReadDataViaQuery` 和 `DeleteDataViaQuery` 許可。它會找出所有具有標籤 `Person` 的節點，然後刪除它們以及連線至這些節點的邊緣和任何相關聯的標籤和屬性。
+ 

  ```
  MERGE (n:Person {name: 'John'})-[:knows]->(:Person {name: 'Peter'})
  RETURN n
  ```

  此查詢需要 `ReadDataViaQuery` 和 `WriteDataViaQuery` 許可。`MERGE` 子句會比對指定的模式或建立它。因為，如果模式不符，則可能會發生寫入，所以需要寫入許可以及讀取許可。

# Amazon Neptune 中資料存取的 IAM 動作
<a name="iam-dp-actions"></a>

請注意，Neptune 資料存取動作具有字首 `neptune-db:`，而 Neptune 中的管理動作則具有字首 `rds:`。

IAM 中資料資源的 Amazon Resource Name (ARN) 與在建立時指派給叢集的 ARN 不同。您必須建構 ARN，如[指定資料資源](iam-data-resources.md)中所示。這類資料資源 ARN 可以使用萬用字元來包含多個資源。

資料存取政策陳述式也可以包含 [neptune-db:QueryLanguage](iam-data-condition-keys.md#iam-neptune-condition-keys)，來限制依查詢語言的存取。

從 [版本：1.2.0.0 (2022 年 7 月 21 日)](engine-releases-1.2.0.0.md) 開始，Neptune 支援將許可限制為一或多個[特定 Neptune 動作](https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonneptune.html)。這提供了可能比以前更精細的存取控制。

**重要**  
最多需要 10 分鐘才能將 IAM 政策的變更套用到指定的 Neptune 資源。
已套用到 Neptune 資料庫叢集的 IAM 政策也會套用到該叢集中的所有執行個體。

## *查詢型資料存取動作*
<a name="iam-dp-actions-queries"></a>

**注意**  
需要哪些許可才能執行給定查詢並不總是顯而易見，因為查詢可能會採取多個動作，取決於它們處理的資料。如需詳細資訊，請參閱[使用查詢動作](iam-data-access-policies.md#iam-data-query-actions)。

## `neptune-db:ReadDataViaQuery`
<a name="readdataviaquery"></a>

`ReadDataViaQuery` 允許使用者透過提交查詢從 Neptune 資料庫讀取資料。

*動作群組：*唯讀、讀寫。

*動作內容金鑰：*`neptune-db:QueryLanguage`。

*必要資源：*資料庫。

## `neptune-db:WriteDataViaQuery`
<a name="writedataviaquery"></a>

`WriteDataViaQuery` 允許使用者透過提交查詢將資料寫入 Neptune 資料庫。

*動作群組：*讀寫。

*動作內容金鑰：*`neptune-db:QueryLanguage`。

*必要資源：*資料庫。

## `neptune-db:DeleteDataViaQuery`
<a name="deletedataviaquery"></a>

`DeleteDataViaQuery` 允許使用者透過提交查詢從 Neptune 資料庫刪除資料。

*動作群組：*讀寫。

*動作內容金鑰：*`neptune-db:QueryLanguage`。

*必要資源：*資料庫。

## `neptune-db:GetQueryStatus`
<a name="getquerystatus"></a>

`GetQueryStatus` 允許使用者檢查所有作用中查詢的狀態。

*動作群組：*唯讀、讀寫。

*動作內容金鑰：*`neptune-db:QueryLanguage`。

*必要資源：*資料庫。

## `neptune-db:GetStreamRecords`
<a name="getstreamrecords"></a>

`GetStreamRecords` 允許使用者從 Neptune 擷取串流記錄。

*動作群組：*讀寫。

*動作內容金鑰：*`neptune-db:QueryLanguage`。

*必要資源：*資料庫。

## `neptune-db:CancelQuery`
<a name="cancelquery"></a>

`CancelQuery` 允許使用者取消查詢。

*動作群組：*讀寫。

*必要資源：*資料庫。

## *一般資料存取動作*
<a name="iam-dp-actions-general"></a>

## `neptune-db:GetEngineStatus`
<a name="getenginestatus"></a>

`GetEngineStatus` 允許使用者檢查 Neptune 引擎的狀態。

*動作群組：*唯讀、讀寫。

*必要資源：*資料庫。

## `neptune-db:GetStatisticsStatus`
<a name="getstatisticsstatus"></a>

`GetStatisticsStatus` 允許使用者檢查正為資料庫收集之統計資料的狀態。

*動作群組：*唯讀、讀寫。

*必要資源：*資料庫。

## `neptune-db:GetGraphSummary`
<a name="getgraphsummary"></a>

`GetGraphSummary` 圖形摘要 API 可讓您擷取圖形的唯讀摘要。

*動作群組：*唯讀、讀寫。

*必要資源：*資料庫。

## `neptune-db:ManageStatistics`
<a name="managestatistics"></a>

`ManageStatistics` 允許使用者管理資料庫的統計資料集合。

*動作群組：*讀寫。

*必要資源：*資料庫。

## `neptune-db:DeleteStatistics`
<a name="deletestatistics"></a>

`DeleteStatistics` 允許使用者刪除資料庫中的所有統計資料。

*動作群組：*讀寫。

*必要資源：*資料庫。

## `neptune-db:ResetDatabase`
<a name="resetdatabase"></a>

`ResetDatabase` 允許使用者取得重設所需的權杖，以及重設 Neptune 資料庫。

*動作群組：*讀寫。

*必要資源：*資料庫。

## *大量載入器資料存取動作*
<a name="iam-dp-actions-loader"></a>

## `neptune-db:StartLoaderJob`
<a name="startloaderjob"></a>

`StartLoaderJob` 允許使用者啟動大量載入器工作。

*動作群組：*讀寫。

*必要資源：*資料庫。

## `neptune-db:GetLoaderJobStatus`
<a name="getloaderjobstatus"></a>

`GetLoaderJobStatus` 允許使用者檢查大量載入器工作的狀態。

*動作群組：*唯讀、讀寫。

*必要資源：*資料庫。

## `neptune-db:ListLoaderJobs`
<a name="listloaderjobs"></a>

`ListLoaderJobs` 允許使用者列出所有大量載入器工作。

*動作群組：*僅列出、唯讀、讀寫。

*必要資源：*資料庫。

## `neptune-db:CancelLoaderJob`
<a name="cancelloaderjob"></a>

`CancelLoaderJob` 允許使用者取消載入器工作。

*動作群組：*讀寫。

*必要資源：*資料庫。

## *機器學習資料存取動作*
<a name="iam-dp-actions-ml"></a>

## `neptune-db:StartMLDataProcessingJob`
<a name="startmldataprocessingjob"></a>

`StartMLDataProcessingJob` 允許使用者啟動 Neptune ML 資料處理工作。

*動作群組：*讀寫。

*必要資源：*資料庫。

## `neptune-db:StartMLModelTrainingJob`
<a name="startmlmodeltrainingjob"></a>

`StartMLModelTrainingJob` 允許使用者啟動 ML 模型訓練工作。

*動作群組：*讀寫。

*必要資源：*資料庫。

## `neptune-db:StartMLModelTransformJob`
<a name="startmlmodeltransformjob"></a>

`StartMLModelTransformJob` 允許使用者啟動 ML 模型轉換工作。

*動作群組：*讀寫。

*必要資源：*資料庫。

## `neptune-db:CreateMLEndpoint`
<a name="createmlendpoint"></a>

`CreateMLEndpoint` 允許使用者建立 Neptune ML 端點。

*動作群組：*讀寫。

*必要資源：*資料庫。

## `neptune-db:GetMLDataProcessingJobStatus`
<a name="getmldataprocessingjobstatus"></a>

`GetMLDataProcessingJobStatus` 允許使用者檢查 Neptune ML 資料處理工作的狀態。

*動作群組：*唯讀、讀寫。

*必要資源：*資料庫。

## `neptune-db:GetMLModelTrainingJobStatus`
<a name="getmlmodeltrainingjobstatus"></a>

`GetMLModelTrainingJobStatus` 允許使用者檢查 Neptune ML 模型訓練工作的狀態。

*動作群組：*唯讀、讀寫。

*必要資源：*資料庫。

## `neptune-db:GetMLModelTransformJobStatus`
<a name="getmlmodeltransformjobstatus"></a>

`GetMLModelTransformJobStatus` 允許使用者檢查 Neptune ML 模型轉換工作的狀態。

*動作群組：*唯讀、讀寫。

*必要資源：*資料庫。

## `neptune-db:GetMLEndpointStatus`
<a name="getmlendpointstatus"></a>

`GetMLEndpointStatus` 允許使用者檢查 Neptune ML 端點的狀態。

*動作群組：*唯讀、讀寫。

*必要資源：*資料庫。

## `neptune-db:ListMLDataProcessingJobs`
<a name="listmldataprocessingjobs"></a>

`ListMLDataProcessingJobs` 允許使用者列出所有 Neptune ML 資料處理工作。

*動作群組：*僅列出、唯讀、讀寫。

*必要資源：*資料庫。

## `neptune-db:ListMLModelTrainingJobs`
<a name="listmlmodeltrainingjobs"></a>

`ListMLModelTrainingJobs` 允許使用者列出所有 Neptune ML 模型訓練工作。

*動作群組：*僅列出、唯讀、讀寫。

*必要資源：*資料庫。

## `neptune-db:ListMLModelTransformJobs`
<a name="listmlmodeltransformjobs"></a>

`ListMLModelTransformJobs` 允許使用者列出所有 ML 模型轉換工作。

*動作群組：*僅列出、唯讀、讀寫。

*必要資源：*資料庫。

## `neptune-db:ListMLEndpoints`
<a name="listmlendpoints"></a>

`ListMLEndpoints` 允許使用者列出所有 Neptune ML 端點。

*動作群組：*僅列出、唯讀、讀寫。

*必要資源：*資料庫。

## `neptune-db:CancelMLDataProcessingJob`
<a name="cancelmldataprocessingjob"></a>

`CancelMLDataProcessingJob` 允許使用者取消 Neptune ML 資料處理工作。

*動作群組：*讀寫。

*必要資源：*資料庫。

## `neptune-db:CancelMLModelTrainingJob`
<a name="cancelmlmodeltrainingjob"></a>

`CancelMLModelTrainingJob` 允許使用者取消 Neptune ML 模型訓練工作。

*動作群組：*讀寫。

*必要資源：*資料庫。

## `neptune-db:CancelMLModelTransformJob`
<a name="cancelmlmodeltransformjob"></a>

`CancelMLModelTransformJob` 允許使用者取消 Neptune ML 模型轉換工作。

*動作群組：*讀寫。

*必要資源：*資料庫。

## `neptune-db:DeleteMLEndpoint`
<a name="deletemlendpoint"></a>

`DeleteMLEndpoint` 允許使用者刪除 Neptune ML 端點。

*動作群組：*讀寫。

*必要資源：*資料庫。

# 用於存取 Amazon Neptune 中資料的 IAM 資源類型
<a name="iam-data-resources"></a>

資料資源與資料動作一樣，也有 `neptune-db:` 字首。

在 Neptune 資料存取政策中，您可以使用下列格式，在 ARN 中指定要授與存取權的資料庫叢集：

```
arn:aws:neptune-db:region:account-id:cluster-resource-id/*
```

這樣的資源 ARN 包含以下幾個部分：
+ `region` 是 Amazon Neptune 資料庫叢集 AWS 的區域。
+ `account-id` 是資料庫叢集的 AWS 帳戶號碼。
+ `cluster-resource-id` 是資料庫叢集的資源 ID。
**重要**  
`cluster-resource-id` 與叢集識別符不同。若要在 Neptune 中尋找叢集資源 ID AWS 管理主控台，請參閱有問題的資料庫叢集的**組態**區段。

# 用於存取 Amazon Neptune 中資料的 IAM 條件金鑰
<a name="iam-data-condition-keys"></a>

[使用條件金鑰](security-iam-access-manage.md#iam-using-condition-keys)，您可以在 IAM 政策陳述式中指定條件，以便陳述式只在條件成立時才生效。

您可以在 Neptune 資料存取政策陳述式中使用的條件金鑰分為下列類別：
+ [全域條件索引鍵](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)   – Neptune   在資料存取政策陳述式中支援的 AWS 全域條件索引鍵子集[如下所示](#iam-data-global-condition-keys)。
+ [服務特定條件金鑰](#iam-neptune-condition-keys) – 這些是 Neptune 定義的金鑰，專門用於資料存取政策陳述式。目前只有一個，即 [neptune-db:QueryLanguage](#neptune-db-query-language)，僅在使用特定的查詢語言時才授與存取權。

## AWS 資料存取政策陳述式中 Neptune 支援的全域條件內容索引鍵
<a name="iam-data-global-condition-keys"></a>

下表列出 Amazon Neptune 支援用於資料存取政策陳述式的 [AWS 全域條件內容金鑰](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)子集：


**您可以在資料存取政策陳述式中使用的全域條件金鑰**  

| 條件金鑰 | 描述 | Type | 
| --- | --- | --- | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-currenttime](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-currenttime) | 依請求的目前日期和時間篩選存取。 | String | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-epochtime](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-epochtime) | 按請求的日期和時間 (以 UNIX epoch 值表示) 篩選存取。 | Numeric | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principalaccount](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principalaccount) | 依請求主體所屬帳戶篩選存取。 | String | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principalarn](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principalarn) | 依提出請求之主體的 ARN 篩選存取。 | String | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principalisawsservice](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principalisawsservice) | 只有在 AWS 服務主體直接進行呼叫時，才允許存取。 | Boolean | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principalorgid](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principalorgid) | 依請求委託人所屬 AWS 之 Organizations 中組織的識別符篩選存取權。 | String | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principalorgpaths](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principalorgpaths) | 依提出請求之委託人的 AWS Organizations 路徑篩選存取權。 | String | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principaltag](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principaltag) | 依附加至提出請求之主體的標籤篩選存取。 | String | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principaltype](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principaltype) | 依提出請求之主體的類型篩選存取。 | String | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-requestedregion](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-requestedregion) | 依請求中呼叫 AWS 的區域篩選存取權。 | String | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-securetransport](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-securetransport) | 僅在使用 SSL 傳送請求時才允許存取。 | Boolean | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourceip](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourceip) | 依請求者的 IP 地址篩選存取。 | String | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-tokenissuetime](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-tokenissuetime) | 依發出臨時安全憑證的日期/時間篩選存取。 | String | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-useragent](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-useragent) | 依請求者的用戶端應用程式來篩選存取權。 | String | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-userid](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-userid) | 依請求者的主體識別符篩選存取。 | String | 
| [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-viaawsservice](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-viaawsservice) | 只有在 AWS 服務代表您提出請求時，才允許存取。 | Boolean | 

## Neptune 服務特定條件金鑰
<a name="iam-neptune-condition-keys"></a>

Neptune 支援 IAM 政策的下列服務特定條件金鑰：


**Neptune 服務特定條件金鑰**  

| 條件金鑰 | 描述 | Type | 
| --- | --- | --- | 
| neptune-db:QueryLanguage |  依使用的查詢語言篩選資料存取。 有效值為：`Gremlin`、`OpenCypher` 和 `Sparql`。 支援的動作為 `ReadDataViaQuery`、`WriteDataViaQuery`、`DeleteDataViaQuery`、`GetQueryStatus` 和 `CancelQuery`。  | String | 

# 在 Amazon Neptune 中建立 IAM 資料存取政策
<a name="iam-data-access-examples"></a>

下列範例說明如何建立自訂 IAM 政策，使用 Neptune [引擎 1.2.0.0 版](engine-releases-1.2.0.0.md)中引進的資料平面 API 和動作的精細存取控制。

## 允許不受限制地存取 Neptune 資料庫叢集中資料的政策範例
<a name="iam-auth-data-policy-example-general"></a>

以下範例政策可讓 IAM 使用者利用 IAM 資料庫身分驗證，連線至 Neptune 資料庫叢集，以及使用 "`*`" 字元比對所有可用的動作。

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "neptune-db:*",
      "Resource": "arn:aws:neptune-db:us-east-1:123456789012:cluster-ABCD1234EFGH5678IJKL90MNOP/*"
    }
  ]
}
```

------

上述範例包含資源 ARN，其格式為 Neptune IAM 身分驗證的專屬格式。若要建構 ARN，請參閱[指定資料資源](iam-data-resources.md)。請注意，用於 IAM 授權 `Resource` 的 ARN 不同於在建立時指派給叢集的 ARN。

## 允許對 Neptune 資料庫叢集進行唯讀存取的政策範例
<a name="iam-auth-data-policy-example-read-only"></a>

以下政策會授與對 Neptune 資料庫叢集中資料進行完整唯讀存取的許可：

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement":[
    {
      "Effect": "Allow",
      "Action": [
        "neptune-db:Read*",
        "neptune-db:Get*",
        "neptune-db:List*"
      ],
      "Resource": "arn:aws:neptune-db:us-east-1:123456789012:cluster-ABCD1234EFGH5678IJKL90MNOP/*"
    }
  ]
}
```

------

## 允許對 Neptune 資料庫叢集的所有存取的政策範例
<a name="iam-auth-data-policy-example-deny"></a>

預設 IAM 動作是拒絕存取資料庫叢集，除非已授與 `Allow`「效果」**。不過，下列政策會拒絕對特定 AWS 帳戶和區域資料庫叢集的所有存取，然後優先於任何`Allow`效果。

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Deny",
      "Action": "neptune-db:*",
      "Resource": "arn:aws:neptune-db:us-east-1:123456789012:cluster-ABCD1234EFGH5678IJKL90MNOP/*"
    }
  ]
}
```

------

## 透過查詢授與讀取存取權的政策範例
<a name="iam-auth-data-policy-example-read-query"></a>

以下政策只會授與使用查詢從 Neptune 資料庫叢集讀取的許可：

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "neptune-db:ReadDataViaQuery",
      "Resource": "arn:aws:neptune-db:us-east-1:123456789012:cluster-ABCD1234EFGH5678IJKL90MNOP/*"
    }
  ]
}
```

------

## 只允許 Gremlin 查詢的政策範例
<a name="iam-auth-data-policy-example-gremlin-only"></a>

以下政策會使用 `neptune-db:QueryLanguage` 條件金鑰，授與僅使用 Gremlin 查詢語言查詢 Neptune 的許可：

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "neptune-db:ReadDataViaQuery",
        "neptune-db:WriteDataViaQuery",
        "neptune-db:DeleteDataViaQuery"
      ],
      "Resource": "*",
      "Condition": {
        "StringEquals": {
          "neptune-db:QueryLanguage": "Gremlin"
        }
      }
    }
  ]
}
```

------

## 允許除了 Neptune ML 模型管理以外的所有存取的政策範例
<a name="iam-auth-data-policy-example-all-but-ml"></a>

以下政策會授與 Neptune 圖形操作的完整存取權，但 Neptune ML 模型管理功能除外：

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement":[
    {
      "Effect": "Allow",
      "Action": [
        "neptune-db:CancelLoaderJob",
        "neptune-db:CancelQuery",
        "neptune-db:DeleteDataViaQuery",
        "neptune-db:DeleteStatistics",
        "neptune-db:GetEngineStatus",
        "neptune-db:GetLoaderJobStatus",
        "neptune-db:GetQueryStatus",
        "neptune-db:GetStatisticsStatus",
        "neptune-db:GetStreamRecords",
        "neptune-db:ListLoaderJobs",
        "neptune-db:ManageStatistics",
        "neptune-db:ReadDataViaQuery",
        "neptune-db:ResetDatabase",
        "neptune-db:StartLoaderJob",
        "neptune-db:WriteDataViaQuery"
      ],
      "Resource": "arn:aws:neptune-db:us-east-1:123456789012:cluster-ABCD1234EFGH5678IJKL90MNOP/*"
    }
  ]
}
```

------

## 允許存取 Neptune ML 模型管理的政策範例
<a name="iam-auth-data-policy-example-ml"></a>

此政策會授與 Neptune ML 模型管理功能的存取權：

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement":[
    {
      "Effect": "Allow",
      "Action": [
        "neptune-db:CancelMLDataProcessingJob",
        "neptune-db:CancelMLModelTrainingJob",
        "neptune-db:CancelMLModelTransformJob",
        "neptune-db:CreateMLEndpoint",
        "neptune-db:DeleteMLEndpoint",
        "neptune-db:GetMLDataProcessingJobStatus",
        "neptune-db:GetMLEndpointStatus",
        "neptune-db:GetMLModelTrainingJobStatus",
        "neptune-db:GetMLModelTransformJobStatus",
        "neptune-db:ListMLDataProcessingJobs",
        "neptune-db:ListMLEndpoints",
        "neptune-db:ListMLModelTrainingJobs",
        "neptune-db:ListMLModelTransformJobs",
        "neptune-db:StartMLDataProcessingJob",
        "neptune-db:StartMLModelTrainingJob",
        "neptune-db:StartMLModelTransformJob"
      ],
      "Resource": "arn:aws:neptune-db:us-east-1:123456789012:cluster-ABCD1234EFGH5678IJKL90MNOP/*"
    }
  ]
}
```

------

## 授與完整查詢存取權的政策
<a name="iam-auth-data-policy-example-full-query"></a>

以下政策會授與 Neptune 圖形查詢操作的完整存取權，但不會授與快速重設、串流、大量載入器、Neptune ML 模型管理等功能的完整存取權：

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement":[
    {
      "Effect": "Allow",
      "Action": [
        "neptune-db:ReadDataViaQuery",
        "neptune-db:WriteDataViaQuery",
        "neptune-db:DeleteDataViaQuery",
        "neptune-db:GetEngineStatus",
        "neptune-db:GetQueryStatus",
        "neptune-db:CancelQuery"
      ],
      "Resource": "arn:aws:neptune-db:us-east-1:123456789012:cluster-ABCD1234EFGH5678IJKL90MNOP/*"
    }
  ]
}
```

------

## 僅對 Gemlin 查詢授與完整存取權的政策範例
<a name="iam-auth-data-policy-example-full-gremlin-access"></a>

以下政策會授與使用 Gremlin 查詢語言完整存取 Neptune 圖形查詢操作的權限，但不會授權其他語言的查詢，也不會授權快速重設、串流、大量載入器、Neptune ML 模型管理等功能：

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement":[
    {
      "Effect": "Allow",
      "Action": [
        "neptune-db:ReadDataViaQuery",
        "neptune-db:WriteDataViaQuery",
        "neptune-db:DeleteDataViaQuery",
        "neptune-db:GetEngineStatus",
        "neptune-db:GetQueryStatus",
        "neptune-db:CancelQuery"
      ],
      "Resource": [
        "arn:aws:neptune-db:us-east-1:123456789012:cluster-ABCD1234EFGH5678IJKL90MNOP/*"
      ],
      "Condition": {
        "StringEquals": {
           "neptune-db:QueryLanguage":"Gremlin"
        }
      }
    }
  ]
}
```

------

## 授與完整存取權 (快速重設除外) 的政策範例
<a name="iam-auth-data-policy-example-all-but-fast-reset"></a>

以下政策會授與 Neptune 資料庫叢集的完整存取權，但使用快速重設除外：

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "neptune-db:*",
      "Resource": "arn:aws:neptune-db:us-east-1:123456789012:cluster-ABCD1234EFGH5678IJKL90MNOP/*"
    },
    {
      "Effect": "Deny",
      "Action": "neptune-db:ResetDatabase",
      "Resource": "arn:aws:neptune-db:us-east-1:123456789012:cluster-ABCD1234EFGH5678IJKL90MNOP/*"
    }
  ]
}
```

------