

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

# AWS Identity and Access Management 適用於 Amazon Keyspaces
<a name="security-iam"></a>

AWS Identity and Access Management (IAM) 是一種 AWS 服務 ，可協助管理員安全地控制對 AWS 資源的存取。IAM 管理員可控制誰可以*進行身分驗證* （登入） 和*授權* （具有許可），以使用 Amazon Keyspaces 資源。IAM 是您可以免費使用 AWS 服務 的 。

**Topics**
+ [目標對象](#security_iam_audience)
+ [使用身分驗證](#security_iam_authentication)
+ [使用政策管理存取權](#security_iam_access-manage)
+ [Amazon Keyspaces 如何與 IAM 搭配使用](security_iam_service-with-iam.md)
+ [Amazon Keyspaces 身分型政策範例](security_iam_id-based-policy-examples.md)
+ [AWS Amazon Keyspaces 的 受管政策](security-iam-awsmanpol.md)
+ [對 Amazon Keyspaces 身分和存取進行故障診斷](security_iam_troubleshoot.md)
+ [使用 Amazon Keyspaces 的服務連結角色](using-service-linked-roles.md)

## 目標對象
<a name="security_iam_audience"></a>

您的使用方式 AWS Identity and Access Management (IAM) 會根據您的角色而有所不同：
+ **服務使用者** — 若無法存取某些功能，請向管理員申請所需許可 (請參閱 [對 Amazon Keyspaces 身分和存取進行故障診斷](security_iam_troubleshoot.md))
+ **服務管理員** — 負責設定使用者存取權並提交相關許可請求 (請參閱 [Amazon Keyspaces 如何與 IAM 搭配使用](security_iam_service-with-iam.md))
+ **IAM 管理員** — 撰寫政策以管理存取控制 (請參閱 [Amazon Keyspaces 身分型政策範例](security_iam_id-based-policy-examples.md))

## 使用身分驗證
<a name="security_iam_authentication"></a>

身分驗證是您 AWS 使用身分憑證登入 的方式。您必須以 AWS 帳戶根使用者、IAM 使用者或擔任 IAM 角色身分進行身分驗證。

您可以使用身分來源的登入資料，例如 AWS IAM Identity Center (IAM Identity Center)、單一登入身分驗證或 Google/Facebook 登入資料，以聯合身分的形式登入。如需有關登入的詳細資訊，請參閱《AWS 登入 使用者指南》**中的[如何登入您的 AWS 帳戶](https://docs.aws.amazon.com/signin/latest/userguide/how-to-sign-in.html)。

對於程式設計存取， AWS 提供 SDK 和 CLI 以密碼編譯方式簽署請求。如需詳細資訊，請參閱《IAM 使用者指南》**中的 [API 請求的AWS 第 4 版簽署程序](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html)。

### AWS 帳戶 根使用者
<a name="security_iam_authentication-rootuser"></a>

 當您建立 時 AWS 帳戶，您會從一個名為 AWS 帳戶 *theroot 使用者的*登入身分開始，該身分具有對所有 AWS 服務 和 資源的完整存取權。強烈建議不要使用根使用者來執行日常任務。有關需要根使用者憑證的任務，請參閱《IAM 使用者指南》**中的[需要根使用者憑證的任務](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html#root-user-tasks)。

### IAM 使用者和群組
<a name="security_iam_authentication-iamuser"></a>

*IAM 使用者*[https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html)是一種身分具備單人或應用程式的特定許可權。建議以臨時憑證取代具備長期憑證的 IAM 使用者。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[要求人類使用者使用聯合身分提供者來 AWS 使用臨時憑證存取](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#bp-users-federation-idp) 。

[IAM 群組](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html)**會指定 IAM 使用者集合，使管理大量使用者的許可權更加輕鬆。如需詳細資訊，請參閱《IAM 使用者指南》**中的 [IAM 使用者的使用案例](https://docs.aws.amazon.com/IAM/latest/UserGuide/gs-identities-iam-users.html)。

### IAM 角色
<a name="security_iam_authentication-iamrole"></a>

*IAM 角色*[https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)的身分具有特定許可權，其可以提供臨時憑證。您可以透過[從使用者切換到 IAM 角色 （主控台） ](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-console.html)或呼叫 AWS CLI 或 AWS API 操作來擔任角色。如需詳細資訊，請參閱《IAM 使用者指南》**中的[擔任角色的方法](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_manage-assume.html)。

IAM 角色適用於聯合身分使用者存取、臨時 IAM 使用者許可、跨帳戶存取權與跨服務存取，以及在 Amazon EC2 執行的應用程式。如需詳細資訊，請參閱《*IAM 使用者指南*》中的 [IAM 中的快帳戶資源存取](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html)。

## 使用政策管理存取權
<a name="security_iam_access-manage"></a>

您可以透過建立政策並將其連接到身分或資源 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)。

### 資源型政策
<a name="security_iam_access-manage-resource-based-policies"></a>

資源型政策是附加到資源的 JSON 政策文件。範例包括 IAM *角色信任政策*與 Amazon S3 *儲存貯體政策*。在支援資源型政策的服務中，服務管理員可以使用它們來控制對特定資源的存取權限。您必須在資源型政策中[指定主體](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_principal.html)。

資源型政策是位於該服務中的內嵌政策。您無法在以資源為基礎的政策中使用來自 IAM 的 AWS 受管政策。

### 存取控制清單 (ACL)
<a name="security_iam_access-manage-acl"></a>

存取控制清單 (ACL) 可控制哪些主體 (帳戶成員、使用者或角色) 擁有存取某資源的許可。ACL 類似於資源型政策，但它們不使用 JSON 政策文件格式。

Amazon S3 AWS WAF和 Amazon VPC 是支援 ACLs的服務範例。如需進一步了解 ACL，請參閱《Amazon Simple Storage Service 開發人員指南》**中的[存取控制清單 (ACL) 概觀](https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html)。

### 其他政策類型
<a name="security_iam_access-manage-other-policies"></a>

AWS 支援其他政策類型，可設定更多常見政策類型授予的最大許可：
+ **許可界限** — 設定身分型政策可授與 IAM 實體的最大許可。如需詳細資訊，請參閱《 IAM 使用者指南》**中的 [IAM 實體許可界限](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_boundaries.html)。
+ **服務控制政策 (SCP)** — 為 AWS Organizations中的組織或組織單位指定最大許可。如需詳細資訊，請參閱《AWS Organizations 使用者指南》**中的[服務控制政策](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html)。
+ **資源控制政策 (RCP)** — 設定您帳戶中資源可用許可的上限。如需詳細資訊，請參閱《AWS Organizations 使用者指南》**中的[資源控制政策 (RCP)](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_rcps.html)。
+ **工作階段政策** — 在以程式設計方式為角色或聯合身分使用者建立臨時工作階段時，以參數形式傳遞的進階政策。如需詳細資訊，請參《*IAM 使用者指南*》中的[工作階段政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session)。

### 多種政策類型
<a name="security_iam_access-manage-multiple-policies"></a>

當多種類型的政策適用於請求時，產生的許可會更複雜而無法理解。若要了解如何 AWS 在涉及多個政策類型時決定是否允許請求，請參閱《*IAM 使用者指南*》中的[政策評估邏輯](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_evaluation-logic.html)。

# Amazon Keyspaces 如何與 IAM 搭配使用
<a name="security_iam_service-with-iam"></a>

在您使用 IAM 管理對 Amazon Keyspaces 的存取之前，您應該了解哪些 IAM 功能可與 Amazon Keyspaces 搭配使用。若要全面了解 Amazon Keyspaces 和其他 AWS 服務如何與 IAM 搭配使用，請參閱《[AWS IAM 使用者指南》中的與 IAM 搭配使用的 服務](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html)。 **

**Topics**
+ [Amazon Keyspaces 身分型政策](#security_iam_service-with-iam-id-based-policies)
+ [Amazon Keyspaces 資源型政策](#security_iam_service-with-iam-resource-based-policies)
+ [以 Amazon Keyspaces 標籤為基礎的授權](#security_iam_service-with-iam-tags)
+ [Amazon Keyspaces IAM 角色](#security_iam_service-with-iam-roles)

## Amazon Keyspaces 身分型政策
<a name="security_iam_service-with-iam-id-based-policies"></a>

使用 IAM 身分型政策，您可以指定允許或拒絕的動作和資源，以及在何種條件下允許或拒絕動作。Amazon Keyspaces 支援特定動作和資源，以及條件金鑰。若要了解您在 JSON 政策中使用的所有元素，請參閱《*IAM 使用者指南*》中的 [IAM JSON 政策元素參考](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements.html)。

若要查看 Amazon Keyspaces 服務特定的資源和動作，以及可用於 IAM 許可政策的條件內容金鑰，請參閱*服務授權參考*中的 [Amazon Keyspaces （適用於 Apache Cassandra) 的動作、資源和條件金鑰](https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonkeyspacesforapachecassandra.html)。

### 動作
<a name="security_iam_service-with-iam-id-based-policies-actions"></a>

管理員可以使用 AWS JSON 政策來指定誰可以存取內容。也就是說，哪個**主體**在什麼**條件**下可以對什麼**資源**執行哪些**動作**。

JSON 政策的 `Action` 元素描述您可以用來允許或拒絕政策中存取的動作。政策會使用動作來授予執行相關聯動作的許可。

Amazon Keyspaces 中的政策動作在動作之前使用下列字首：`cassandra:`。例如，若要授予某人使用 Amazon Keyspaces `CREATE` CQL 陳述式建立 Amazon Keyspaces 金鑰空間的許可，請在其政策中包含 `cassandra:Create`動作。政策陳述式必須包含 `Action` 或 `NotAction` 元素。Amazon Keyspaces 會定義自己的一組動作，描述您可以使用此服務執行的任務。

若要在單一陳述式中指定多個動作，請用逗號分隔，如下所示：

```
"Action": [
      "cassandra:CREATE",
      "cassandra:MODIFY"
          ]
```

若要查看 Amazon Keyspaces 動作的清單，請參閱*《服務授權參考*》中的 [Amazon Keyspaces （適用於 Apache Cassandra) 定義的動作](https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonkeyspacesforapachecassandra.html#amazonkeyspacesforapachecassandra-actions-as-permissions)。

### Resources
<a name="security_iam_service-with-iam-id-based-policies-resources"></a>

管理員可以使用 AWS JSON 政策來指定誰可以存取內容。也就是說，哪個**主體**在什麼**條件**下可以對什麼**資源**執行哪些**動作**。

`Resource` JSON 政策元素可指定要套用動作的物件。最佳實務是使用其 [Amazon Resource Name (ARN)](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html) 來指定資源。若動作不支援資源層級許可，使用萬用字元 (\$1) 表示該陳述式適用於所有資源。

```
"Resource": "*"
```

在 Amazon Keyspaces 中，金鑰空間、資料表和串流可用於 IAM 許可的 `Resource`元素。

**注意**  
若要存取 Amazon Keyspaces 中的使用者金鑰空間和資料表，您的 IAM 政策必須包含系統資料表的`cassandra:Select`許可：  

```
arn:${Partition}:cassandra:${Region}:${Account}:/keyspace/system*
```
這適用於下列案例：  
AWS 管理主控台存取
SDK 資源操作，例如 `GetKeyspace`、`ListKeyspaces`、 `GetTable`和 `ListTables`
標準 Apache Cassandra 用戶端驅動程式連線，因為驅動程式會在連線初始化期間自動讀取系統資料表
系統資料表為唯讀且無法修改。

Amazon Keyspaces 金鑰空間資源具有下列 ARN：

```
arn:${Partition}:cassandra:${Region}:${Account}:/keyspace/${keyspaceName}/
```

Amazon Keyspaces 資料表資源具有下列 ARN：

```
arn:${Partition}:cassandra:${Region}:${Account}:/keyspace/${keyspaceName}/table/${tableName}
```

Amazon Keyspaces 串流資源具有下列 ARN：

```
arn:${Partition}:cassandra:{Region}:${Account}:/keyspace/${keyspaceName}/table/${tableName}/stream/${streamLabel}
```

如需 ARNs 格式的詳細資訊，請參閱 [Amazon Resource Name (ARNs AWS 和服務命名空間](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html)。

例如，若要在陳述式中指定`mykeyspace`金鑰空間，請使用下列 ARN：

```
"Resource": "arn:aws:cassandra:us-east-1:111122223333:/keyspace/mykeyspace/"
```

若要指定屬於特定帳戶的所有金鑰空間，請使用萬用字元 (\$1)：

```
"Resource": "arn:aws:cassandra:us-east-1:111122223333:/keyspace/*"
```

有些 Amazon Keyspaces 動作無法在特定資源上執行，例如用於建立資源的動作。在這些情況下，您必須使用萬用字元 (\$1)。

```
"Resource": "*"
```

 例如，若要將`SELECT`許可授予 `mytable`中的 IAM 委託人`mykeyspace`，委託人必須具有讀取 `mytable`和 的許可`keyspace/system*`。若要在單一陳述式中指定多項資源，請使用逗號分隔 ARN。

```
"Resource": "arn:aws:cassandra:us-east-1:111122223333:/keyspace/mykeyspace/table/mytable",
            "arn:aws:cassandra:us-east-1:111122223333:/keyspace/system*"
```

若要查看 Amazon Keyspaces 資源類型及其 ARNs，請參閱*《服務授權參考*》中的 [Amazon Keyspaces （適用於 Apache Cassandra) 定義的資源](https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonkeyspacesforapachecassandra.html#amazonkeyspacesforapachecassandra-resources-for-iam-policies)。若要了解您可以使用哪些動作指定每個資源的 ARN，請參閱 [Amazon Keyspaces 定義的動作 （適用於 Apache Cassandra)](https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonkeyspacesforapachecassandra.html#amazonkeyspacesforapachecassandra-actions-as-permissions)。

### 條件索引鍵
<a name="security_iam_service-with-iam-id-based-policies-conditionkeys"></a>

管理員可以使用 AWS JSON 政策來指定誰可以存取內容。也就是說，哪個**主體**在什麼**條件**下可以對什麼**資源**執行哪些**動作**。

`Condition` 元素會根據定義的條件，指定陳述式的執行時機。您可以建立使用[條件運算子](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition_operators.html)的條件運算式 (例如等於或小於)，來比對政策中的條件和請求中的值。若要查看所有 AWS 全域條件索引鍵，請參閱《*IAM 使用者指南*》中的[AWS 全域條件內容索引鍵](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)。

Amazon Keyspaces 會定義自己的一組條件金鑰，也支援使用一些全域條件金鑰。若要查看所有 AWS 全域條件索引鍵，請參閱《*IAM 使用者指南*》中的[AWS 全域條件內容索引鍵](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)。



 所有 Amazon Keyspaces 動作都支援 `aws:RequestTag/${TagKey}`、 `aws:ResourceTag/${TagKey}`和 `aws:TagKeys`條件金鑰。如需詳細資訊，請參閱[根據標籤的 Amazon Keyspaces 資源存取](security_iam_id-based-policy-examples.md#security_iam_id-based-policy-examples-tags)。

若要查看 Amazon Keyspaces 條件金鑰清單，請參閱*服務授權參考*中的 [Amazon Keyspaces （適用於 Apache Cassandra) 的條件金鑰](https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonkeyspacesforapachecassandra.html#amazonkeyspacesforapachecassandra-policy-keys)。若要了解您可以使用條件金鑰的動作和資源，請參閱 [Amazon Keyspaces 定義的動作 （適用於 Apache Cassandra)](https://docs.aws.amazon.com/service-authorization/latest/reference/list_amazonkeyspacesforapachecassandra.html#amazonkeyspacesforapachecassandra-actions-as-permissions)。

### 範例
<a name="security_iam_service-with-iam-id-based-policies-examples"></a>

若要檢視 Amazon Keyspaces 身分型政策的範例，請參閱 [Amazon Keyspaces 身分型政策範例](security_iam_id-based-policy-examples.md)。

## Amazon Keyspaces 資源型政策
<a name="security_iam_service-with-iam-resource-based-policies"></a>

Amazon Keyspaces 不支援以資源為基礎的政策。若要檢視詳細資源類型政策頁面的範例，請參閱 [https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html](https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html)。

## 以 Amazon Keyspaces 標籤為基礎的授權
<a name="security_iam_service-with-iam-tags"></a>

您可以使用標籤來管理對 Amazon Keyspaces 資源的存取。若要根據標籤管理資源存取，您可以使用 `aws:RequestTag/key-name`、 `cassandra:ResourceTag/key-name`或 [條件索引鍵，在政策的條件元素](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)中提供標籤資訊。 `aws:TagKeys`如需標記 Amazon Keyspaces 資源的詳細資訊，請參閱 [使用 Amazon Keyspaces 資源的標籤和標籤](tagging-keyspaces.md)。

若要檢視身分型政策範例，用於根據該資源的標籤來限制資源的存取權，請參閱「[根據標籤的 Amazon Keyspaces 資源存取](security_iam_id-based-policy-examples.md#security_iam_id-based-policy-examples-tags)」。

## Amazon Keyspaces IAM 角色
<a name="security_iam_service-with-iam-roles"></a>

[IAM 角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)是 中具有特定許可 AWS 帳戶 的實體。

### 搭配 Amazon Keyspaces 使用臨時憑證
<a name="security_iam_service-with-iam-roles-tempcreds"></a>

您可以使用暫時憑證來以聯合身分登入、擔任 IAM 角色，或是擔任跨帳戶角色。您可以透過呼叫 [AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) 或 [GetFederationToken](https://docs.aws.amazon.com/STS/latest/APIReference/API_GetFederationToken.html) 等 AWS STS API 操作來取得臨時安全登入資料。

Amazon Keyspaces 支援使用臨時憑證搭配 Github 儲存庫提供的 AWS Signature 第 4 版 (SigV4) 身分驗證外掛程式，適用於下列語言：
+ Java：[https://github.com/aws/aws-sigv4-auth-cassandra-java-driver-plugin](https://github.com/aws/aws-sigv4-auth-cassandra-java-driver-plugin)。
+ Node.js：[https://github.com/aws/aws-sigv4-auth-cassandra-nodejs-driver-plugin](https://github.com/aws/aws-sigv4-auth-cassandra-nodejs-driver-plugin)。
+ Python: [https://github.com/aws/aws-sigv4-auth-cassandra-python-driver-plugin](https://github.com/aws/aws-sigv4-auth-cassandra-python-driver-plugin).
+ Go：[https://github.com/aws/aws-sigv4-auth-cassandra-gocql-driver-plugin](https://github.com/aws/aws-sigv4-auth-cassandra-gocql-driver-plugin)。

如需實作身分驗證外掛程式以程式設計方式存取 Amazon Keyspaces 的範例和教學課程，請參閱 [使用 Cassandra 用戶端驅動程式以程式設計方式存取 Amazon Keyspaces](programmatic.drivers.md)。

### 服務連結角色
<a name="security_iam_service-with-iam-roles-service-linked"></a>

[服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-linked-role)可讓 AWS 服務存取其他服務中的資源，以代表您完成 動作。服務連結角色會顯示在您的 IAM 帳戶中，並由該服務所擁有。IAM 管理員可以檢視，但不能編輯服務連結角色的許可。

如需建立或管理 Amazon Keyspaces 服務連結角色的詳細資訊，請參閱 **[使用 Amazon Keyspaces 的服務連結角色](using-service-linked-roles.md)**。

### 服務角色
<a name="security_iam_service-with-iam-roles-service"></a>

Amazon Keyspaces 不支援服務角色。

# Amazon Keyspaces 身分型政策範例
<a name="security_iam_id-based-policy-examples"></a>

根據預設，IAM 使用者和角色沒有建立或修改 Amazon Keyspaces 資源的許可。他們也無法使用 主控台 AWS CLI、CQLSH 或 AWS API 來執行任務。IAM 管理員必須建立 IAM 政策，授予使用者和角色在指定資源上執行特定 API 作業的所需許可。管理員接著必須將這些政策連接至需要這些許可的 IAM 使用者或群組。

若要了解如何使用這些範例 JSON 政策文件建立 IAM 身分型政策，請參閱《IAM 使用者指南》**中的[在 JSON 標籤上建立政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html#access_policies_create-json-editor)。

**Topics**
+ [政策最佳實務](#security_iam_service-with-iam-policy-best-practices)
+ [使用 Amazon Keyspaces 主控台](#security_iam_id-based-policy-examples-console)
+ [允許使用者檢視他們自己的許可](#security_iam_id-based-policy-examples-view-own-permissions)
+ [存取 Amazon Keyspaces 資料表](#security_iam_id-based-policy-examples-access-one-table)
+ [根據標籤的 Amazon Keyspaces 資源存取](#security_iam_id-based-policy-examples-tags)

## 政策最佳實務
<a name="security_iam_service-with-iam-policy-best-practices"></a>

身分型政策會判斷您帳戶中的某個人員是否可以建立、存取或刪除 Amazon Keyspaces 資源。這些動作可能會讓您的 AWS 帳戶產生費用。當您建立或編輯身分型政策時，請遵循下列準則及建議事項：
+ **開始使用 AWS 受管政策並邁向最低權限許可** – 若要開始將許可授予您的使用者和工作負載，請使用將許可授予許多常見使用案例的 *AWS 受管政策*。它們可在您的 中使用 AWS 帳戶。我們建議您定義特定於使用案例 AWS 的客戶受管政策，以進一步減少許可。如需更多資訊，請參閱《*IAM 使用者指南*》中的 [AWS 受管政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies)或[任務職能的AWS 受管政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_job-functions.html)。
+ **套用最低權限許可** – 設定 IAM 政策的許可時，請僅授予執行任務所需的許可。為實現此目的，您可以定義在特定條件下可以對特定資源採取的動作，這也稱為*最低權限許可*。如需使用 IAM 套用許可的更多相關資訊，請參閱《*IAM 使用者指南*》中的 [IAM 中的政策和許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html)。
+ **使用 IAM 政策中的條件進一步限制存取權** – 您可以將條件新增至政策，以限制動作和資源的存取。例如，您可以撰寫政策條件，指定必須使用 SSL 傳送所有請求。如果透過特定 等使用服務動作 AWS 服務，您也可以使用條件來授予其存取權 CloudFormation。如需詳細資訊，請參閱《*IAM 使用者指南*》中的 [IAM JSON 政策元素：條件](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)。
+ **使用 IAM Access Analyzer 驗證 IAM 政策，確保許可安全且可正常運作** – IAM Access Analyzer 驗證新政策和現有政策，確保這些政策遵從 IAM 政策語言 (JSON) 和 IAM 最佳實務。IAM Access Analyzer 提供 100 多項政策檢查及切實可行的建議，可協助您撰寫安全且實用的政策。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[使用 IAM Access Analyzer 驗證政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-analyzer-policy-validation.html)。
+ **需要多重要素驗證 (MFA)** – 如果您的案例需要 IAM 使用者或 中的根使用者 AWS 帳戶，請開啟 MFA 以提高安全性。如需在呼叫 API 操作時請求 MFA，請將 MFA 條件新增至您的政策。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[透過 MFA 的安全 API 存取](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html)。

如需 IAM 中最佳實務的相關資訊，請參閱《*IAM 使用者指南*》中的 [IAM 安全最佳實務](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html)。

## 使用 Amazon Keyspaces 主控台
<a name="security_iam_id-based-policy-examples-console"></a>

Amazon Keyspaces 不需要特定許可即可存取 Amazon Keyspaces 主控台。您需要至少 個唯讀許可，才能列出和檢視 中 Amazon Keyspaces 資源的詳細資訊 AWS 帳戶。如果您建立比最基本必要許可更嚴格的身分型政策，則對於具有該政策的實體 (IAM 使用者或角色) 而言，主控台就無法如預期運作。

兩個 AWS 受管政策可供 Amazon Keyspaces 主控台存取的實體使用。
+ [AmazonKeyspacesReadOnlyAccess\$1v2](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonKeyspacesReadOnlyAccess_v2.html) – 此政策授予 Amazon Keyspaces 的唯讀存取權。
+ [AmazonKeyspacesFullAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonKeyspacesFullAccess.html) – 此政策授予許可，以使用具有所有功能完整存取權的 Amazon Keyspaces。

如需 Amazon Keyspaces 受管政策的詳細資訊，請參閱 [AWS Amazon Keyspaces 的 受管政策](security-iam-awsmanpol.md)。

## 允許使用者檢視他們自己的許可
<a name="security_iam_id-based-policy-examples-view-own-permissions"></a>

此範例會示範如何建立政策，允許 IAM 使用者檢視附加到他們使用者身分的內嵌及受管政策。此政策包含在主控台或使用 或 AWS CLI AWS API 以程式設計方式完成此動作的許可。

```
{
    "Version": "2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "ViewOwnUserInfo",
            "Effect": "Allow",
            "Action": [
                "iam:GetUserPolicy",
                "iam:ListGroupsForUser",
                "iam:ListAttachedUserPolicies",
                "iam:ListUserPolicies",
                "iam:GetUser"
            ],
            "Resource": ["arn:aws:iam::*:user/${aws:username}"]
        },
        {
            "Sid": "NavigateInConsole",
            "Effect": "Allow",
            "Action": [
                "iam:GetGroupPolicy",
                "iam:GetPolicyVersion",
                "iam:GetPolicy",
                "iam:ListAttachedGroupPolicies",
                "iam:ListGroupPolicies",
                "iam:ListPolicyVersions",
                "iam:ListPolicies",
                "iam:ListUsers"
            ],
            "Resource": "*"
        }
    ]
}
```

## 存取 Amazon Keyspaces 資料表
<a name="security_iam_id-based-policy-examples-access-one-table"></a>

**注意**  
若要存取 Amazon Keyspaces 中的使用者金鑰空間和資料表，您的 IAM 政策必須包含系統資料表的`cassandra:Select`許可：  

```
arn:${Partition}:cassandra:${Region}:${Account}:/keyspace/system*
```
這適用於下列案例：  
AWS 管理主控台存取
SDK 資源操作，例如 `GetKeyspace`、`ListKeyspaces`、 `GetTable`和 `ListTables`
標準 Apache Cassandra 用戶端驅動程式連線，因為驅動程式會在連線初始化期間自動讀取系統資料表
系統資料表為唯讀且無法修改。

以下是授予 Amazon Keyspaces 系統資料表唯讀 (`SELECT`) 存取權的範例政策。對於所有範例，請將 Amazon Resource Name (ARN) 中的區域和帳戶 ID 取代為您自己的 ID。

```
{
   "Version":"2012-10-17",		 	 	 
   "Statement":[
      {
         "Effect":"Allow",
         "Action":[
            "cassandra:Select"
         ],
         "Resource":[
            "arn:aws:cassandra:us-east-1:111122223333:/keyspace/system*"
         ]
      }
   ]
}
```

下列範例政策會將唯讀存取權新增至金鑰空間 `mytable` 中的使用者資料表`mykeyspace`。

```
{
   "Version":"2012-10-17",		 	 	 
   "Statement":[
      {
         "Effect":"Allow",
         "Action":[
            "cassandra:Select"
         ],
         "Resource":[
            "arn:aws:cassandra:us-east-1:111122223333:/keyspace/mykeyspace/table/mytable",
            "arn:aws:cassandra:us-east-1:111122223333:/keyspace/system*"
         ]
      }
   ]
}
```

下列範例政策會將讀取/寫入存取權指派給使用者資料表，並將讀取存取權指派給系統資料表。

```
{
   "Version":"2012-10-17",		 	 	 
   "Statement":[
      {
         "Effect":"Allow",
         "Action":[
            "cassandra:Select",
            "cassandra:Modify"
         ],
         "Resource":[
            "arn:aws:cassandra:us-east-1:111122223333:/keyspace/mykeyspace/table/mytable",
            "arn:aws:cassandra:us-east-1:111122223333:/keyspace/system*"
         ]
      }
   ]
}
```

下列範例政策允許使用者在金鑰空間 中建立資料表`mykeyspace`。

```
{
   "Version":"2012-10-17",		 	 	 
   "Statement":[
      {
         "Effect":"Allow",
         "Action":[
            "cassandra:Create",
            "cassandra:Select"
         ],
         "Resource":[
            "arn:aws:cassandra:us-east-1:111122223333:/keyspace/mykeyspace/*",
            "arn:aws:cassandra:us-east-1:111122223333:/keyspace/system*"
         ]
      }
   ]
}
```

下列範例政策會指派系統資料表的讀取存取權，但會限制 `SELECT`（讀取） 和 `MODIFY`（寫入） 對使用者資料表 的存取權`mytable`。

```
{
  "Version": "2012-10-17",		 	 	 
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "cassandra:Select"
      ],
      "Resource": [
        "arn:aws:cassandra:us-east-1:111122223333:/keyspace/system*"
      ]
    },
    {
      "Effect": "Deny",
      "Action": [
        "cassandra:Select",
        "cassandra:Modify"
      ],
      "Resource": [
        "arn:aws:cassandra:us-east-1:111122223333:/keyspace/mykeyspace/table/mytable"
      ]
    }
  ]
}
```

## 根據標籤的 Amazon Keyspaces 資源存取
<a name="security_iam_id-based-policy-examples-tags"></a>

您可以在身分型政策中使用條件，根據標籤控制對 Amazon Keyspaces 資源的存取。這些政策會控制帳戶中金鑰空間和資料表的可見性。請注意，與透過 Cassandra 驅動程式和開發人員工具進行的 Cassandra 查詢語言 (CQL) API 呼叫相比，使用 AWS SDK 提出請求時，系統資料表的標籤型許可會有不同的行為。
+ 若要在使用標籤型存取時透過 AWS SDK 提出 `Get` `List`和資源請求，呼叫者需要具有系統資料表的讀取存取權。例如，需要`Select`動作許可，才能透過 `GetTable`操作從系統資料表讀取資料。如果發起人只有對特定資料表的標籤型存取，則需要額外存取系統資料表的操作將會失敗。
+ 為了相容於已建立的 Cassandra 驅動程式行為，使用 Cassandra 查詢語言 (CQL) API 呼叫透過 Cassandra 驅動程式和開發人員工具在系統資料表上執行操作時，不會強制執行標籤型授權政策。

下列範例示範如何建立政策，在資料表的 `Owner`包含該使用者名稱的值時，將檢視資料表的許可授予使用者。在此範例中，您也提供系統資料表的讀取存取權。

```
{
   "Version":"2012-10-17",		 	 	 
   "Statement":[
      {
         "Sid":"ReadOnlyAccessTaggedTables",
         "Effect":"Allow",
         "Action":"cassandra:Select",
         "Resource":[
            "arn:aws:cassandra:us-east-1:111122223333:/keyspace/mykeyspace/table/*",
            "arn:aws:cassandra:us-east-1:111122223333:/keyspace/system*"
         ],
         "Condition":{
            "StringEquals":{
               "aws:ResourceTag/Owner":"${aws:username}"
            }
         }
      }
   ]
}
```

您可以將此政策連接到您帳戶中的 IAM 使用者。如果名為 的使用者`richard-roe`嘗試檢視 Amazon Keyspaces 資料表，則該資料表必須加上標籤 `Owner=richard-roe`或 `owner=richard-roe`。否則，他便會被拒絕存取。條件標籤鍵 `Owner` 符合 `Owner` 和 `owner`，因為條件索引鍵名稱不區分大小寫。如需詳細資訊，請參閱《*IAM 使用者指南*》中的 [IAM JSON 政策元素：條件](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_condition.html)。

如果資料表的 `Owner`包含該使用者的使用者名稱值，則下列政策會授予使用者使用標籤建立資料表的許可。

```
{ 
    "Version": "2012-10-17",		 	 	  
    "Statement": [ 
       { 
          "Sid": "CreateTagTableUser", 
          "Effect": "Allow", 
          "Action": [
              "cassandra:Create", 
              "cassandra:TagResource"
          ], 
          "Resource": "arn:aws:cassandra:us-east-1:111122223333:/keyspace/mykeyspace/table/*", 
          "Condition":{
             "StringEquals":{
                "aws:RequestTag/Owner":"${aws:username}"
            }
         }
      }
   ]
}
```

# AWS Amazon Keyspaces 的 受管政策
<a name="security-iam-awsmanpol"></a>





 AWS 受管政策是由 AWS AWS 受管政策建立和管理的獨立政策旨在為許多常用案例提供許可，以便您可以開始將許可指派給使用者、群組和角色。

請記住， AWS 受管政策可能不會授予特定使用案例的最低權限許可，因為這些許可可供所有 AWS 客戶使用。我們建議您定義特定於使用案例的[客戶管理政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#customer-managed-policies)，以便進一步減少許可。

您無法變更 AWS 受管政策中定義的許可。如果 AWS 更新受 AWS 管政策中定義的許可，則更新會影響政策連接的所有主體身分 （使用者、群組和角色）。當新的 AWS 服務 啟動或新的 API 操作可用於現有服務時， AWS 最有可能更新 AWS 受管政策。

如需詳細資訊，請參閱 *IAM 使用者指南*中的 [AWS 受管政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies)。









## AWS 受管政策：AmazonKeyspacesReadOnlyAccess\$1v2
<a name="security-iam-awsmanpol-AmazonKeyspacesReadOnlyAccess_v2"></a>





您可將 `AmazonKeyspacesReadOnlyAccess_v2` 政策連接到 IAM 身分。



此政策授予 Amazon Keyspaces 的唯讀存取權，並在透過私有 VPC 端點連線時包含必要的許可。



**許可詳細資訊**

此政策包含以下許可。




+ `Amazon Keyspaces` – 提供 Amazon Keyspaces 的唯讀存取權。
+ `Amazon Keyspaces CDC streams` – 允許主體檢視 Amazon Keyspaces CDC 串流。
+ `Application Auto Scaling` – 允許主體檢視來自 Application Auto Scaling 的設定。這是必要的，讓使用者能檢視附加於資料表的自動擴展政策。
+ `CloudWatch` – 允許主體檢視於 CloudWatch 中設定的指標資料與警示。這是必要的，以便使用者檢視資料表的計費大小與 CloudWatch 警示。
+ `AWS KMS` – 允許主體檢視其中設定的金鑰 AWS KMS。這是必要的，因此使用者可以檢視在其帳戶中建立和管理的 AWS KMS 金鑰，以確認指派給 Amazon Keyspaces 的金鑰是已啟用的對稱加密金鑰。
+ `Amazon EC2` – 允許主體透過 VPC 端點連線至 Amazon Keyspaces，以查詢 Amazon EC2 執行個體上的 VPC 以取得端點和網路介面資訊。需要對 Amazon EC2 執行個體的唯讀存取權，以便 Amazon Keyspaces 可以在用於連線負載平衡的`system.peers`資料表中查詢和存放可用的介面 VPC 端點。



若要檢閱 `JSON` 格式的政策，請參閱 [AmazonKeyspacesReadOnlyAccess\$1v2](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonKeyspacesReadOnlyAccess_v2.html)。

## AWS 受管政策：AmazonKeyspacesReadOnlyAccess
<a name="security-iam-awsmanpol-AmazonKeyspacesReadOnlyAccess"></a>





您可將 `AmazonKeyspacesReadOnlyAccess` 政策連接到 IAM 身分。



此政策授予 Amazon Keyspaces 的唯讀存取權。



**許可詳細資訊**

此政策包含以下許可。




+ `Amazon Keyspaces` – 提供 Amazon Keyspaces 的唯讀存取權。
+ `Amazon Keyspaces CDC streams` – 允許主體檢視 Amazon Keyspaces CDC 串流。
+ `Application Auto Scaling` – 允許主體檢視來自 Application Auto Scaling 的設定。這是必要的，讓使用者能檢視附加於資料表的自動擴展政策。
+ `CloudWatch` – 允許主體檢視於 CloudWatch 中設定的指標資料與警示。這是必要的，以便使用者檢視資料表的計費大小與 CloudWatch 警示。
+ `AWS KMS` – 允許主體檢視其中設定的金鑰 AWS KMS。這是必要的，因此使用者可以檢視在其帳戶中建立和管理的 AWS KMS 金鑰，以確認指派給 Amazon Keyspaces 的金鑰是已啟用的對稱加密金鑰。



若要以 `JSON` 格式檢閱政策，請參閱 [AmazonKeyspacesReadOnlyAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonKeyspacesReadOnlyAccess.html)。

## AWS 受管政策：AmazonKeyspacesFullAccess
<a name="security-iam-awsmanpol-AmazonKeyspacesFullAccess"></a>





您可將 `AmazonKeyspacesFullAccess` 政策連接到 IAM 身分。



此政策會授予管理許可，讓您的管理員不受限制地存取 Amazon Keyspaces。



**許可詳細資訊**

此政策包含以下許可。




+ `Amazon Keyspaces` – 允許主體存取任何 Amazon Keyspaces 資源並執行所有動作。
+ `Application Auto Scaling` – 允許主體建立、檢視和刪除 Amazon Keyspaces 資料表的自動擴展政策。這是必要的，以便管理員可以管理 Amazon Keyspaces 資料表的自動擴展政策。
+ `CloudWatch` – 允許主體查看計費資料表大小，以及建立、檢視和刪除 Amazon Keyspaces 自動擴展政策的 CloudWatch 警示。這是必要的，以便管理員可以檢視計費資料表大小並建立 CloudWatch 儀表板。
+ `IAM` – 允許 Amazon Keyspaces 在開啟下列功能時，使用 IAM 自動建立服務連結角色：
  + `Amazon Keyspaces CDC streams` – 當管理員為資料表啟用串流時，Amazon Keyspaces 會建立服務連結角色 [AWSServiceRoleForAmazonKeyspacesCDC](using-service-linked-roles-CDC-streams.md#service-linked-role-permissions-CDC-streams)，以代表您將 CloudWatch 指標發佈至您的帳戶。
  + `Application Auto Scaling` – 當管理員為資料表啟用 Application Auto Scaling 時，Amazon Keyspaces 會建立服務連結角色 [AWSServiceRoleForApplicationAutoScaling\$1CassandraTable](using-service-linked-roles-app-auto-scaling.md#service-linked-role-permissions-app-auto-scaling)，以代表您執行自動擴展動作。
  + `Amazon Keyspaces multi-Region replication` – 當管理員建立新的多區域金鑰空間，或將新的 新增至現有的單一區域金鑰空間 AWS 區域 時，Amazon Keyspaces 會建立服務連結角色 [AWSServiceRoleForAmazonKeyspacesReplication](using-service-linked-roles-multi-region-replication.md#service-linked-role-permissions-multi-region-replication)，代表您將資料表、資料和中繼資料複寫至選取的區域。
+ `AWS KMS` – 允許主體檢視於 AWS KMS中設定的金鑰。這是必要的，以便使用者可以檢視在其帳戶中建立和管理的 AWS KMS 金鑰，以確認指派給 Amazon Keyspaces 的金鑰是已啟用的對稱加密金鑰。
+ `Amazon EC2` – 允許主體透過 VPC 端點連線至 Amazon Keyspaces，以查詢 Amazon EC2 執行個體上的 VPC 以取得端點和網路介面資訊。需要對 Amazon EC2 執行個體的唯讀存取權，以便 Amazon Keyspaces 可以在用於連線負載平衡的`system.peers`資料表中查詢和存放可用的介面 VPC 端點。



若要以 `JSON` 格式檢閱政策，請參閱 [AmazonKeyspacesFullAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonKeyspacesFullAccess.html)。

## AWS 受管政策：KeyspacesCDCServiceRolePolicy
<a name="security-iam-awsmanpol-KeyspacesCDCServiceRolePolicy"></a>





您不得將 `KeyspacesCDCServiceRolePolicy` 連接到 IAM 實體。此政策會連接到服務連結角色，允許 Amazon Keyspaces 代表您執行動作。如需詳細資訊，請參閱[使用 Amazon Keyspaces CDC 串流的角色](using-service-linked-roles-CDC-streams.md)。



此政策會將必要的許可授予服務連結角色`AWSServiceRoleForAmazonKeyspacesCDC`，以代表您將 Amazon Keyspaces CDC 串流指標資料發佈至 CloudWatch。



**許可詳細資訊**

此政策包含以下許可。




+ `CloudWatch` – 允許service-linked-role [AWSServiceRoleForAmazonKeyspacesCDC](using-service-linked-roles-CDC-streams.md#service-linked-role-permissions-CDC-streams) 代表您將指標資料從 Amazon Keyspaces CDC 串流發佈到 CloudWatch 帳戶中`"cloudwatch:namespace": "AWS/Cassandra"`的 。



若要以 `JSON` 格式檢閱政策，請參閱 [KeyspacesCDCServiceRolePolicy](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/KeyspacesCDCServiceRolePolicy.html)。





## Amazon Keyspaces 受 AWS 管政策的更新
<a name="security-iam-awsmanpol-updates"></a>



檢視自此服務開始追蹤 Amazon Keyspaces AWS 受管政策更新以來的詳細資訊。如需有關此頁面變更的自動提醒，請訂閱 [Amazon Keyspaces 的文件歷史記錄 （適用於 Apache Cassandra)](doc-history.md) 頁面的 RSS 摘要。




| 變更 | 描述 | Date | 
| --- | --- | --- | 
|  [KeyspacesCDCServiceRolePolicy](#security-iam-awsmanpol-KeyspacesCDCServiceRolePolicy) – 新政策  |  Amazon Keyspaces 新增了新的受管政策`KeyspacesCDCServiceRolePolicy`，將必要的許可授予服務連結角色`AWSServiceRoleForAmazonKeyspacesCDC`，以代表您將 Amazon Keyspaces CDC 串流指標資料發佈至 CloudWatch。如需詳細資訊，請參閱[使用 Amazon Keyspaces CDC 串流的角色](using-service-linked-roles-CDC-streams.md)。  | 2025 年 7 月 2 日 | 
|  [AmazonKeyspacesReadOnlyAccess\$1v2](#security-iam-awsmanpol-AmazonKeyspacesReadOnlyAccess_v2) – 更新至現有政策  |  Amazon Keyspaces 新增了允許 IAM 主體檢視 Amazon Keyspaces CDC 串流的許可。如需詳細資訊，請參閱[在 Amazon Keyspaces 中檢視 CDC 串流](keyspaces-view-cdc.md)。  | 2025 年 7 月 2 日 | 
|  [AmazonKeyspacesReadOnlyAccess](#security-iam-awsmanpol-AmazonKeyspacesReadOnlyAccess) – 更新現有政策  |  Amazon Keyspaces 新增了允許 IAM 主體檢視 Amazon Keyspaces CDC 串流的許可。如需詳細資訊，請參閱[在 Amazon Keyspaces 中檢視 CDC 串流](keyspaces-view-cdc.md)。  | 2025 年 7 月 2 日 | 
|  [AmazonKeyspacesFullAccess](#security-iam-awsmanpol-AmazonKeyspacesFullAccess) – 更新現有政策  |  Amazon Keyspaces 為服務連結角色 [AWSServiceRoleForAmazonKeyspacesCDC](using-service-linked-roles-CDC-streams.md#service-linked-role-permissions-CDC-streams) 建立`KeyspacesCDCServiceRolePolicy`受管政策，以新增管理員為資料表啟用串流時所需的許可。 Amazon Keyspaces 會使用服務連結角色`AWSServiceRoleForAmazonKeyspacesCDC`，代表您將 CloudWatch 指標發佈至您的帳戶。如需詳細資訊，請參閱[使用 Amazon Keyspaces CDC 串流的角色](using-service-linked-roles-CDC-streams.md)。  | 2025 年 7 月 2 日 | 
|  [AmazonKeyspacesFullAccess](#security-iam-awsmanpol-AmazonKeyspacesFullAccess) – 更新現有政策  |  Amazon Keyspaces 更新了服務連結角色 [AWSServiceRoleForAmazonKeyspacesReplication](using-service-linked-roles-multi-region-replication.md#service-linked-role-permissions-multi-region-replication) `KeyspacesReplicationServiceRolePolicy`的 ，以新增管理員將新 AWS 區域 新增至單一或多區域金鑰空間時所需的許可。 Amazon Keyspaces 使用服務連結角色代表您`AWSServiceRoleForAmazonKeyspacesReplication`複寫資料表、其設定和資料。如需詳細資訊，請參閱[使用 Amazon Keyspaces 多區域複寫的角色](using-service-linked-roles-multi-region-replication.md)。  | 2024 年 11 月 19 日 | 
|  [AmazonKeyspacesFullAccess](#security-iam-awsmanpol-AmazonKeyspacesFullAccess) – 更新現有政策  |  Amazon Keyspaces 新增了許可，以允許 Amazon Keyspaces 在管理員將新區域新增至單一或多區域金鑰空間時建立服務連結角色。 Amazon Keyspaces 使用服務連結角色代表您執行資料複寫任務。如需詳細資訊，請參閱[使用 Amazon Keyspaces 多區域複寫的角色](using-service-linked-roles-multi-region-replication.md)。  | 2023 年 10 月 3 日 | 
|  [AmazonKeyspacesReadOnlyAccess\$1v2](#security-iam-awsmanpol-AmazonKeyspacesReadOnlyAccess) – 新政策  |  Amazon Keyspaces 建立新的政策，為透過介面 VPC 端點連線至 Amazon Keyspaces 的用戶端新增唯讀許可，以存取 Amazon EC2 執行個體來查詢網路資訊。 Amazon Keyspaces 會將可用的介面 VPC 端點存放在 `system.peers` 資料表中，以進行連線負載平衡。如需詳細資訊，請參閱[搭配界面 VPC 端點使用 Amazon Keyspaces](vpc-endpoints.md)。  | 2023 年 9 月 12 日 | 
|  [AmazonKeyspacesFullAccess](#security-iam-awsmanpol-AmazonKeyspacesFullAccess) – 更新現有政策  |  Amazon Keyspaces 新增了許可，允許 Amazon Keyspaces 在管理員建立多區域金鑰空間時建立服務連結角色。 Amazon Keyspaces 使用服務連結角色`AWSServiceRoleForAmazonKeyspacesReplication`代表您執行資料複寫任務。如需詳細資訊，請參閱[使用 Amazon Keyspaces 多區域複寫的角色](using-service-linked-roles-multi-region-replication.md)。  | 2023 年 6 月 5 日 | 
|  [AmazonKeyspacesReadOnlyAccess](#security-iam-awsmanpol-AmazonKeyspacesReadOnlyAccess) – 更新現有政策  |  Amazon Keyspaces 新增了新的許可，允許使用者使用 CloudWatch 檢視資料表的計費大小。 Amazon Keyspaces 與 Amazon CloudWatch 整合，可讓您監控計費資料表大小。如需詳細資訊，請參閱[Amazon Keyspaces 指標](metrics-dimensions.md#keyspaces-metrics-dimensions)。  | 2022 年 7 月 7 日 | 
|  [AmazonKeyspacesFullAccess](#security-iam-awsmanpol-AmazonKeyspacesFullAccess) – 更新現有政策  |  Amazon Keyspaces 新增了新的許可，允許使用者使用 CloudWatch 檢視資料表的計費大小。 Amazon Keyspaces 與 Amazon CloudWatch 整合，可讓您監控計費資料表大小。如需詳細資訊，請參閱[Amazon Keyspaces 指標](metrics-dimensions.md#keyspaces-metrics-dimensions)。  | 2022 年 7 月 7 日 | 
|  [AmazonKeyspacesReadOnlyAccess](#security-iam-awsmanpol-AmazonKeyspacesReadOnlyAccess) – 更新現有政策  |  Amazon Keyspaces 新增了新的許可，允許使用者檢視已為 Amazon Keyspaces 靜態加密設定的 AWS KMS 金鑰。 Amazon Keyspaces 靜態加密與 整合 AWS KMS ，以保護和管理用於加密靜態資料的加密金鑰。若要檢視為 Amazon Keyspaces 設定的 AWS KMS 金鑰，已新增唯讀許可。  | 2021 年 6 月 1 日 | 
|  [AmazonKeyspacesFullAccess](#security-iam-awsmanpol-AmazonKeyspacesFullAccess) – 更新現有政策  |  Amazon Keyspaces 新增了新的許可，允許使用者檢視已為 Amazon Keyspaces 靜態加密設定的 AWS KMS 金鑰。 Amazon Keyspaces 靜態加密與 整合 AWS KMS ，以保護和管理用於加密靜態資料的加密金鑰。若要檢視為 Amazon Keyspaces 設定的 AWS KMS 金鑰，已新增唯讀許可。  | 2021 年 6 月 1 日 | 
|  Amazon Keyspaces 開始追蹤變更  |  Amazon Keyspaces 開始追蹤其 AWS 受管政策的變更。  | 2021 年 6 月 1 日 | 

# 對 Amazon Keyspaces 身分和存取進行故障診斷
<a name="security_iam_troubleshoot"></a>

使用以下資訊來協助您診斷和修正使用 Amazon Keyspaces 和 IAM 時可能遇到的常見問題。

**Topics**
+ [我未獲授權在 Amazon Keyspaces 中執行動作](#security_iam_troubleshoot-no-permissions)
+ [我修改了 IAM 使用者或角色，變更未立即生效](#security_iam_troubleshoot-effect)
+ [我無法使用 Amazon Keyspaces point-in-time復原 (PITR) 還原資料表](#security_iam_troubleshoot-pitr)
+ [我未獲授權執行 iam:PassRole](#security_iam_troubleshoot-passrole)
+ [我是管理員，想要允許其他人存取 Amazon Keyspaces](#security_iam_troubleshoot-admin-delegate)
+ [我想要允許 以外的人員 AWS 帳戶 存取我的 Amazon Keyspaces 資源](#security_iam_troubleshoot-cross-account-access)

## 我未獲授權在 Amazon Keyspaces 中執行動作
<a name="security_iam_troubleshoot-no-permissions"></a>

如果 AWS 管理主控台 告知您無權執行 動作，則必須聯絡您的管理員尋求協助。您的管理員是為您提供使用者名稱和密碼的人員。

當 `mateojackson` IAM 使用者嘗試使用主控台檢視*資料表*的詳細資訊，但沒有資料表的`cassandra:Select`許可時，會發生下列範例錯誤。

```
User: arn:aws:iam::123456789012:user/mateojackson is not authorized to perform: cassandra:Select on resource: mytable
```

在此情況下，Mateo 會請求管理員更新他的政策，允許他使用 `mytable` 動作存取 `cassandra:Select` 資源。

## 我修改了 IAM 使用者或角色，變更未立即生效
<a name="security_iam_troubleshoot-effect"></a>

對於具有現有、已建立的 Amazon Keyspaces 連線的應用程式，IAM 政策變更最多可能需要 10 分鐘才會生效。當應用程式建立新的連線時，IAM 政策變更會立即生效。如果您已修改現有的 IAM 使用者或角色，但尚未立即生效，請等待 10 分鐘，或中斷連線並重新連線至 Amazon Keyspaces。

## 我無法使用 Amazon Keyspaces point-in-time復原 (PITR) 還原資料表
<a name="security_iam_troubleshoot-pitr"></a>

如果您嘗試使用point-in-time復原 (PITR) 還原 Amazon Keyspaces 資料表，而您看到還原程序開始，但未成功完成，則可能尚未設定還原程序所需的所有必要許可。您必須聯絡管理員尋求協助，並要求該人員更新您的政策，以允許您在 Amazon Keyspaces 中還原資料表。

除了使用者許可之外，Amazon Keyspaces 可能需要許可，才能代表您委託人在還原程序期間執行動作。如果資料表使用客戶受管金鑰加密，或者您使用限制傳入流量的 IAM 政策，就會發生這種情況。例如，如果您在 IAM 政策中使用條件索引鍵來限制來源流量至特定端點或 IP 範圍，則還原操作會失敗。若要允許 Amazon Keyspaces 代表您委託人執行資料表還原操作，您必須在 IAM 政策中新增`aws:ViaAWSService`全域條件金鑰。

如需還原資料表之許可的詳細資訊，請參閱 [設定 Amazon Keyspaces PITR 的還原資料表 IAM 許可](howitworks_restore_permissions.md)。

## 我未獲授權執行 iam:PassRole
<a name="security_iam_troubleshoot-passrole"></a>

如果您收到錯誤，告知您無權執行 `iam:PassRole`動作，您的政策必須更新，以允許您將角色傳遞給 Amazon Keyspaces。

有些 AWS 服務 可讓您將現有角色傳遞給該服務，而不是建立新的服務角色或服務連結角色。如需執行此作業，您必須擁有將角色傳遞至該服務的許可。

當名為 的 IAM `marymajor` 使用者嘗試使用主控台在 Amazon Keyspaces 中執行動作時，會發生下列範例錯誤。但是，動作請求服務具備服務角色授予的許可。Mary 沒有將角色傳遞給服務的許可。

```
User: arn:aws:iam::123456789012:user/marymajor is not authorized to perform: iam:PassRole
```

在這種情況下，Mary 的政策必須更新，允許她執行 `iam:PassRole` 動作。

如果您需要協助，請聯絡您的 AWS 管理員。您的管理員提供您的簽署憑證。

## 我是管理員，想要允許其他人存取 Amazon Keyspaces
<a name="security_iam_troubleshoot-admin-delegate"></a>

若要允許其他人存取 Amazon Keyspaces，您必須將許可授予需要存取的人員或應用程式。如果您使用 AWS IAM Identity Center 管理人員和應用程式，您可以將許可集指派給使用者或群組，以定義其存取層級。許可集會自動建立 IAM 政策，並將其指派給與該人員或應用程式相關聯的 IAM 角色。如需詳細資訊，請參閱*AWS IAM Identity Center 《 使用者指南*》中的[許可集](https://docs.aws.amazon.com/singlesignon/latest/userguide/permissionsetsconcept.html)。

如果您不是使用 IAM Identity Center，則必須為需要存取的人員或應用程式建立 IAM 實體 （使用者或角色）。然後，您必須將政策連接到實體，以授予他們在 Amazon Keyspaces 中的正確許可。授予許可後，請將登入資料提供給使用者或應用程式開發人員。他們將使用這些登入資料來存取 AWS。若要進一步了解如何建立 IAM 使用者、群組、政策和許可，請參閱《IAM **[使用者指南》中的 IAM 身分](https://docs.aws.amazon.com/IAM/latest/UserGuide/id.html)和[政策和許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html)。

## 我想要允許 以外的人員 AWS 帳戶 存取我的 Amazon Keyspaces 資源
<a name="security_iam_troubleshoot-cross-account-access"></a>

您可以建立一個角色，讓其他帳戶中的使用者或您組織外部的人員存取您的資源。您可以指定要允許哪些信任物件取得該角色。針對支援基於資源的政策或存取控制清單 (ACL) 的服務，您可以使用那些政策來授予人員存取您的資源的許可。

如需進一步了解，請參閱以下內容：
+ 若要了解 Amazon Keyspaces 是否支援這些功能，請參閱 [Amazon Keyspaces 如何與 IAM 搭配使用](security_iam_service-with-iam.md)。
+ 若要了解如何 AWS 帳戶 在您擁有的 資源之間提供存取權，請參閱《[IAM 使用者指南》中的在您擁有 AWS 帳戶 的另一個 IAM 使用者中提供存取權](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_aws-accounts.html)。 **
+ 若要了解如何將資源的存取權提供給第三方 AWS 帳戶，請參閱《*IAM 使用者指南*》中的[將存取權提供給第三方 AWS 帳戶 擁有](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_third-party.html)。
+ 如需了解如何透過聯合身分提供存取權，請參閱《*IAM 使用者指南*》中的[將存取權提供給在外部進行身分驗證的使用者 (聯合身分)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_common-scenarios_federated-users.html)。
+ 如需了解使用角色和資源型政策進行跨帳戶存取之間的差異，請參閱《IAM 使用者指南》**中的 [IAM 中的跨帳戶資源存取](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies-cross-account-resource-access.html)。

# 使用 Amazon Keyspaces 的服務連結角色
<a name="using-service-linked-roles"></a>

Amazon Keyspaces （適用於 Apache Cassandra) 使用 AWS Identity and Access Management (IAM) [ 服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-linked-role)。服務連結角色是直接連結至 Amazon Keyspaces 的唯一 IAM 角色類型。服務連結角色由 Amazon Keyspaces 預先定義，並包含該服務代表您呼叫其他 AWS 服務所需的所有許可。

如需有關支援服務連結角色的其他 服務的資訊，請參閱[AWS 使用 IAM 的服務](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_aws-services-that-work-with-iam.html)，並在**服務連結角色**欄中尋找具有**是**的服務。選擇具有連結的**是**，以檢視該服務的服務連結角色文件。

**Topics**
+ [使用 Amazon Keyspaces 應用程式自動擴展的角色](using-service-linked-roles-app-auto-scaling.md)
+ [使用 Amazon Keyspaces 多區域複寫的角色](using-service-linked-roles-multi-region-replication.md)
+ [使用 Amazon Keyspaces CDC 串流的角色](using-service-linked-roles-CDC-streams.md)

# 使用 Amazon Keyspaces 應用程式自動擴展的角色
<a name="using-service-linked-roles-app-auto-scaling"></a>

Amazon Keyspaces （適用於 Apache Cassandra) 使用 AWS Identity and Access Management (IAM) [服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-linked-role)。服務連結角色是直接連結至 Amazon Keyspaces 的唯一 IAM 角色類型。服務連結角色由 Amazon Keyspaces 預先定義，並包含該服務代表您呼叫其他 AWS 服務所需的所有許可。

服務連結角色可讓您更輕鬆地設定 Amazon Keyspaces，因為您不必手動新增必要的許可。Amazon Keyspaces 會定義其服務連結角色的許可，除非另有定義，否則只有 Amazon Keyspaces 可以擔任其角色。定義的許可包括信任政策和許可政策，且該許可政策無法附加至其他 IAM 實體。

您必須先刪除角色的相關資源，才能刪除服務連結角色。這可保護您的 Amazon Keyspaces 資源，因為您不會不小心移除存取資源的許可。

## Amazon Keyspaces 的服務連結角色許可
<a name="service-linked-role-permissions-app-auto-scaling"></a>

Amazon Keyspaces 使用名為 **AWSServiceRoleForApplicationAutoScaling\$1CassandraTable** 的服務連結角色，以允許 Application Auto Scaling 代表您呼叫 Amazon Keyspaces 和 Amazon CloudWatch。

AWSServiceRoleForApplicationAutoScaling\$1CassandraTable 服務連結角色信任下列服務擔任該角色：
+ `cassandra.application-autoscaling.amazonaws.com`

角色許可政策允許 Application Auto Scaling 對指定的 Amazon Keyspaces 資源完成下列動作：
+ 動作：`arn:*:cassandra:*:*:/keyspace/system/table/*` 上的 `cassandra:Select`
+ 動作：對資源 `arn:*:cassandra:*:*:/keyspace/system_schema/table/*` 執行 `cassandra:Select`
+ 動作：對資源 `arn:*:cassandra:*:*:/keyspace/system_schema_mcs/table/*` 執行 `cassandra:Select`
+ 動作：對資源 `arn:*:cassandra:*:*:"*"` 執行 `cassandra:Alter`

## 為 Amazon Keyspaces 建立服務連結角色
<a name="create-service-linked-role-app-auto-scaling"></a>

您不需要為 Amazon Keyspaces 自動擴展手動建立服務連結角色。當您使用 AWS 管理主控台、CQL、 AWS CLI或 AWS API 在資料表上啟用 Amazon Keyspaces 自動擴展時，Application Auto Scaling 會為您建立服務連結角色。

若您刪除此服務連結角色，之後需要再次建立，您可以在帳戶中使用相同程序重新建立角色。當您為資料表啟用 Amazon Keyspaces 自動擴展時，Application Auto Scaling 會再次為您建立服務連結角色。

**重要**  
 此服務連結角色可以顯示在您的帳戶，如果您於其他服務中完成一項動作時，可以使用支援此角色的功能。若要進一步了解，請參閱[我的 中出現的新角色 AWS 帳戶](https://docs.aws.amazon.com/IAM/latest/UserGuide/troubleshoot_roles.html#troubleshoot_roles_new-role-appeared)。

## 編輯 Amazon Keyspaces 的服務連結角色
<a name="edit-service-linked-role-app-auto-scaling"></a>

Amazon Keyspaces 不允許您編輯 AWSServiceRoleForApplicationAutoScaling\$1CassandraTable 服務連結角色。因為有各種實體可能會參考服務連結角色，所以您無法在建立角色之後變更角色名稱。然而，您可使用 IAM 來編輯角色描述。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[編輯服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#edit-service-linked-role)。

## 刪除 Amazon Keyspaces 的服務連結角色
<a name="delete-service-linked-role-app-auto-scaling"></a>

若您不再使用需要服務連結角色的功能或服務，我們建議您刪除該角色。如此一來，您就沒有未主動監控或維護的未使用實體。不過，您必須先在帳戶中所有 的所有資料表上停用自動擴展 AWS 區域 ，才能手動刪除服務連結角色。若要在 Amazon Keyspaces 資料表上停用自動擴展，請參閱 [關閉資料表的 Amazon Keyspaces 自動擴展](autoscaling.turnoff.md)。

**注意**  
如果您嘗試修改資源時，Amazon Keyspaces 自動擴展正在使用該角色，則取消註冊可能會失敗。若此情況發生，請等待數分鐘後並再次嘗試操作。

**使用 IAM 手動刪除服務連結角色**

使用 IAM 主控台 AWS CLI、 或 AWS API 來刪除 AWSServiceRoleForApplicationAutoScaling\$1CassandraTable 服務連結角色。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[刪除服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#delete-service-linked-role)。

**注意**  
若要刪除 Amazon Keyspaces 自動擴展所使用的服務連結角色，您必須先停用帳戶中所有資料表的自動擴展。

## Amazon Keyspaces 服務連結角色支援的區域
<a name="slr-regions-app-auto-scaling"></a>

Amazon Keyspaces 支援在提供服務的所有區域中使用服務連結角色。如需詳細資訊，請參閱 [Amazon Keyspaces 的服務端點](https://docs.aws.amazon.com/keyspaces/latest/devguide/programmatic.endpoints.html)。

# 使用 Amazon Keyspaces 多區域複寫的角色
<a name="using-service-linked-roles-multi-region-replication"></a>

Amazon Keyspaces （適用於 Apache Cassandra) 使用 AWS Identity and Access Management (IAM) [服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-linked-role)。服務連結角色是直接連結至 Amazon Keyspaces 的唯一 IAM 角色類型。服務連結角色由 Amazon Keyspaces 預先定義，並包含該服務代表您呼叫其他 AWS 服務所需的所有許可。

服務連結角色可讓您更輕鬆地設定 Amazon Keyspaces，因為您不必手動新增必要的許可。Amazon Keyspaces 會定義其服務連結角色的許可，除非另有定義，否則只有 Amazon Keyspaces 可以擔任其角色。定義的許可包括信任政策和許可政策，且該許可政策無法附加至其他 IAM 實體。

您必須先刪除角色的相關資源，才能刪除服務連結角色。這可保護您的 Amazon Keyspaces 資源，因為您不會不小心移除存取資源的許可。

## Amazon Keyspaces 的服務連結角色許可
<a name="service-linked-role-permissions-multi-region-replication"></a>

Amazon Keyspaces 使用名為 **AWSServiceRoleForAmazonKeyspacesReplication** 的服務連結角色，以允許 Amazon Keyspaces 代表您將新 AWS 區域 新增至金鑰空間，並將資料表及其所有資料和設定複寫至新區域。此角色也允許 Amazon Keyspaces 代表您複寫寫入至所有區域中的資料表。

AWSServiceRoleForAmazonKeyspacesReplication 服務連結角色信任下列服務擔任該角色：
+ `replication.cassandra.amazonaws.com`

名為 KeyspacesReplicationServiceRolePolicy 的角色許可政策允許 Amazon Keyspaces 完成下列動作：
+ 動作：`cassandra:Select`
+ 動作：`cassandra:SelectMultiRegionResource`
+ 動作：`cassandra:Modify`
+ 動作：`cassandra:ModifyMultiRegionResource`
+ 動作：`cassandra:AlterMultiRegionResource`
+ 動作：`application-autoscaling:RegisterScalableTarget`當您在佈建模式中將複本新增至單一區域資料表並啟用自動擴展時，Amazon Keyspaces 會使用應用程式自動擴展許可。
+ 動作：`application-autoscaling:DeregisterScalableTarget`
+ 動作：`application-autoscaling:DescribeScalableTargets`
+ 動作：`application-autoscaling:PutScalingPolicy`
+ 動作：`application-autoscaling:DescribeScalingPolicies`
+ 動作：`cassandra:Alter`
+ 動作：`cloudwatch:DeleteAlarms`
+ 動作：`cloudwatch:DescribeAlarms`
+ 動作：`cloudwatch:PutMetricAlarm`

雖然 Amazon Keyspaces 服務連結角色 AWSServiceRoleForAmazonKeyspacesReplication 提供政策中指定 Amazon Resource Name (ARN) "arn：\$1" 的許可："Action："，但 Amazon Keyspaces 會提供您帳戶的 ARN。

`AmazonKeyspacesFullAccess` 受管政策中包含建立服務連結角色 AWSServiceRoleForAmazonKeyspacesReplication 的許可。如需詳細資訊，請參閱[AWS 受管政策：AmazonKeyspacesFullAccess](security-iam-awsmanpol.md#security-iam-awsmanpol-AmazonKeyspacesFullAccess)。

您必須設定許可，以允許您的使用者、群組或角色建立、編輯或刪除服務連結角色。如需詳細資訊，請參閱 *IAM 使用者指南*中的[服務連結角色許可](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#service-linked-role-permissions)。

## 為 Amazon Keyspaces 建立服務連結角色
<a name="create-service-linked-role-multi-region-replication"></a>

您無法手動建立服務連結角色。當您在 AWS 管理主控台、 AWS CLI或 AWS API 中建立多區域金鑰空間時，Amazon Keyspaces 會為您建立服務連結角色。

若您刪除此服務連結角色，之後需要再次建立，您可以在帳戶中使用相同程序重新建立角色。當您建立多區域金鑰空間時，Amazon Keyspaces 會再次為您建立服務連結角色。

## 編輯 Amazon Keyspaces 的服務連結角色
<a name="edit-service-linked-role-multi-region-replication"></a>

Amazon Keyspaces 不允許您編輯 AWSServiceRoleForAmazonKeyspacesReplication 服務連結角色。因為有各種實體可能會參考服務連結角色，所以您無法在建立角色之後變更角色名稱。然而，您可使用 IAM 來編輯角色描述。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[編輯服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#edit-service-linked-role)。

## 刪除 Amazon Keyspaces 的服務連結角色
<a name="delete-service-linked-role-multi-region-replication"></a>

若您不再使用需要服務連結角色的功能或服務，我們建議您刪除該角色。如此一來，您就沒有未主動監控或維護的未使用實體。不過，您必須先刪除帳戶中的所有多區域金鑰空間， AWS 區域 才能手動刪除服務連結角色。

### 清除服務連結角色
<a name="service-linked-role-review-before-delete-multi-region-replication"></a>

您必須先刪除角色使用的任何多區域金鑰空間和資料表，才能使用 IAM 刪除服務連結角色。

**注意**  
如果您嘗試刪除資源時，Amazon Keyspaces 服務正在使用該角色，則刪除可能會失敗。若此情況發生，請等待數分鐘後並再次嘗試操作。

**刪除 AWSServiceRoleForAmazonKeyspacesReplication 使用的 Amazon Keyspaces 資源 （主控台）**

1. 登入 AWS 管理主控台，並在 https：//[https://console.aws.amazon.com/keyspaces/home](https://console.aws.amazon.com/keyspaces/home) 開啟 Amazon Keyspaces 主控台。

1. 從左側面板中選擇**金鑰空間**。

1. 從清單中選取所有多區域金鑰空間。

1. 選擇**刪除**確認刪除，然後選擇**刪除金鑰空間**。

您也可以使用下列任一方法，以程式設計方式刪除多區域金鑰空間。
+ Cassandra 查詢語言 (CQL) [DROP KEYSPACE](cql.ddl.keyspace.md#cql.ddl.keyspace.drop)陳述式。
+ CLI 的 [delete-keyspace](https://docs.aws.amazon.com/cli/latest/reference/keyspaces/delete-keyspace.html) AWS 操作。
+ Amazon Keyspaces API 的 [DeleteKeyspace](https://docs.aws.amazon.com/keyspaces/latest/APIReference/API_DeleteKeyspace.html) 操作。

### 手動刪除服務連結角色
<a name="slr-manual-delete-multi-region-replication"></a>

使用 IAM 主控台 AWS CLI、 或 AWS API 來刪除 AWSServiceRoleForAmazonKeyspacesReplication 服務連結角色。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[刪除服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#delete-service-linked-role)。

## Amazon Keyspaces 服務連結角色支援的區域
<a name="slr-regions-multi-region-replication"></a>

Amazon Keyspaces 不支援在提供服務的每個區域中使用服務連結角色。您可以在下列區域中使用 AWSServiceRoleForAmazonKeyspacesReplication 角色。


****  

| 區域名稱 | 區域身分 | Amazon Keyspaces 的支援 | 
| --- | --- | --- | 
| 美國東部 (維吉尼亞北部) | us-east-1 | 是 | 
| 美國東部 (俄亥俄) | us-east-2 | 是 | 
| 美國西部 (加利佛尼亞北部) | us-west-1 | 是 | 
| 美國西部 (奧勒岡) | us-west-2 | 是 | 
| 亞太區域 (孟買) | ap-south-1 | 是 | 
| 亞太區域 (大阪) | ap-northeast-3 | 是 | 
| 亞太區域 (首爾) | ap-northeast-2 | 是 | 
| 亞太區域 (新加坡) | ap-southeast-1 | 是 | 
| 亞太區域 (雪梨) | ap-southeast-2 | 是 | 
| 亞太區域 (東京) | ap-northeast-1 | 是 | 
| 加拿大 (中部) | ca-central-1 | 是 | 
| 歐洲 (法蘭克福) | eu-central-1 | 是 | 
| 歐洲 (愛爾蘭) | eu-west-1 | 是 | 
| 歐洲 (倫敦) | eu-west-2 | 是 | 
| 歐洲 (巴黎) | eu-west-3 | 是 | 
| Africa (Cape Town) | af-south-1 | 是 | 
| 南美洲 (聖保羅) | sa-east-1 | 是 | 
| AWS GovCloud （美國東部） | us-gov-east-1 | 否 | 
| AWS GovCloud （美國西部） | us-gov-west-1 | 否 | 

# 使用 Amazon Keyspaces CDC 串流的角色
<a name="using-service-linked-roles-CDC-streams"></a>

Amazon Keyspaces （適用於 Apache Cassandra) 使用 AWS Identity and Access Management (IAM) [服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html#iam-term-service-linked-role)。服務連結角色是直接連結至 Amazon Keyspaces 的唯一 IAM 角色類型。服務連結角色由 Amazon Keyspaces 預先定義，並包含該服務代表您呼叫其他 AWS 服務所需的所有許可。

服務連結角色可讓您更輕鬆地設定 Amazon Keyspaces，因為您不必手動新增必要的許可。Amazon Keyspaces 會定義其服務連結角色的許可，除非另有定義，否則只有 Amazon Keyspaces 可以擔任其角色。定義的許可包括信任政策和許可政策，且該許可政策無法附加至其他 IAM 實體。

您無法刪除服務連結角色。

## Amazon Keyspaces 的服務連結角色許可
<a name="service-linked-role-permissions-CDC-streams"></a>

Amazon Keyspaces 使用名為 **AWSServiceRoleForAmazonKeyspacesCDC** 的服務連結角色，以允許 Amazon Keyspaces CDC 串流代表您將 CloudWatch 指標發佈至您的帳戶。

AWSServiceRoleForAmazonKeyspacesCDC 服務連結角色信任下列服務擔任該角色：
+ `cassandra-streams.amazonaws.com`

名為 [KeyspacesCDCServiceRolePolicy](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/KeyspacesCDCServiceRolePolicy.html) 的角色許可政策允許 Amazon Keyspaces 對 CloudWatch 命名空間 中的資源完成下列動作`AWS/Cassandra`：
+ 動作：`*` 上的 `cloudwatch:PutMetricData`

  AWSServiceRoleForAmazonKeyspacesCDC 會在符合下列條件的所有資源上提供許可：Action： cloudwatch：PutMetricData`"cloudwatch:namespace": "AWS/Cassandra"`。

如需 KeyspacesCDCServiceRolePolicy 的詳細資訊，請參閱 [AWS 受管政策：KeyspacesCDCServiceRolePolicy](security-iam-awsmanpol.md#security-iam-awsmanpol-KeyspacesCDCServiceRolePolicy)。

若要為會自動建立服務連結角色 AWSServiceRoleForAmazonKeyspacesCDC 的資料表啟用 CDC 串流，IAM 主體需要下列許可。

```
{
    "Sid": "KeyspacesCDCServiceLinkedRole",
    "Effect": "Allow",
    "Action": "iam:CreateServiceLinkedRole",
    "Resource": "arn:aws:iam::*:role/aws-service-role/cassandra-streams.amazonaws.com/AWSServiceRoleForAmazonKeyspacesCDC",
    "Condition": {
    "StringLike": {
        "iam:AWSServiceName": "cassandra-streams.amazonaws.com"
    }
}
```

`AmazonKeyspacesFullAccess` 受管政策中包含建立服務連結角色 AWSServiceRoleForAmazonKeyspacesCDC 的許可。如需詳細資訊，請參閱[AWS 受管政策：AmazonKeyspacesFullAccess](security-iam-awsmanpol.md#security-iam-awsmanpol-AmazonKeyspacesFullAccess)。

## 為 Amazon Keyspaces 建立服務連結角色
<a name="create-service-linked-role-CDC-streams"></a>

您不需要手動為 Amazon Keyspaces CDC 串流建立服務連結角色。當您在具有 AWS 管理主控台、CQL、 AWS CLI或 AWS API 的資料表上啟用 Amazon Keyspaces CDC 串流時，Amazon Keyspaces 會為您建立服務連結角色。

若您刪除此服務連結角色，之後需要再次建立，您可以在帳戶中使用相同程序重新建立角色。當您為資料表啟用 Amazon Keyspaces CDC 串流時，Amazon Keyspaces 會再次為您建立服務連結角色。

## 編輯 Amazon Keyspaces 的服務連結角色
<a name="edit-service-linked-role-CDC-streams"></a>

Amazon Keyspaces 不允許您編輯 AWSServiceRoleForAmazonKeyspacesCDC 服務連結角色。因為有各種實體可能會參考服務連結角色，所以您無法在建立角色之後變更角色名稱。然而，您可使用 IAM 來編輯角色描述。如需詳細資訊，請參閱《*IAM 使用者指南*》中的[編輯服務連結角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/using-service-linked-roles.html#edit-service-linked-role)。

## Amazon Keyspaces 服務連結角色支援的區域
<a name="slr-regions-CDC-streams"></a>

Amazon Keyspaces 支援在提供服務的所有區域中使用服務連結角色。如需詳細資訊，請參閱 [AWS Regions and endpoints](https://docs.aws.amazon.com/general/latest/gr/rande.html)。