

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

# Amazon Keyspaces 的安全性 （適用於 Apache Cassandra)
<a name="security"></a>

的雲端安全性 AWS 是最高優先順序。身為 AWS 客戶，您可以受益於資料中心和網路架構，該架構專為滿足最安全敏感組織的需求而建置。

安全性是 AWS 與您之間的共同責任。[共同責任模型](https://aws.amazon.com/compliance/shared-responsibility-model/)將其描述為雲端*的*安全性和雲端*中*的安全性：
+ **雲端的安全性** – AWS 負責保護在 中執行 AWS 服務的基礎設施 AWS 雲端。 AWS 也為您提供可安全使用的服務。第三方稽核人員定期檢測及驗證安全的效率也是我們 [AWS 合規計劃](https://aws.amazon.com/compliance/programs/)的一部分。若要了解適用於 Amazon Keyspaces 的合規計劃，請參閱[AWS 合規計劃範圍內的服務](https://aws.amazon.com/compliance/services-in-scope/)。
+ **雲端的安全性** – 您的責任取決於您使用 AWS 的服務。您也必須對資料敏感度、組織要求，以及適用法律和法規等其他因素負責。

本文件將協助您了解如何在使用 Amazon Keyspaces 時套用共同責任模型。下列主題說明如何設定 Amazon Keyspaces 以符合您的安全與合規目標。您也將了解如何使用其他 AWS 服務，協助您監控和保護 Amazon Keyspaces 資源。

**Topics**
+ [Amazon Keyspaces 中的資料保護](data-protection.md)
+ [AWS Identity and Access Management 適用於 Amazon Keyspaces](security-iam.md)
+ [Amazon Keyspaces 的合規驗證 （適用於 Apache Cassandra)](Keyspaces-compliance.md)
+ [Amazon Keyspaces 中的彈性和災難復原](disaster-recovery-resiliency.md)
+ [Amazon Keyspaces 中的基礎設施安全性](infrastructure-security.md)
+ [Amazon Keyspaces 的組態和漏洞分析](configuration-vulnerability.md)
+ [Amazon Keyspaces 的安全最佳實務](best-practices-security.md)

# Amazon Keyspaces 中的資料保護
<a name="data-protection"></a>

 AWS [共同責任模型](https://aws.amazon.com/compliance/shared-responsibility-model/)適用於 Amazon Keyspaces 中的資料保護 （適用於 Apache Cassandra)。如此模型所述， AWS 負責保護執行所有 的全域基礎設施 AWS 雲端。您負責維護在此基礎設施上託管內容的控制權。您也同時負責所使用 AWS 服務 的安全組態和管理任務。如需資料隱私權的詳細資訊，請參閱[資料隱私權常見問答集](https://aws.amazon.com/compliance/data-privacy-faq/)。如需有關歐洲資料保護的相關資訊，請參閱 *AWS 安全性部落格*上的 [AWS 共同的責任模型和 GDPR](https://aws.amazon.com/blogs/security/the-aws-shared-responsibility-model-and-gdpr/) 部落格文章。

基於資料保護目的，我們建議您保護 AWS 帳戶 登入資料，並使用 AWS IAM Identity Center 或 AWS Identity and Access Management (IAM) 設定個別使用者。如此一來，每個使用者都只會獲得授與完成其任務所必須的許可。我們也建議您採用下列方式保護資料：
+ 每個帳戶均要使用多重要素驗證 (MFA)。
+ 使用 SSL/TLS 與 AWS 資源通訊。我們需要 TLS 1.2 並建議使用 TLS 1.3。
+ 使用 設定 API 和使用者活動記錄 AWS CloudTrail。如需有關使用 CloudTrail 追蹤擷取 AWS 活動的資訊，請參閱*AWS CloudTrail 《 使用者指南*》中的[使用 CloudTrail 追蹤](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-trails.html)。
+ 使用 AWS 加密解決方案，以及其中的所有預設安全控制 AWS 服務。
+ 使用進階的受管安全服務 (例如 Amazon Macie)，協助探索和保護儲存在 Amazon S3 的敏感資料。
+ 如果您在 AWS 透過命令列界面或 API 存取 時需要 FIPS 140-3 驗證的密碼編譯模組，請使用 FIPS 端點。如需有關 FIPS 和 FIPS 端點的更多相關資訊，請參閱[聯邦資訊處理標準 (FIPS) 140-3](https://aws.amazon.com/compliance/fips/)。

我們強烈建議您絕對不要將客戶的電子郵件地址等機密或敏感資訊，放在標籤或自由格式的文字欄位中，例如**名稱**欄位。這包括當您使用 Amazon Keyspaces 或其他 AWS 服務 使用主控台、API AWS CLI或 AWS SDKs。您在標籤或自由格式文字欄位中輸入的任何資料都可能用於計費或診斷日誌。如果您提供外部伺服器的 URL，我們強烈建議請勿在驗證您對該伺服器請求的 URL 中包含憑證資訊。

**Topics**
+ [Amazon Keyspaces 中的靜態加密](EncryptionAtRest.md)
+ [在 Amazon Keyspaces 中傳輸中的加密](encryption-in-transit.md)
+ [Amazon Keyspaces 中的網際網路流量隱私權](inter-network-traffic-privacy.md)

# Amazon Keyspaces 中的靜態加密
<a name="EncryptionAtRest"></a>

Amazon Keyspaces （適用於 Apache Cassandra) *靜態加密*使用 [AWS Key Management Service (AWS KMS)](https://aws.amazon.com/kms/) 中存放的加密金鑰來加密所有靜態資料，以提供增強的安全性。此功能協助降低了保護敏感資料所涉及的操作負擔和複雜性。透過靜態加密，您可以建置安全敏感的應用程式，以滿足嚴格的資料保護合規和法規要求。

 Amazon Keyspaces 靜態加密會使用 256 位元進階加密標準 (AES-256) 來加密您的資料。這有助於保護您的資料免於未經授權存取基礎儲存體。

Amazon Keyspaces 會以透明的方式加密和解密資料表中的資料和串流。Amazon Keyspaces 使用信封加密和金鑰階層來保護資料加密金鑰。它與 AWS KMS 整合，用於存放和管理根加密金鑰。如需加密金鑰階層的詳細資訊，請參閱 [靜態加密：在 Amazon Keyspaces 中運作的方式](encryption.howitworks.md)。如需信封加密等 AWS KMS 概念的詳細資訊，請參閱《 *AWS Key Management Service 開發人員指南*》中的[AWS KMS 管理服務概念](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html)。

 建立新資料表時，您可以選擇下列其中一個*AWS KMS 金鑰 (KMS 金鑰）*：
+ AWS 擁有的金鑰 – 這是預設加密類型。金鑰由 Amazon Keyspaces 擁有 （不收取額外費用）。
+ 客戶受管金鑰 – 此金鑰會存放在您的帳戶中，並由您建立、擁有和管理。您可以完全控制客戶受管金鑰 （需支付AWS KMS 費用）。

Amazon Keyspaces 會使用與基礎資料表相同的金鑰自動加密變更資料擷取 (CDC) 串流。如需 CDC 的詳細資訊，請參閱 [在 Amazon Keyspaces 中使用變更資料擷取 (CDC) 串流](cdc.md)。

 您可以隨時在 AWS 擁有的金鑰 和客戶受管金鑰之間切換。您可以在建立新資料表時指定客戶受管金鑰，或使用主控台或以程式設計方式使用 CQL 陳述式變更現有資料表的 KMS 金鑰。如要瞭解如何作業，請參閱[靜態加密：如何使用客戶自管金鑰來加密 Amazon Keyspaces 中的表格](encryption.customermanaged.md)。

 使用 的預設選項 AWS 擁有的金鑰 進行靜態加密無需額外費用。不過，客戶受管金鑰會 AWS KMS 收取費用。如需定價的詳細資訊，請參閱 [AWS KMS 定價](https://aws.amazon.com/kms/pricing)。

Amazon Keyspaces 靜態加密適用於所有 AWS 區域，包括 AWS 中國 （北京） 和 AWS 中國 （寧夏） 區域。如需詳細資訊，請參閱[靜態加密：在 Amazon Keyspaces 中運作的方式](encryption.howitworks.md)。

**Topics**
+ [靜態加密：在 Amazon Keyspaces 中運作的方式](encryption.howitworks.md)
+ [靜態加密：如何使用客戶自管金鑰來加密 Amazon Keyspaces 中的表格](encryption.customermanaged.md)

# 靜態加密：在 Amazon Keyspaces 中運作的方式
<a name="encryption.howitworks"></a>

Amazon Keyspaces （適用於 Apache Cassandra) *靜態加密*會使用 256 位元進階加密標準 (AES-256) 加密您的資料。這有助於保護您的資料免於未經授權存取基礎儲存體。根據預設，Amazon Keyspaces 資料表中的所有客戶資料都會靜態加密，且伺服器端加密是透明的，這表示不需要變更應用程式。

靜態加密與 AWS Key Management Service (AWS KMS) 整合，用於管理用來加密資料表的加密金鑰。建立新資料表或更新現有資料表時，您可以選擇下列其中一個*AWS KMS 金鑰*選項：
+ AWS 擁有的金鑰 – 這是預設加密類型。金鑰由 Amazon Keyspaces 擁有 （不收取額外費用）。
+ 客戶受管金鑰 – 此金鑰存放在您的帳戶中，由您建立、擁有和管理。您可以完全控制客戶受管金鑰 （需支付AWS KMS 費用）。

**AWS KMS 金鑰 (KMS 金鑰）**  
靜態加密使用 AWS KMS 金鑰保護您的所有 Amazon Keyspaces 資料。根據預設，Amazon Keyspaces 會使用 [AWS 擁有的金鑰](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#aws-owned-cmk)，這是在 Amazon Keyspaces 服務帳戶中建立和管理的多租戶加密金鑰。  
不過，您可以使用 中的[客戶受管金鑰](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk)來加密 Amazon Keyspaces 資料表 AWS 帳戶。您可以為金鑰空間中的每個資料表選取不同的 KMS 金鑰。您為資料表選取的 KMS 金鑰也會用來加密其所有中繼資料和可還原的備份。  
建立或更新資料表時，您可以選取資料表的 KMS 金鑰。您可以隨時在 Amazon Keyspaces 主控台或使用 [ALTER TABLE](cql.ddl.keyspace.md#cql.ddl.keyspace.alter) 陳述式來變更資料表的 KMS 金鑰。切換 KMS 金鑰的程序是無縫的，不需要停機時間或導致服務降級。

**金鑰階層**  
Amazon Keyspaces 使用金鑰階層來加密資料。在此金鑰階層中，KMS 金鑰是根金鑰。它用於加密和解密 Amazon Keyspaces 資料表加密金鑰。資料表加密金鑰用於加密 Amazon Keyspaces 在內部使用的加密金鑰，以在執行讀取和寫入操作時加密和解密資料。  
使用加密金鑰階層，您可以對 KMS 金鑰進行變更，而無需重新加密資料或影響應用程式和持續的資料操作。  

![\[金鑰階層顯示根金鑰、資料表加密金鑰，以及用於靜態加密的資料加密金鑰。\]](http://docs.aws.amazon.com/zh_tw/keyspaces/latest/devguide/images/keyspaces_encryption.png)


**資料表索引鍵**  
Amazon Keyspaces 資料表金鑰用作金鑰加密金鑰。Amazon Keyspaces 使用資料表金鑰來保護內部資料加密金鑰，這些金鑰用於加密存放在資料表、日誌檔案和可還原備份中的資料。Amazon Keyspaces 會為資料表中的每個基礎結構產生唯一的資料加密金鑰。不過，多個資料表資料列可能受到相同的資料加密金鑰保護。  
當您第一次將 KMS 金鑰設定為客戶受管金鑰時， AWS KMS 會產生*資料金鑰*。 AWS KMS 資料金鑰是指 Amazon Keyspaces 中的資料表金鑰。  
當您存取加密的資料表時，Amazon Keyspaces 會傳送請求至 AWS KMS ，以使用 KMS 金鑰解密資料表金鑰。然後，它會使用純文字資料表金鑰來解密 Amazon Keyspaces 資料加密金鑰，並使用純文字資料加密金鑰來解密資料表資料。  
Amazon Keyspaces 使用 並將資料表金鑰和資料加密金鑰存放在 外部 AWS KMS。它使用[進階加密標準](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) (AES) 加密和 256 位元加密金鑰來保護所有金鑰。然後，它會將加密的金鑰與加密的資料一起存放，以便他們可以隨需解密資料表資料。

**資料表金鑰快取**  
為了避免 AWS KMS 呼叫每個 Amazon Keyspaces 操作，Amazon Keyspaces 會快取記憶體中每個連線的純文字資料表金鑰。如果 Amazon Keyspaces 在閒置五分鐘後收到快取資料表金鑰的請求，則會將新的請求傳送至 AWS KMS 以解密資料表金鑰。此呼叫會擷取自上次請求解密資料表金鑰以來，對 AWS KMS 或 AWS Identity and Access Management (IAM) 中 KMS 金鑰的存取政策所做的任何變更。

**封套加密**  
如果您變更資料表的客戶受管金鑰，Amazon Keyspaces 會產生新的資料表金鑰。然後，它會使用新的資料表金鑰來重新加密資料加密金鑰。它也會使用新的資料表金鑰來加密先前用於保護可還原備份的資料表金鑰。此程序稱為信封加密。這可確保即使您輪換客戶受管金鑰，也可以存取可還原的備份。如需信封加密的詳細資訊，請參閱《 *AWS Key Management Service 開發人員指南*》中的[信封加密](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#enveloping)。

**Topics**
+ [AWS 擁有的金鑰](#keyspaces-owned)
+ [客戶受管金鑰](#customer-managed)
+ [靜態加密用量備註](#encryption.usagenotes)

## AWS 擁有的金鑰
<a name="keyspaces-owned"></a>

AWS 擁有的金鑰 不會存放在您的 中 AWS 帳戶。它們是 KMS 金鑰集合的一部分，這些金鑰 AWS 擁有和管理用於 multiple AWS 帳戶。 AWS services 可用來 AWS 擁有的金鑰 保護您的資料。

您無法檢視、管理或使用 AWS 擁有的金鑰或稽核其使用。不過，您不需要進行任何工作或變更任何程式，即可保護加密資料的金鑰。

您不需要支付每月費用或使用費 AWS 擁有的金鑰，也不會計入您帳戶的 AWS KMS 配額。

## 客戶受管金鑰
<a name="customer-managed"></a>

客戶受管金鑰是您 AWS 帳戶 建立、擁有和管理的 金鑰。您可以完全控制這些 KMS 金鑰。

使用客戶受管金鑰來取得下列功能：
+ 您可以建立和管理客戶受管金鑰，包括設定和維護[金鑰政策](https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html)、[IAM 政策和](https://docs.aws.amazon.com/kms/latest/developerguide/iam-policies.html)[授予](https://docs.aws.amazon.com/kms/latest/developerguide/grants.html) 以控制對客戶受管金鑰的存取。您可以[啟用和停用](https://docs.aws.amazon.com/kms/latest/developerguide/enabling-keys.html)客戶受管金鑰、啟用和停用[自動金鑰輪換](https://docs.aws.amazon.com/kms/latest/developerguide/rotate-keys.html)，並在不再使用時[排定刪除客戶受管金鑰](https://docs.aws.amazon.com/kms/latest/developerguide/deleting-keys.html)。您可以為您管理的客戶受管金鑰建立標籤和別名。
+ 您可以搭配[匯入的金鑰材料](https://docs.aws.amazon.com/kms/latest/developerguide/importing-keys.html)使用客戶受管金鑰，或是使用位於您所擁有及管理[自訂金鑰存放區](https://docs.aws.amazon.com/kms/latest/developerguide/custom-key-store-overview.html)中的客戶受管金鑰。
+ 您可以使用 AWS CloudTrail 和 Amazon CloudWatch Logs 來追蹤 Amazon Keyspaces AWS KMS 代表您傳送到 的請求。如需詳細資訊，請參閱[步驟 6：使用 設定監控 AWS CloudTrail](encryption.customermanaged.md#encryption-cmk-trail)。

客戶受管金鑰會針對每個 API 呼叫[產生費用](https://aws.amazon.com/kms/pricing/)，而配額適用於這些 KMS AWS KMS 金鑰。如需詳細資訊，請參閱[AWS KMS 資源或請求配額](https://docs.aws.amazon.com/kms/latest/developerguide/limits.html)。

當您將客戶受管金鑰指定為資料表的根加密金鑰時，可還原備份會使用建立備份時為資料表指定的相同加密金鑰進行加密。如果輪換資料表的 KMS 金鑰，金鑰包圍可確保最新的 KMS 金鑰可存取所有可還原的備份。

Amazon Keyspaces 必須能夠存取您的客戶受管金鑰，才能讓您存取資料表資料。如果加密金鑰的狀態設定為停用或排定刪除，Amazon Keyspaces 將無法加密或解密資料。因此，您無法在資料表上執行讀取和寫入操作。一旦服務偵測到您的加密金鑰無法存取，Amazon Keyspaces 就會傳送電子郵件通知，提醒您。

您必須在七天內還原加密金鑰的存取權，否則 Amazon Keyspaces 會自動刪除您的資料表。基於預防措施，Amazon Keyspaces 會在刪除資料表之前建立資料表資料的可還原備份。Amazon Keyspaces 會維護可還原備份 35 天。35 天後，您無法再還原資料表資料。您不需要支付可還原備份的費用，但[需支付標準還原費用](https://aws.amazon.com/keyspaces/pricing)。

您可以使用此可還原備份，將資料還原至新的資料表。若要啟動還原，必須啟用用於資料表的最後一個客戶受管金鑰，Amazon Keyspaces 必須具有其存取權。

**注意**  
當您建立使用客戶受管金鑰加密的資料表時，在建立程序完成之前無法存取或排程刪除，會發生錯誤。建立資料表操作失敗，且您會收到電子郵件通知。

## 靜態加密用量備註
<a name="encryption.usagenotes"></a>

當您在 Amazon Keyspaces 中使用靜態加密時，請考慮下列事項。
+ 所有 Amazon Keyspaces 資料表上都會啟用靜態伺服器端加密，且無法停用。整個資料表會靜態加密，您無法選取特定資料欄或資料列進行加密。
+ 根據預設，Amazon Keyspaces 會使用單一服務預設金鑰 (AWS 擁有的金鑰) 來加密所有資料表。如果此金鑰不存在，則會為您建立。無法停用服務預設金鑰。
+ 靜態加密只會在資料在持久性儲存媒體上靜態 （靜態） 時加密資料。如果資料安全是傳輸中資料或使用中資料的考量，您必須採取其他措施：
  + 傳輸中資料：您在 Amazon Keyspaces 中的所有資料都會在傳輸中加密。根據預設，Amazon Keyspaces 的通訊會使用 Secure Sockets Layer (SSL)/Transport Layer Security (TLS) 加密進行保護。
  + 使用中的資料：使用用戶端加密，在將資料傳送到 Amazon Keyspaces 之前保護資料。
  + 客戶受管金鑰：資料表中的靜態資料一律使用客戶受管金鑰加密。不過，在處理 AWS 擁有的金鑰 期間執行多列原子更新的操作會暫時使用 來加密資料。這包括範圍刪除操作和同時存取靜態和非靜態資料的操作。
+ 單一客戶受管金鑰最多可有 50，000 個[授予](https://docs.aws.amazon.com/kms/latest/developerguide/grants.html)。與客戶受管金鑰相關聯的每個 Amazon Keyspaces 資料表都會耗用 2 個授與。刪除資料表時，會釋出一個授予。第二個授權用於建立資料表的自動快照，以防止資料遺失，以防 Amazon Keyspaces 意外遺失對客戶受管金鑰的存取。此授與會在刪除資料表後 42 天發行。

# 靜態加密：如何使用客戶自管金鑰來加密 Amazon Keyspaces 中的表格
<a name="encryption.customermanaged"></a>

您可以使用 主控台或 CQL 陳述式， AWS KMS key 為新資料表指定 ，並更新 Amazon Keyspaces 中現有資料表的加密金鑰。下列主題概述如何實作新資料表和現有資料表的客戶受管金鑰。

**Topics**
+ [先決條件：使用 建立客戶受管金鑰， AWS KMS 並將許可授予 Amazon Keyspaces](#encryption.createCMKMS)
+ [步驟 3：指定新資料表的客戶受管金鑰](#encryption.tutorial-creating)
+ [步驟 4：更新現有資料表的加密金鑰](#encryption.tutorial-update)
+ [步驟 5：在日誌中使用 Amazon Keyspaces 加密內容](#encryption-context)
+ [步驟 6：使用 設定監控 AWS CloudTrail](#encryption-cmk-trail)

## 先決條件：使用 建立客戶受管金鑰， AWS KMS 並將許可授予 Amazon Keyspaces
<a name="encryption.createCMKMS"></a>

您必須先在 AWS Key Management Service (AWS KMS) 中建立金鑰，然後授權 Amazon Keyspaces 使用該金鑰，才能使用[客戶受管金鑰](encryption.howitworks.md#customer-managed)來保護 Amazon Keyspaces 資料表。

### 步驟 1：使用 建立客戶受管金鑰 AWS KMS
<a name="encryption-create-key"></a>

若要建立用於保護 Amazon Keyspaces 資料表的客戶受管金鑰，您可以遵循使用主控台或 AWS API [建立對稱加密 KMS 金鑰](https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html#create-symmetric-cmk)中的步驟。

### 步驟 2：授權使用客戶受管金鑰
<a name="encryption-authz"></a>

在您可以選擇[客戶受管金鑰](encryption.howitworks.md#customer-managed)來保護 Amazon Keyspaces 資料表之前，該客戶受管金鑰上的政策必須授予 Amazon Keyspaces 代表您使用它的許可。您可以完全控制客戶受管金鑰上的政策和授予。您可以在[金鑰政策](https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html)、[IAM 政策](https://docs.aws.amazon.com/kms/latest/developerguide/iam-policies.html)或[授予](https://docs.aws.amazon.com/kms/latest/developerguide/grants.html)中提供這些許可。

Amazon Keyspaces 不需要額外的授權，即可使用預設值[AWS 擁有的金鑰](encryption.howitworks.md#keyspaces-owned)來保護您 AWS 帳戶中的 Amazon Keyspaces 資料表。

下列主題說明如何使用 IAM 政策和授予來設定必要的許可，以允許 Amazon Keyspaces 資料表使用客戶受管金鑰。

**Topics**
+ [客戶受管金鑰的金鑰政策](#encryption-customer-managed-policy)
+ [範例金鑰政策](#encryption-customer-managed-policy-sample)
+ [使用授予授權 Amazon Keyspaces](#encryption-grants)

#### 客戶受管金鑰的金鑰政策
<a name="encryption-customer-managed-policy"></a>

當您選取[客戶受管金鑰](encryption.howitworks.md#customer-managed)來保護 Amazon Keyspaces 資料表時，Amazon Keyspaces 會取得代表進行選取之主體使用客戶受管金鑰的許可。該委託人、使用者或角色必須擁有 Amazon Keyspaces 所需客戶受管金鑰的許可。

Amazon Keyspaces 至少需要客戶受管金鑰的下列許可：
+ [kms:Encrypt](https://docs.aws.amazon.com/kms/latest/APIReference/API_Encrypt.html)
+ [kms:Decrypt](https://docs.aws.amazon.com/kms/latest/APIReference/API_Decrypt.html)
+ [kms:ReEncrypt](https://docs.aws.amazon.com/kms/latest/APIReference/API_ReEncrypt.html)\$1 (適用於 kms:ReEncryptFrom and kms:ReEncryptTo)
+ kms:GenerateDataKey\$1 (適用於 [kms:GenerateDataKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_GenerateDataKey.html) 和 [kms:GenerateDataKeyWithoutPlaintext](https://docs.aws.amazon.com/kms/latest/APIReference/API_GenerateDataKeyWithoutPlaintext.html))
+ [kms:DescribeKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html)
+ [kms:CreateGrant](https://docs.aws.amazon.com/kms/latest/APIReference/API_CreateGrant.html)

#### 範例金鑰政策
<a name="encryption-customer-managed-policy-sample"></a>

例如，以下範例金鑰政策只會提供必要許可。政策具有下列效果：
+ 允許 Amazon Keyspaces 在密碼編譯操作中使用客戶受管金鑰並建立授予，但僅限於代表帳戶中有權使用 Amazon Keyspaces 的主體時。如果政策陳述式中指定的委託人沒有使用 Amazon Keyspaces 的許可，呼叫會失敗，即使它來自 Amazon Keyspaces 服務。
+ [kms:ViaService](https://docs.aws.amazon.com/kms/latest/developerguide/policy-conditions.html#conditions-kms-via-service) 條件金鑰只有在請求來自 Amazon Keyspaces 時，才允許 許可，這些請求代表政策陳述式中列出的委託人。這些主體無法直接呼叫這些操作。請注意，`kms:ViaService` 值 (`cassandra.*.amazonaws.com`) 在區域位置中有星號 (\$1)。Amazon Keyspaces 需要 許可，才能獨立於任何特定項目 AWS 區域。
+ 授予客戶受管金鑰管理員 （可擔任該`db-team`角色的使用者） 對客戶受管金鑰的唯讀存取權，以及撤銷授予的許可，包括 [Amazon Keyspaces 保護資料表所需的授予](#encryption-grants)。
+ 授予 Amazon Keyspaces 對客戶受管金鑰的唯讀存取權。在這種情況下，Amazon Keyspaces 可以直接呼叫這些操作。它不必代表帳戶委託人採取行動。

使用範例金鑰政策之前，請將範例主體取代為來自您的實際主體 AWS 帳戶。

```
{
  "Id": "key-policy-cassandra",
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid" : "Allow access through Amazon Keyspaces for all principals in the account that are authorized to use Amazon Keyspaces",
      "Effect": "Allow",
      "Principal": {"AWS": "arn:aws:iam::111122223333:user/db-lead"},
      "Action": [
        "kms:Encrypt",
        "kms:Decrypt",
        "kms:ReEncrypt*",
        "kms:GenerateDataKey*",
        "kms:DescribeKey",
        "kms:CreateGrant"
      ],
      "Resource": "*",      
      "Condition": { 
         "StringLike": {
           "kms:ViaService" : "cassandra.*.amazonaws.com"
         }
      }
    },
    {
      "Sid":  "Allow administrators to view the customer managed key and revoke grants",
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::111122223333:role/db-team"
       },
      "Action": [
        "kms:Describe*",
        "kms:Get*",
        "kms:List*",
        "kms:RevokeGrant"
      ],
      "Resource": "*"
    }
  ]
}
```

#### 使用授予授權 Amazon Keyspaces
<a name="encryption-grants"></a>

除了金鑰政策之外，Amazon Keyspaces 還使用授予來設定客戶受管金鑰的許可。若要檢視您帳戶中客戶受管金鑰的授予，請使用 [ListGrants](https://docs.aws.amazon.com/kms/latest/APIReference/API_ListGrants.html) 操作。Amazon Keyspaces 不需要授予或任何其他許可，即可使用 [AWS 擁有的金鑰](encryption.howitworks.md#keyspaces-owned)來保護您的資料表。

Amazon Keyspaces 會在執行背景系統維護和持續資料保護任務時使用授予許可。它還使用授與來產生資料表金鑰。

每個授與都專屬於一個資料表。如果帳戶包含以相同客戶受管金鑰加密的多個資料表，則會授予每個資料表的每種類型。[Amazon Keyspaces 加密內容](https://docs.aws.amazon.com/kms/latest/developerguide/encryption-context.html)會限制授予，其中包含資料表名稱和 AWS 帳戶 ID。授予包含不再需要時[淘汰授予的](https://docs.aws.amazon.com/kms/latest/APIReference/API_RetireGrant.html)許可。

若要建立授予，Amazon Keyspaces 必須具有`CreateGrant`代表建立加密資料表的使用者呼叫 的許可。

金鑰政策也會允許帳戶[撤銷客戶受管金鑰上的授予](https://docs.aws.amazon.com/kms/latest/APIReference/API_RevokeGrant.html)。不過，如果您撤銷作用中加密資料表的授予，Amazon Keyspaces 將無法保護和維護資料表。

## 步驟 3：指定新資料表的客戶受管金鑰
<a name="encryption.tutorial-creating"></a>

請依照下列步驟，使用 Amazon Keyspaces 主控台或 CQL 在新資料表上指定客戶受管金鑰。

### 使用客戶受管金鑰建立加密的資料表 （主控台）
<a name="encryption.tutorial-console"></a>

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

1. 在導覽窗格中，選擇 **Tables** (資料表)，然後選擇 **Create table** (建立資料表)。

1. 在**資料表詳細資訊區段的建立**資料表頁面上，選取金鑰空間，並提供新資料表的名稱。 ****

1. 在**結構描述**區段中，建立資料表的結構描述。

1. 在**資料表設定**區段中，選擇**自訂設定**。

1. 繼續至**加密設定**。

   在此步驟中，您會選取資料表的加密設定。

   在**選擇 AWS KMS key**下的**靜態加密**區段中，選擇**選擇不同的 KMS 金鑰 （進階）** 選項，然後在搜尋欄位中，選擇 AWS KMS key 或輸入 Amazon Resource Name (ARN)。
**注意**  
如果您選取的金鑰無法存取或缺少必要的許可，請參閱[《 開發人員指南》中的對金鑰存取進行故障診斷](https://docs.aws.amazon.com/kms/latest/developerguide/policy-evaluation.html)。 AWS Key Management Service 

1. 選擇 **Create** (建立) 以建立加密資料表。

### 使用客戶受管金鑰建立新資料表以進行靜態加密 (CQL)
<a name="encryption.tutorial-cql"></a>

若要建立使用客戶受管金鑰進行靜態加密的新資料表，您可以使用 `CREATE TABLE`陳述式，如下列範例所示。請務必使用授予 Amazon Keyspaces 之許可的有效金鑰的 ARN 取代金鑰 ARN。

```
CREATE TABLE my_keyspace.my_table(id bigint, name text, place text STATIC, PRIMARY KEY(id, name)) WITH CUSTOM_PROPERTIES = {
        'encryption_specification':{
                'encryption_type': 'CUSTOMER_MANAGED_KMS_KEY', 
                'kms_key_identifier':'arn:aws:kms:eu-west-1:5555555555555:key/11111111-1111-111-1111-111111111111'
            }
    };
```

如果您收到 `Invalid Request Exception`，則需要確認客戶受管金鑰有效，且 Amazon Keyspaces 具有必要的許可。若要確認金鑰已正確設定，請參閱《 AWS Key Management Service 開發人員指南》中的對[金鑰存取進行故障診斷](https://docs.aws.amazon.com/kms/latest/developerguide/policy-evaluation.html)。

## 步驟 4：更新現有資料表的加密金鑰
<a name="encryption.tutorial-update"></a>

您也可以使用 Amazon Keyspaces 主控台或 CQL 隨時變更 AWS 擁有的金鑰 和客戶受管 KMS 金鑰之間現有資料表的加密金鑰。

### 使用新的客戶受管金鑰更新現有的資料表 （主控台）
<a name="encryption.tutorial-update-console"></a>

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

1.  在導覽窗格中，選擇 **Tables** (資料表)。

1. 選擇您要更新的資料表，然後選擇**其他設定**索引標籤。

1. 在**靜態加密**區段中，選擇**管理加密**以編輯資料表的加密設定。

   在**選擇 AWS KMS key**下，選擇選項 **選擇不同的 KMS 金鑰 （進階）**，然後在搜尋欄位中選擇 AWS KMS key 或輸入 Amazon Resource Name (ARN)。
**注意**  
如果您選取的金鑰無效，請參閱《 AWS Key Management Service 開發人員指南》中的[對金鑰存取進行故障診斷](https://docs.aws.amazon.com/kms/latest/developerguide/policy-evaluation.html)。

   或者，您可以 AWS 擁有的金鑰 為使用客戶受管金鑰加密的資料表選擇 。

1. 選擇**儲存變更**以儲存您對資料表的變更。

### 更新用於現有資料表的加密金鑰
<a name="encryption.tutorial-update-cql"></a>

若要變更現有資料表的加密金鑰，您可以使用 `ALTER TABLE`陳述式來指定用於靜態加密的客戶受管金鑰。請務必使用授予 Amazon Keyspaces 之許可的有效金鑰的 ARN 取代金鑰 ARN。

```
ALTER TABLE my_keyspace.my_table WITH CUSTOM_PROPERTIES = {     
              'encryption_specification':{ 
                      'encryption_type': 'CUSTOMER_MANAGED_KMS_KEY', 
                      'kms_key_identifier':'arn:aws:kms:eu-west-1:5555555555555:key/11111111-1111-111-1111-111111111111'     
                  } 
         };
```

如果您收到 `Invalid Request Exception`，則需要確認客戶受管金鑰有效，且 Amazon Keyspaces 具有必要的許可。若要確認金鑰已正確設定，請參閱《 AWS Key Management Service 開發人員指南》中的對[金鑰存取進行故障診斷](https://docs.aws.amazon.com/kms/latest/developerguide/policy-evaluation.html)。

若要使用 將加密金鑰變更回預設靜態加密選項 AWS 擁有的金鑰，您可以使用 `ALTER TABLE`陳述式，如下列範例所示。

```
ALTER TABLE my_keyspace.my_table WITH CUSTOM_PROPERTIES = {
                'encryption_specification':{
                      'encryption_type' : 'AWS_OWNED_KMS_KEY' 
                    } 
         };
```

## 步驟 5：在日誌中使用 Amazon Keyspaces 加密內容
<a name="encryption-context"></a>

[加密內容](https://docs.aws.amazon.com/kms/latest/developerguide/encrypt_context.html)是一組金鑰/值對，其中包含任意非私密資料。當您在加密資料的請求中包含加密內容時， 會以 AWS KMS 加密方式將加密內容繫結至加密的資料。若要解密資料，您必須傳遞相同的加密內容。

Amazon Keyspaces 在所有 AWS KMS 密碼編譯操作中使用相同的加密內容。如果您使用[客戶受管金鑰](encryption.howitworks.md#customer-managed)來保護 Amazon Keyspaces 資料表，您可以使用加密內容來識別稽核記錄和日誌中客戶受管金鑰的使用。它也會以純文字顯示在日誌中，例如 [AWS CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html)和 [Amazon CloudWatch Logs ](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/WhatIsCloudWatchLogs.html)的日誌中。

在對 的請求中 AWS KMS，Amazon Keyspaces 使用具有三個鍵/值對的加密內容。

```
"encryptionContextSubset": {
    "aws:cassandra:keyspaceName": "my_keyspace",
    "aws:cassandra:tableName": "mytable"
    "aws:cassandra:subscriberId": "111122223333"
}
```
+ **金鑰空間** – 第一個金鑰/值對會識別包含 Amazon Keyspaces 正在加密之資料表的金鑰空間。金鑰為 `aws:cassandra:keyspaceName`。值是金鑰空間的名稱。

  ```
  "aws:cassandra:keyspaceName": "<keyspace-name>"
  ```

  例如：

  ```
  "aws:cassandra:keyspaceName": "my_keyspace"
  ```
+ **資料表** – 第二個金鑰/值對可識別 Amazon Keyspaces 正在加密的資料表。金鑰為 `aws:cassandra:tableName`。值是資料表的名稱。

  ```
  "aws:cassandra:tableName": "<table-name>"
  ```

  例如：

  ```
  "aws:cassandra:tableName": "my_table"
  ```
+ **帳戶** – 第三個鍵/值對識別 AWS 帳戶。金鑰為 `aws:cassandra:subscriberId`。值是帳戶 ID。

  ```
  "aws:cassandra:subscriberId": "<account-id>"
  ```

  例如：

  ```
  "aws:cassandra:subscriberId": "111122223333"
  ```

## 步驟 6：使用 設定監控 AWS CloudTrail
<a name="encryption-cmk-trail"></a>

如果您使用[客戶受管金鑰](encryption.howitworks.md#customer-managed)來保護 Amazon Keyspaces 資料表，您可以使用 AWS CloudTrail 日誌來追蹤 Amazon Keyspaces AWS KMS 代表您傳送給 的請求。

本節會討論 `GenerateDataKey`、`Decrypt`、 `DescribeKey`和 `CreateGrant`請求。此外，Amazon Keyspaces 會使用 [RetireGrant](https://docs.aws.amazon.com/kms/latest/APIReference/API_RetireGrant.html) 操作，在刪除資料表時移除授予。

**注意**  
當您使用 Amazon Keyspaces 時，某些操作可能會產生具有 `invokedBy` 欄位的 CloudTrail 事件`dynamodb.amazonaws.com`。這是預期會發生的，因為 Amazon Keyspaces 與 Amazon DynamoDB 整合以提供其服務。

**GenerateDataKey**  
Amazon Keyspaces 會建立唯一的資料表金鑰來加密靜態資料。它會將 *[GenerateDataKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_GenerateDataKey.html)* 請求傳送至 AWS KMS ，以指定資料表的 KMS 金鑰。  
記錄 `GenerateDataKey` 操作的事件類似於以下範例事件。使用者是 Amazon Keyspaces 服務帳戶。這些參數包括客戶受管金鑰的 Amazon Resource Name (ARN)、需要 256 位元金鑰的金鑰指標，以及識別金鑰空間、資料表和 的[加密內容](#encryption-context) AWS 帳戶。  

```
{
    "eventVersion": "1.08",
    "userIdentity": {
        "type": "AWSService",
        "invokedBy": "AWS Internal"
    },
    "eventTime": "2021-04-16T04:56:05Z",
    "eventSource": "kms.amazonaws.com",
    "eventName": "GenerateDataKey",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "AWS Internal",
    "userAgent": "AWS Internal",
    "requestParameters": {
        "keySpec": "AES_256",
        "encryptionContext": {
            "aws:cassandra:keyspaceName": "my_keyspace",
            "aws:cassandra:tableName": "my_table",
            "aws:cassandra:subscriberId": "123SAMPLE012"
        },
        "keyId": "arn:aws:kms:eu-west-1:5555555555555:key/11111111-1111-111-1111-111111111111"
    },
    "responseElements": null,
    "requestID": "5e8e9cb5-9194-4334-aacc-9dd7d50fe246",
    "eventID": "49fccab9-2448-4b97-a89d-7d5c39318d6f",
    "readOnly": true,
    "resources": [
        {
            "accountId": "123SAMPLE012",
            "type": "AWS::KMS::Key",
            "ARN": "arn:aws:kms:eu-west-1:5555555555555:key/11111111-1111-111-1111-111111111111"
        }
    ],
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "eventCategory": "Management",
    "recipientAccountId": "123SAMPLE012",
    "sharedEventID": "84fbaaf0-9641-4e32-9147-57d2cb08792e"
}
```

**DescribeKey**  
Amazon Keyspaces 使用 [DescribeKey](https://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html) 操作來判斷您選取的 KMS 金鑰是否存在於帳戶和區域中。  
記錄 `DescribeKey` 操作的事件類似於以下範例事件。使用者是 Amazon Keyspaces 服務帳戶。這些參數包括客戶受管金鑰的 ARN，以及需要 256 位元金鑰的金鑰指標。  

```
{
    "eventVersion": "1.08",
    "userIdentity": {
        "type": "IAMUser",
        "principalId": "AIDAZ3FNIIVIZZ6H7CFQG",
        "arn": "arn:aws:iam::123SAMPLE012:user/admin",
        "accountId": "123SAMPLE012",
        "accessKeyId": "AKIAIOSFODNN7EXAMPLE",
        "userName": "admin",
        "sessionContext": {
            "sessionIssuer": {},
            "webIdFederationData": {},
            "attributes": {
                "mfaAuthenticated": "false",
                "creationDate": "2021-04-16T04:55:42Z"
            }
        },
        "invokedBy": "AWS Internal"
    },
    "eventTime": "2021-04-16T04:55:58Z",
    "eventSource": "kms.amazonaws.com",
    "eventName": "DescribeKey",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "AWS Internal",
    "userAgent": "AWS Internal",
    "requestParameters": {
        "keyId": "arn:aws:kms:eu-west-1:5555555555555:key/11111111-1111-111-1111-111111111111"
    },
    "responseElements": null,
    "requestID": "c25a8105-050b-4f52-8358-6e872fb03a6c",
    "eventID": "0d96420e-707e-41b9-9118-56585a669658",
    "readOnly": true,
    "resources": [
        {
            "accountId": "123SAMPLE012",
            "type": "AWS::KMS::Key",
            "ARN": "arn:aws:kms:eu-west-1:5555555555555:key/11111111-1111-111-1111-111111111111"
        }
    ],
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "eventCategory": "Management",
    "recipientAccountId": "123SAMPLE012"
}
```

**解密**  
當您存取 Amazon Keyspaces 資料表時，Amazon Keyspaces 需要解密資料表金鑰，以便在階層中解密其下方的金鑰。然後解密資料表中的資料。若要解密資料表金鑰，Amazon Keyspaces 會將[解密](https://docs.aws.amazon.com/kms/latest/APIReference/API_Decrypt.html)請求傳送至 AWS KMS ，以指定資料表的 KMS 金鑰。  
記錄 `Decrypt` 操作的事件類似於以下範例事件。使用者是 中存取資料表 AWS 帳戶 的主體。這些參數包括加密的資料表金鑰 （做為加密文字 Blob)，以及識別資料表和 的[加密內容](#encryption-context) AWS 帳戶。 會從加密文字 AWS KMS 衍生客戶受管金鑰的 ID。  

```
{
    "eventVersion": "1.08",
    "userIdentity": {
        "type": "AWSService",
        "invokedBy": "AWS Internal"
    },
    "eventTime": "2021-04-16T05:29:44Z",
    "eventSource": "kms.amazonaws.com",
    "eventName": "Decrypt",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "AWS Internal",
    "userAgent": "AWS Internal",
    "requestParameters": {
        "encryptionContext": {
            "aws:cassandra:keyspaceName": "my_keyspace",
            "aws:cassandra:tableName": "my_table",
            "aws:cassandra:subscriberId": "123SAMPLE012"
        },
        "encryptionAlgorithm": "SYMMETRIC_DEFAULT"
    },
    "responseElements": null,
    "requestID": "50e80373-83c9-4034-8226-5439e1c9b259",
    "eventID": "8db9788f-04a5-4ae2-90c9-15c79c411b6b",
    "readOnly": true,
    "resources": [
        {
            "accountId": "123SAMPLE012",
            "type": "AWS::KMS::Key",
            "ARN": "arn:aws:kms:eu-west-1:5555555555555:key/11111111-1111-111-1111-111111111111"
        }
    ],
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "eventCategory": "Management",
    "recipientAccountId": "123SAMPLE012",
    "sharedEventID": "7ed99e2d-910a-4708-a4e3-0180d8dbb68e"
}
```

**CreateGrant**  
當您使用[客戶受管金鑰](encryption.howitworks.md#customer-managed)來保護 Amazon Keyspaces 資料表時，Amazon Keyspaces 會使用[授予](#encryption-grants)來允許服務執行持續的資料保護和維護和耐久性任務。在 上不需要這些授權[AWS 擁有的金鑰](encryption.howitworks.md#keyspaces-owned)。  
Amazon Keyspaces 建立的授予專屬於資料表。[CreateGrant](https://docs.aws.amazon.com/kms/latest/APIReference/API_CreateGrant.html) 請求中的主體是建立資料表的使用者。  
記錄 `CreateGrant` 操作的事件類似於以下範例事件。這些參數包括資料表的客戶受管金鑰 ARN、承授者委託人和淘汰委託人 (Amazon Keyspaces 服務），以及授予涵蓋的操作。它還包含需要所有加密操作使用指定[加密內容](#encryption-context)的限制。  

```
{
    "eventVersion": "1.08",
    "userIdentity": {
        "type": "IAMUser",
        "principalId": "AIDAZ3FNIIVIZZ6H7CFQG",
        "arn": "arn:aws:iam::arn:aws:kms:eu-west-1:5555555555555:key/11111111-1111-111-1111-111111111111:user/admin",
        "accountId": "arn:aws:kms:eu-west-1:5555555555555:key/11111111-1111-111-1111-111111111111",
        "accessKeyId": "AKIAI44QH8DHBEXAMPLE",
        "userName": "admin",
        "sessionContext": {
            "sessionIssuer": {},
            "webIdFederationData": {},
            "attributes": {
                "mfaAuthenticated": "false",
                "creationDate": "2021-04-16T04:55:42Z"
            }
        },
        "invokedBy": "AWS Internal"
    },
    "eventTime": "2021-04-16T05:11:10Z",
    "eventSource": "kms.amazonaws.com",
    "eventName": "CreateGrant",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "AWS Internal",
    "userAgent": "AWS Internal",
    "requestParameters": {
        "keyId": "a7d328af-215e-4661-9a69-88c858909f20",
        "operations": [
            "DescribeKey",
            "GenerateDataKey",
            "Decrypt",
            "Encrypt",
            "ReEncryptFrom",
            "ReEncryptTo",
            "RetireGrant"
        ],
        "constraints": {
            "encryptionContextSubset": {
                "aws:cassandra:keyspaceName": "my_keyspace",
                "aws:cassandra:tableName": "my_table",
                "aws:cassandra:subscriberId": "123SAMPLE012"
            }
        },
        "retiringPrincipal": "cassandratest.us-east-1.amazonaws.com",
        "granteePrincipal": "cassandratest.us-east-1.amazonaws.com"
    },
    "responseElements": {
        "grantId": "18e4235f1b07f289762a31a1886cb5efd225f069280d4f76cd83b9b9b5501013"
    },
    "requestID": "b379a767-1f9b-48c3-b731-fb23e865e7f7",
    "eventID": "29ee1fd4-28f2-416f-a419-551910d20291",
    "readOnly": false,
    "resources": [
        {
            "accountId": "123SAMPLE012",
            "type": "AWS::KMS::Key",
            "ARN": "arn:aws:kms:eu-west-1:5555555555555:key/11111111-1111-111-1111-111111111111"
        }
    ],
    "eventType": "AwsApiCall",
    "managementEvent": true,
    "eventCategory": "Management",
    "recipientAccountId": "123SAMPLE012"
}
```

# 在 Amazon Keyspaces 中傳輸中的加密
<a name="encryption-in-transit"></a>

Amazon Keyspaces 只接受使用 Transport Layer Security (TLS) 的安全連線。傳輸中加密可在資料往返 Amazon Keyspaces 時加密資料，以提供多一層的資料保護。組織政策、產業或政府法規以及合規要求通常需要使用傳輸中的加密，以在應用程式透過網路傳輸資料時提高其資料安全性。

若要了解如何使用 TLS 加密 Amazon Keyspaces 的`cqlsh`連線，請參閱 [如何手動設定 TLS 的`cqlsh`連線](programmatic.cqlsh.md#encrypt_using_tls)。若要了解如何搭配用戶端驅動程式使用 TLS 加密，請參閱 [使用 Cassandra 用戶端驅動程式以程式設計方式存取 Amazon Keyspaces](programmatic.drivers.md)。

# Amazon Keyspaces 中的網際網路流量隱私權
<a name="inter-network-traffic-privacy"></a>

本主題說明 Amazon Keyspaces （適用於 Apache Cassandra) 如何保護從內部部署應用程式到 Amazon Keyspaces 以及 Amazon Keyspaces 和相同 內其他 AWS 資源之間的連線 AWS 區域。

## 服務和內部部署用戶端與應用程式之間的流量。
<a name="inter-network-traffic-privacy-on-prem"></a>

您的私有網路與 之間有兩個連線選項 AWS：
+  AWS Site-to-Site VPN 連線。如需詳細資訊，請參閱《 AWS Site-to-Site VPN使用者指南**》中的[什麼是AWS Site-to-Site VPN ？](https://docs.aws.amazon.com/vpn/latest/s2svpn/VPC_VPN.html)。
+  Direct Connect 連線。如需詳細資訊，請參閱《 Direct Connect使用者指南**》中的[什麼是Direct Connect ？](https://docs.aws.amazon.com/directconnect/latest/UserGuide/Welcome.html)。

Amazon Keyspaces （適用於 Apache Cassandra) 是受管服務，受到 AWS 全球網路安全的保護。如需 AWS 安全服務以及如何 AWS 保護基礎設施的資訊，請參閱[AWS 雲端安全](https://aws.amazon.com/security/)。若要使用基礎設施安全的最佳實務設計您的 AWS 環境，請參閱*安全支柱 AWS Well-Architected Framework* 中的[基礎設施保護](https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/infrastructure-protection.html)。

您可以使用 AWS 發佈的 API 呼叫，透過網路存取 Amazon Keyspaces。使用者端必須支援下列專案：
+ Transport Layer Security (TLS)。我們需要 TLS 1.2 並建議使用 TLS 1.3。
+ 具備完美轉送私密(PFS)的密碼套件，例如 DHE (Ephemeral Diffie-Hellman)或 ECDHE (Elliptic Curve Ephemeral Diffie-Hellman)。現代系統(如 Java 7 和更新版本)大多會支援這些模式。

Amazon Keyspaces 支援兩種驗證用戶端請求的方法。第一個方法使用服務特定的登入資料，這是針對特定 IAM 使用者產生的密碼型登入資料。您可以使用 IAM 主控台、 AWS CLI或 AWS API 來建立和管理密碼。如需詳細資訊，請參閱[搭配 Amazon Keyspaces 使用 IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mcs.html)。

第二個方法針對 Cassandra 的開放原始碼 DataStax Java 驅動程式使用身分驗證外掛程式。此外掛程式可讓 [IAM 使用者、角色和聯合身分](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)使用 [AWS Signature 第 4 版程序 (SigV4)，將身分驗證資訊新增至 Amazon Keyspaces （適用於 Apache Cassandra) API ](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html)請求。如需詳細資訊，請參閱[建立和設定 Amazon Keyspaces 的 AWS 登入資料](access.credentials.md)。

## 相同區域中 AWS 資源之間的流量
<a name="inter-network-traffic-privacy-within-region"></a>

介面 VPC 端點可讓您在 Amazon VPC 和 Amazon Keyspaces 中執行的虛擬私有雲端 (VPC) 之間進行私有通訊。介面 VPC 端點由 提供支援 AWS PrivateLink，該 AWS 服務可啟用 VPCs和 AWS 服務之間的私有通訊。透過在您的 VPC 中使用具有私有 IPs彈性網路介面來 AWS PrivateLink 啟用此功能，以便網路流量不會離開 Amazon 網路。介面 VPC 端點不需要網際網路閘道、NAT 裝置、VPN 連線或 Direct Connect 連線。如需詳細資訊，請參閱 [Amazon Virtual Private Cloud](https://docs.aws.amazon.com/vpc/latest/userguide/) 和[界面 VPC 端點 (AWS PrivateLink)](https://docs.aws.amazon.com/vpc/latest/privatelink/vpce-interface.html)。如需範例政策，請參閱 [使用 Amazon Keyspaces 的介面 VPC 端點](vpc-endpoints.md#using-interface-vpc-endpoints)。

# 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)。

# Amazon Keyspaces 的合規驗證 （適用於 Apache Cassandra)
<a name="Keyspaces-compliance"></a>

在多個合規計畫中，第三方稽核人員會評估 Amazon Keyspaces （適用於 Apache Cassandra) 的安全性和 AWS 合規性。其中包含：
+ ISO/IEC 27001：2013、27017：2015、27018：2019 和 ISO/IEC 9001：2015。如需詳細資訊，請參閱 [AWS ISO 和 CSA STAR 認證和服務](https://aws.amazon.com/compliance/iso-certified/)。
+ 系統和組織控制 (SOC)
+ 支付卡產業 (PCI)
+ 聯邦風險與授權管理計劃 (FedRAMP) 高
+ 美國健康保險流通與責任法案 (HIPAA)

若要了解 是否 AWS 服務 在特定合規計劃範圍內，請參閱[AWS 服務 合規計劃範圍內](https://aws.amazon.com/compliance/services-in-scope/)然後選擇您感興趣的合規計劃。如需一般資訊，請參閱[AWS 合規計劃](https://aws.amazon.com/compliance/programs/)。

您可以使用 下載第三方稽核報告 AWS Artifact。如需詳細資訊，請參閱[下載報告下載 AWS Artifact](https://docs.aws.amazon.com/artifact/latest/ug/downloading-documents.html)。

您使用 時的合規責任 AWS 服務 取決於資料的機密性、您公司的合規目標，以及適用的法律和法規。如需使用 時合規責任的詳細資訊 AWS 服務，請參閱 [AWS 安全文件](https://docs.aws.amazon.com/security/)。

# Amazon Keyspaces 中的彈性和災難復原
<a name="disaster-recovery-resiliency"></a>

 AWS 全球基礎設施是以 AWS 區域 和 可用區域為基礎建置。 AWS 區域 提供多個實體分隔和隔離的可用區域，這些可用區域與低延遲、高輸送量和高備援聯網連接。透過可用區域，您所設計與操作的應用程式和資料庫，就能夠在可用區域之間自動容錯移轉，而不會發生中斷。可用區域的可用性、容錯能力和擴充能力，均較單一或多個資料中心的傳統基礎設施還高。

Amazon Keyspaces 會在相同區域內的多個 AWS 可用區域中自動複寫資料三次， AWS 區域 以提供耐用性和高可用性。

如需 AWS 區域 和可用區域的詳細資訊，請參閱 [AWS 全球基礎設施](https://aws.amazon.com/about-aws/global-infrastructure/)。

除了 AWS 全球基礎設施之外，Amazon Keyspaces 還提供數種功能，以協助支援您的資料彈性和備份需求。

**多區域複寫**  
如果您需要在更大的地理距離上複寫資料或應用程式，Amazon Keyspaces 會提供多區域複寫。您可以將 Amazon Keyspaces 資料表複寫到 AWS 區域 您選擇的不同位置。如需詳細資訊，請參閱[Amazon Keyspaces 的多區域複寫 （適用於 Apache Cassandra)](multiRegion-replication.md)。

**Point-in-time(PITR)**  
PITR 透過提供資料表資料的連續備份，協助保護您的 Amazon Keyspaces 資料表免於意外寫入或刪除操作。如需詳細資訊，請參閱 [Point-in-time復原](https://docs.aws.amazon.com/keyspaces/latest/devguide/PointInTimeRecovery.html)。

# Amazon Keyspaces 中的基礎設施安全性
<a name="infrastructure-security"></a>

Amazon Keyspaces （適用於 Apache Cassandra) 是受管服務，受到 AWS 全球網路安全的保護。如需 AWS 安全服務以及 如何 AWS 保護基礎設施的相關資訊，請參閱[AWS 雲端安全](https://aws.amazon.com/security/)。若要使用基礎設施安全的最佳實務設計您的 AWS 環境，請參閱*安全支柱 AWS Well-Architected Framework* 中的[基礎設施保護](https://docs.aws.amazon.com/wellarchitected/latest/security-pillar/infrastructure-protection.html)。

您可以使用 AWS 發佈的 API 呼叫，透過網路存取 Amazon Keyspaces。使用者端必須支援下列專案：
+ Transport Layer Security (TLS)。我們需要 TLS 1.2 並建議使用 TLS 1.3。
+ 具備完美轉送私密(PFS)的密碼套件，例如 DHE (Ephemeral Diffie-Hellman)或 ECDHE (Elliptic Curve Ephemeral Diffie-Hellman)。現代系統(如 Java 7 和更新版本)大多會支援這些模式。

Amazon Keyspaces 支援兩種驗證用戶端請求的方法。第一個方法使用服務特定的登入資料，這是針對特定 IAM 使用者產生的密碼型登入資料。您可以使用 IAM 主控台、 AWS CLI或 AWS API 來建立和管理密碼。如需詳細資訊，請參閱[搭配 Amazon Keyspaces 使用 IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mcs.html)。

第二個方法針對 Cassandra 的開放原始碼 DataStax Java 驅動程式使用身分驗證外掛程式。此外掛程式可讓 [IAM 使用者、角色和聯合身分](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)使用 [AWS Signature 第 4 版程序 (SigV4)，將身分驗證資訊新增至 Amazon Keyspaces （適用於 Apache Cassandra) API ](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html)請求。如需詳細資訊，請參閱[建立和設定 Amazon Keyspaces 的 AWS 登入資料](access.credentials.md)。

您可以從任何網路位置呼叫這些 API 操作，但 Amazon Keyspaces 支援以資源為基礎的存取政策，其中可能包含根據來源 IP 地址的限制。您也可以使用 Amazon Keyspaces 政策來控制來自特定 Amazon Virtual Private Cloud (Amazon VPC) 端點或特定 VPCs存取。實際上，這只會隔離網路中特定 VPC 對指定 Amazon Keyspaces 資源 AWS 的網路存取。

您可以使用介面 VPC 端點來防止 Amazon VPC 和 Amazon Keyspaces 之間的流量離開 Amazon 網路。介面 VPC 端點採用一種 AWS 技術 AWS PrivateLink，可讓您在 Amazon VPC 中使用具有私有 IPs彈性網路介面，在 AWS 服務之間進行私有通訊。如需詳細資訊，請參閱[搭配界面 VPC 端點使用 Amazon Keyspaces](vpc-endpoints.md)。

# 搭配界面 VPC 端點使用 Amazon Keyspaces
<a name="vpc-endpoints"></a>

介面 VPC 端點可在 Amazon VPC 和 Amazon Keyspaces 中執行的虛擬私有雲端 (VPC) 之間啟用私有通訊。介面 VPC 端點採用 技術 AWS PrivateLink，這是一種 AWS 可在 VPCs和服務 AWS 之間進行私有通訊的服務。

AWS PrivateLink 透過在您的 VPC 中使用具有私有 IP 地址的彈性網路介面來啟用此功能，以便網路流量不會離開 Amazon 網路。介面 VPC 端點不需要網際網路閘道、NAT 裝置、VPN 連接或是 Direct Connect 連線。如需詳細資訊，請參閱 [Amazon Virtual Private Cloud](https://docs.aws.amazon.com/vpc/latest/userguide/) 和[介面 VPC 端點 (AWS PrivateLink)](https://docs.aws.amazon.com/vpc/latest/privatelink/vpce-interface.html)。

**Topics**
+ [使用 Amazon Keyspaces 的介面 VPC 端點](#using-interface-vpc-endpoints)
+ [使用界面 VPC 端點資訊填入`system.peers`資料表項目](#system_peers)
+ [控制對 Amazon Keyspaces 介面 VPC 端點的存取](#interface-vpc-endpoints-policies)
+ [可用性](#availability)
+ [VPC 端點政策和 Amazon Keyspaces point-in-time(PITR)](#VPC_PITR_restore)
+ [常見錯誤和警告](#vpc_troubleshooting)

## 使用 Amazon Keyspaces 的介面 VPC 端點
<a name="using-interface-vpc-endpoints"></a>

您可以建立介面 VPC 端點，讓 Amazon Keyspaces 和 Amazon VPC 資源之間的流量開始流經介面 VPC 端點。若要開始使用，請依照步驟[建立介面端點](https://docs.aws.amazon.com/vpc/latest/privatelink/vpce-interface.html#create-interface-endpoint)。接著，編輯與您在上一個步驟中建立的端點相關聯的安全群組，並設定連接埠 9142 的傳入規則。如需詳細資訊，請參閱[新增、移除和更新規則](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html#AddRemoveRules)。

如需透過 VPC 端點設定 Amazon Keyspaces 連線的step-by-step教學課程，請參閱 [教學課程：使用介面 VPC 端點連線至 Amazon Keyspaces](vpc-endpoints-tutorial.md)。若要了解如何為 Amazon Keyspaces 資源設定跨帳戶存取，這些資源與 VPC AWS 帳戶 中不同的應用程式分開，請參閱 [使用 VPC 端點設定 Amazon Keyspaces 的跨帳戶存取權](access.cross-account.md)。

## 使用界面 VPC 端點資訊填入`system.peers`資料表項目
<a name="system_peers"></a>

Apache Cassandra 驅動程式使用 `system.peers`資料表來查詢叢集的節點資訊。Cassandra 驅動程式使用節點資訊來負載平衡連線和重試操作。Amazon Keyspaces 會自動為透過公有端點連線的用戶端填入`system.peers`資料表中的九個項目。

為了為透過介面 VPC 端點連線的用戶端提供類似的功能，Amazon Keyspaces 會使用 VPC 端點可用的每個可用區域的項目填入您帳戶中的`system.peers`資料表。若要在 `system.peers` 資料表中查詢和存放可用的介面 VPC 端點，Amazon Keyspaces 會要求您授予 IAM 實體用於連線至 Amazon Keyspaces 的存取許可，以查詢 VPC 以取得端點和網路介面資訊。

**重要**  
使用可用的界面 VPC 端點填入`system.peers`資料表可改善負載平衡並提高讀取/寫入輸送量。建議使用介面 VPC 端點存取 Amazon Keyspaces 的所有用戶端，Apache Spark 需要此端點。

若要授予用於連線至 Amazon Keyspaces 的 IAM 實體許可，以查詢必要的介面 VPC 端點資訊，您可以更新現有的 IAM 角色或使用者政策，或建立新的 IAM 政策，如下列範例所示。

```
{
   "Version":"2012-10-17",		 	 	 
   "Statement":[
      {
         "Sid":"ListVPCEndpoints",
         "Effect":"Allow",
         "Action":[
            "ec2:DescribeNetworkInterfaces",
            "ec2:DescribeVpcEndpoints"
         ],
         "Resource":"*"
      }
   ]
}
```

**注意**  
受管政策`AmazonKeyspacesReadOnlyAccess_v2`並`AmazonKeyspacesFullAccess`包含必要許可，讓 Amazon Keyspaces 存取 Amazon EC2 執行個體，以讀取可用介面 VPC 端點的相關資訊。

若要確認政策已正確設定，請查詢 `system.peers` 資料表以查看聯網資訊。如果`system.peers`資料表為空，則可能表示政策未成功設定，或您已超過 `DescribeNetworkInterfaces`和 `DescribeVPCEndpoints` API 動作的請求率配額。 `DescribeVPCEndpoints` 屬於 `Describe*`類別，並視為*非變動動作*。 `DescribeNetworkInterfaces` 屬於*未篩選和未分頁的非變動動作*子集，且適用不同的配額。如需詳細資訊，請參閱《Amazon EC2 API 參考》中的[請求字符儲存貯體大小和重新填充率](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/throttling.html#throttling-limits-rate-based)。

如果您確實看到空白資料表，請在幾分鐘後再試一次，以排除請求率配額問題。若要驗證您已正確設定 VPC 端點，請參閱 [我的 VPC 端點連線無法正常運作](troubleshooting.connecting.md#troubleshooting.connection.vpce)。如果您的查詢傳回資料表的結果，表示您的政策已正確設定。



## 控制對 Amazon Keyspaces 介面 VPC 端點的存取
<a name="interface-vpc-endpoints-policies"></a>

使用 VPC 端點政策，您可以透過兩種方式控制對 資源的存取：
+ **IAM 政策** – 您可以透過特定 VPC 端點控制允許存取 Amazon Keyspaces 的請求、使用者或群組。您可以在連接到 IAM 使用者、群組或角色的政策中使用[條件索引鍵](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)來執行此操作。
+ **VPC 政策** – 您可以將政策連接至 Amazon Keyspaces 資源，以控制哪些 VPC 端點可存取這些資源。若要限制對特定金鑰空間或資料表的存取，只允許流經特定 VPC 端點的流量，請編輯限制資源存取的現有 IAM 政策，並新增該 VPC 端點。



以下是存取 Amazon Keyspaces 資源的範例端點政策。
+ **IAM 政策範例：限制對特定 Amazon Keyspaces 資料表的所有存取，除非流量來自指定的 VPC 端點** – 此範例政策可以連接到 IAM 使用者、角色或群組。除非傳入流量來自指定的 VPC 端點，否則它會限制對指定 Amazon Keyspaces 資料表的存取。

  ```
  {
     "Version": "2012-10-17",		 	 	 
     "Statement": [
        {
           "Sid": "UserOrRolePolicyToDenyAccess",
           "Action": "cassandra:*",
           "Effect": "Deny",
           "Resource": [
                          "arn:aws:cassandra:us-east-1:111122223333:/keyspace/mykeyspace/table/mytable",
                          "arn:aws:cassandra:us-east-1:111122223333:/keyspace/system*"
             ],
           "Condition": { "StringNotEquals" : { "aws:sourceVpce": "vpce-abc123" } }
        }
     ]
  }
  ```
**注意**  
若要限制對特定資料表的存取，您還必須包含對系統資料表的存取。系統資料表為唯讀。
+ **VPC 政策範例：唯讀存取** – 此範例政策可以連接到 VPC 端點。（如需詳細資訊，請參閱[控制對 Amazon VPC 資源的存取](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints-access.html#vpc-endpoint-policies))。它限制動作透過其連接的 VPC 端點唯讀存取 Amazon Keyspaces 資源。

  ```
  {
    "Version": "2012-10-17",		 	 	 
    "Statement": [
      {
        "Sid": "ReadOnly",
        "Principal": "*",
        "Action": [
          "cassandra:Select"
        ],
        "Effect": "Allow",
        "Resource": "*"
      }
    ]
  }
  ```
+ **VPC 政策範例：限制對特定 Amazon Keyspaces 資料表的存取** – 此範例政策可以連接到 VPC 端點。它透過其連接的 VPC 端點限制對特定資料表的存取。

  ```
  {
     "Version": "2012-10-17",		 	 	 
     "Statement": [
          {
              "Sid": "RestrictAccessToTable",
              "Principal": "*",
              "Action": "cassandra:*",
              "Effect": "Allow",
              "Resource": [
                          "arn:aws:cassandra:us-east-1:111122223333:/keyspace/mykeyspace/table/mytable",
                          "arn:aws:cassandra:us-east-1:111122223333:/keyspace/system*"
             ]
          }
     ]
  }
  ```
**注意**  
若要限制對特定資料表的存取，您還必須包含對系統資料表的存取。系統資料表為唯讀。

## 可用性
<a name="availability"></a>

Amazon Keyspaces 支援在所有提供服務 AWS 區域 的 中使用介面 VPC 端點。如需詳細資訊，請參閱[Amazon Keyspaces 的服務端點](programmatic.endpoints.md)。

## VPC 端點政策和 Amazon Keyspaces point-in-time(PITR)
<a name="VPC_PITR_restore"></a>

如果您使用 IAM 政策搭配[條件索引鍵](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)來限制傳入流量，資料表還原操作可能會失敗。例如，如果您使用`aws:SourceVpce`條件索引鍵將來源流量限制在特定 VPC 端點，資料表還原操作會失敗。若要允許 Amazon Keyspaces 代表委託人執行還原操作，您必須將 `aws:ViaAWSService` 條件金鑰新增至 IAM 政策。當任何 AWS 服務使用委託人的登入資料提出請求時，`aws:ViaAWSService`條件金鑰允許存取。如需詳細資訊，請參閱《[IAM 使用者指南》中的 IAM JSON 政策元素：條件索引鍵](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html)。 **下列政策為範例。

```
{
   "Version":"2012-10-17",		 	 	 
   "Statement":[
      {
         "Sid":"CassandraAccessForVPCE",
         "Effect":"Allow",
         "Action":"cassandra:*",
         "Resource":"*",
         "Condition":{
            "Bool":{
               "aws:ViaAWSService":"false"
            },
            "StringEquals":{
               "aws:SourceVpce":[
                  "vpce-12345678901234567"
               ]
            }
         }
      },
      {
         "Sid":"CassandraAccessForAwsService",
         "Effect":"Allow",
         "Action":"cassandra:*",
         "Resource":"*",
         "Condition":{
            "Bool":{
               "aws:ViaAWSService":"true"
            }
         }
      }
   ]
}
```

## 常見錯誤和警告
<a name="vpc_troubleshooting"></a>

**如果您使用 Amazon Virtual Private Cloud 並連線至 Amazon Keyspaces，您可能會看到下列警告。**

```
Control node cassandra.us-east-1.amazonaws.com/1.111.111.111:9142 has an entry for itself in system.peers: this entry will be ignored. This is likely due to a misconfiguration; 
please verify your rpc_address configuration in cassandra.yaml on all nodes in your cluster.
```

發生此警告是因為`system.peers`資料表包含 Amazon Keyspaces 有權檢視之所有 Amazon VPC 端點的項目，包括您連線的 Amazon VPC 端點。您可以安全地忽略此警告。

如需其他錯誤，請參閱 [我的 VPC 端點連線無法正常運作](troubleshooting.connecting.md#troubleshooting.connection.vpce)。

# 搭配介面 VPC 端點使用 Amazon Keyspaces CDC 串流
<a name="vpc-endpoints-streams"></a>

介面 VPC 端點可讓您在 Amazon VPC 和 Amazon Keyspaces 中執行的虛擬私有雲端 (VPC) 之間進行私有通訊。介面 VPC 端點採用 技術 AWS PrivateLink，這是一種 AWS 可在 VPCs和服務 AWS 之間進行私有通訊的服務。

AWS PrivateLink 會透過在您的 VPC 中使用具有私有 IP 地址的彈性網路介面來啟用此功能，讓網路流量不會離開 Amazon 網路。介面 VPC 端點不需要網際網路閘道、NAT 裝置、VPN 連接或是 Direct Connect 連線。如需詳細資訊，請參閱 [Amazon Virtual Private Cloud](https://docs.aws.amazon.com/vpc/latest/userguide/) 和[介面 VPC 端點 (AWS PrivateLink)](https://docs.aws.amazon.com/vpc/latest/privatelink/vpce-interface.html)。

**Topics**
+ [使用 Amazon Keyspaces CDC 串流的介面 VPC 端點](#using-interface-vpc-endpoints-streams)
+ [Amazon Keyspaces CDC 串流介面 VPC 端點](#interface-vpc-endpoints-streams-types)
+ [建立 Amazon Keyspaces CDC 串流介面 VPC 端點](#create-interface-vpc-endpoints-streams)
+ [更新 Amazon Keyspaces CDC 串流介面 VPC 端點](#update-interface-vpc-endpoints-streams)
+ [使用 Amazon Keyspaces CDC 串流介面 VPC 端點列出串流](#list-interface-vpc-endpoints-streams)
+ [為 Amazon Keyspaces CDC 串流介面 VPC 端點建立政策](#interface-vpc-endpoints-streams-policy)

## 使用 Amazon Keyspaces CDC 串流的介面 VPC 端點
<a name="using-interface-vpc-endpoints-streams"></a>

您可以使用介面 VPC 端點，讓 Amazon Keyspaces CDC 串流與 Amazon VPC 資源之間的流量開始流經介面 VPC 端點。您可以使用 VPC 端點政策來限制對 CDC 串流的存取。

如需 Amazon Keyspaces CDC 串流的詳細資訊，請參閱 [在 Amazon Keyspaces 中使用變更資料擷取 (CDC) 串流](cdc.md)。

## Amazon Keyspaces CDC 串流介面 VPC 端點
<a name="interface-vpc-endpoints-streams-types"></a>

當您建立介面端點時，Amazon Keyspaces CDC 串流會為串流產生兩種類型的端點特定 DNS 名稱：*區域*和*區域*。

**區域性**  
區域 DNS 名稱包含下列資訊：  
+ 唯一的 Amazon VPC 端點 ID
+ 服務識別符
+ 的 AWS 區域
+ `vpce.amazonaws.com` 尾碼
對於 ID 為 的 Amazon VPC 端點`vpce-1a2b3c4d`，產生的 DNS 名稱可能看起來類似下列範例：`vpce-1a2b3c4d-5e6f.cassandra-streams.us-east-1.vpce.amazonaws.com`。

**區域**  
除了區域 DNS 名稱中的資訊之外，區域 DNS 名稱還包含[可用區域](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/)。具有 ID 的 Amazon VPC 端點所產生的 DNS 名稱`vpce-1a2b3c4d`看起來如下範例所示，請注意， AWS 區域 現在包含可用區域： `vpce-1a2b3c4d-5e6f-us-east-1a.cassandra-streams.us-east-1.vpce.amazonaws.com`  
如果您的架構隔離可用區域，您可以使用此選項。例如，您可以將其用於故障遏止或降低區域資料傳輸成本。  
為了獲得最佳可靠性，建議您將服務部署到至少三個可用區域。

## 建立 Amazon Keyspaces CDC 串流介面 VPC 端點
<a name="create-interface-vpc-endpoints-streams"></a>

您可以使用 AWS CLI 或 AWS SDK，透過 Amazon Keyspaces CDC Streams 介面端點存取 Amazon Keyspaces CDC Streams API 操作。如需所有可用 API 操作的完整清單，請參閱 [https://docs.aws.amazon.com/keyspaces/latest/StreamsAPIReference/Welcome.html](https://docs.aws.amazon.com/keyspaces/latest/StreamsAPIReference/Welcome.html)。

如需如何建立 VPC 端點的詳細資訊，請參閱《Amazon VPC 使用者指南》中的[建立介面端點](https://docs.aws.amazon.com/vpc/latest/privatelink/vpce-interface.html#create-interface-endpoint)。

若要建立 VPC 端點，您可以在下列範例中使用 語法。

```
aws ec2 create-vpc-endpoint \
  --region us-east-1 \
  --service-name api.aws.us-east-1.cassandra-streams \
  --vpc-id client-vpc-id \
  --subnet-ids client-subnet-id \
  --vpc-endpoint-type Interface \
  --security-group-ids client-sg-id
```

## 更新 Amazon Keyspaces CDC 串流介面 VPC 端點
<a name="update-interface-vpc-endpoints-streams"></a>

若要更新 VPC 端點，您可以在下列範例中使用 語法。

```
aws ec2 modify-vpc-endpoint \
  --region us-east-1 \
  --vpc-endpoint-id client-vpc-id \
  --policy-document policy-document \ #example optional parameter
  --add-security-group-ids security-group-ids \ #example optional parameter
```

## 使用 Amazon Keyspaces CDC 串流介面 VPC 端點列出串流
<a name="list-interface-vpc-endpoints-streams"></a>

若要列出使用 VPC 端點的串流，您可以使用下列範例中的語法。請務必使用您自己的資訊取代 VPC 端點 ID 的區域和 DNS 名稱。

```
aws keyspacesstreams \
  --endpoint https://vpce-1a2b3c4d-5e6f.cassandra-streams.us-east-1.vpce.amazonaws.com \
  --region us-east-1 \
  list-streams
```

## 為 Amazon Keyspaces CDC 串流介面 VPC 端點建立政策
<a name="interface-vpc-endpoints-streams-policy"></a>

您可以將端點政策連接至 Amazon VPC 端點，以控制對 Amazon Keyspaces CDC 串流的存取。此政策會指定下列資訊：
+ 可執行動作的 AWS Identity and Access Management (IAM) 委託人
+ 可執行的動作
+ 可在其中執行動作的資源

若要限制對特定 Amazon Keyspaces CDC 串流的存取，使其僅允許 Amazon VPC 存取中的特定 AWS 服務，您可以使用下列範例。

下列串流政策會針對 動作`cassandra:GetStream`和`2025-02-20T11:22:33.444`連接至`/keyspace/mykeyspace/table/mytable/`屬於帳戶 之資源`cassandra:GetRecords`的指定串流，授予任何 IAM 主體的存取權`123456788901`。若要使用此端點政策，請務必使用串流標籤取代區域、帳戶 ID 和資源。

```
{
"Version": "2012-10-17",		 	 	 
  "Id": "Policy1216114807515",
  "Statement": [
    { "Sid": "Access-to-specific-stream-only",
      "Principal": "*",
      "Action": [
        "cassandra:GetStream",
        "cassandra:GetRecords"
      ],
      "Effect": "Allow",
      "Resource": ["arn:aws:cassandra:us-east-1:111122223333:/keyspace/mykeyspace/table/mytable/stream/2025-02-20T11:22:33.444"]
    }
  ]
}
```

**注意**  
Amazon Keyspaces 不支援 CDC 串流的閘道端點。

# Amazon Keyspaces 的組態和漏洞分析
<a name="configuration-vulnerability"></a>

AWS 處理基本安全任務，例如訪客作業系統 (OS) 和資料庫修補、防火牆組態和災難復原。這些程序已由適當的第三方進行檢閱並認證。如需詳細資訊，請參閱以下資源：
+ [共同責任模型](https://aws.amazon.com/compliance/shared-responsibility-model/) 
+ [Amazon Web Services：安全程序概觀](https://d0.awsstatic.com/whitepapers/Security/AWS_Security_Whitepaper.pdf) (白皮書) 

# Amazon Keyspaces 的安全最佳實務
<a name="best-practices-security"></a>

Amazon Keyspaces （適用於 Apache Cassandra) 提供許多安全功能，供您在開發和實作自己的安全政策時考慮。以下最佳實務為一般準則，並不代表完整的安全解決方案。這些最佳實務可能不適用或無法滿足您的環境需求，因此請將其視為實用建議就好，而不要當作是指示。

**Topics**
+ [Amazon Keyspaces 的預防性安全最佳實務](best-practices-security-preventative.md)
+ [Amazon Keyspaces 的偵測安全最佳實務](best-practices-security-detective.md)

# Amazon Keyspaces 的預防性安全最佳實務
<a name="best-practices-security-preventative"></a>

下列安全最佳實務被視為預防性的，因為它們可協助您預測和防止 Amazon Keyspaces 中的安全事件。

**使用靜態加密**  
Amazon Keyspaces 會使用存放在 [AWS Key Management Service (AWS KMS)](https://aws.amazon.com/kms/) 中的加密金鑰，對存放在資料表中的所有使用者資料進行靜態加密。如此可透過保護您的資料免於發生未經授權的基礎儲存體存取，為資料提供另一層保護。  
根據預設，Amazon Keyspaces 會使用 AWS 擁有的金鑰 來加密所有資料表。如果此金鑰不存在，則會為您建立。無法停用服務預設金鑰。  
或者，您可以使用[客戶受管金鑰](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk)進行靜態加密。如需詳細資訊，請參閱 [Amazon Keyspaces 靜態加密](https://docs.aws.amazon.com/keyspaces/latest/devguide/EncryptionAtRest.html)。

**使用 IAM 角色來驗證對 Amazon Keyspaces 的存取**  
對於存取 Amazon Keyspaces 的使用者、應用程式和其他 AWS 服務，他們必須在其 AWS API 請求中包含有效的 AWS 登入資料。您不應將 AWS 登入資料直接存放在應用程式或 EC2 執行個體中。這些是不會自動輪換的長期憑證，因此如果遭到盜用，可能會對業務造成嚴重的影響。IAM 角色可讓您取得臨時存取金鑰，用於存取 AWS 服務和資源。  
如需詳細資訊，請參閱 [IAM 角色](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html)。

**針對 Amazon Keyspaces 基本授權使用 IAM 政策**  
授予許可時，您可以決定取得許可的人員、他們取得許可的 Amazon Keyspaces APIs，以及您想要在這些資源上允許的特定動作。實作最低權限是降低安全風險和可能因錯誤或惡意意圖而產生之影響的關鍵。  
將許可政策連接至 IAM 身分 （即使用者、群組和角色），藉此授予在 Amazon Keyspaces 資源上執行操作的許可。  
您可以使用下列內容執行這項作業：  
+ [AWS 受管 （預先定義） 政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#aws-managed-policies)
+ [客戶管理政策](https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_managed-vs-inline.html#customer-managed-policies)

**使用 IAM 政策條件進行精細定義存取控制**  
當您在 Amazon Keyspaces 中授予許可時，您可以指定決定許可政策如何生效的條件。實作最低權限是降低安全風險和可能因錯誤或惡意意圖而產生之影響的關鍵。  
您可以指定使用 IAM 政策授予許可時的條件。例如，您可以執行下列動作：  
+ 授予許可，以允許使用者唯讀存取特定金鑰空間或資料表。
+ 根據使用者的身分，授予許可以允許使用者寫入存取特定資料表。
 如需詳細資訊，請參閱以[身分為基礎的政策範例](https://docs.aws.amazon.com/keyspaces/latest/devguide/security_iam_id-based-policy-examples.html)。

**考慮用戶端加密**  
如果您在 Amazon Keyspaces 中存放敏感或機密資料，建議您盡可能將資料加密至接近其原始伺服器的位置，以便在整個生命週期內保護您的資料。將您傳輸中和靜態的敏感資料加密，有助於確保您的明文資料不會被任何第三方取得。

# Amazon Keyspaces 的偵測安全最佳實務
<a name="best-practices-security-detective"></a>

下列安全最佳實務被視為偵測性，因為它們可協助您偵測潛在的安全弱點和事件。

**使用 AWS CloudTrail 來監控 AWS Key Management Service (AWS KMS) AWS KMS 金鑰用量**  
如果您使用[客戶受管 AWS KMS 金鑰](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#customer-cmk)進行靜態加密，則會登入此金鑰的使用 AWS CloudTrail。CloudTrail 透過記錄對您帳戶所採取的動作，來提供使用者活動的可見性。CloudTrail 會記錄每個動作的重要資訊，包括提出請求的人員、使用的服務、執行的動作、動作的參數，以及 AWS 服務傳回的回應元素。此資訊可協助您追蹤對 AWS 資源所做的變更，並疑難排解操作問題。CloudTrail 可讓您更輕鬆地確保內部政策和法規標準的合規性。  
您可以使用 CloudTrail 來稽核金鑰的使用情況。CloudTrail 會建立日誌檔案，其中包含您帳戶的 AWS API 呼叫和相關事件的歷史記錄。這些日誌檔案包括使用主控台、 AWS SDKs和命令列工具提出的所有 AWS KMS API 請求，以及透過整合 AWS 服務提出的請求。您可以使用這些日誌檔案來取得有關何時使用 AWS KMS 金鑰、請求的操作、請求者的身分、請求的 IP 地址等資訊。如需詳細資訊，請參閱《[AWS CloudTrail 使用者指南](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/)》中的[使用 AWS CloudTrail記錄 AWS Key Management Service API 呼叫](https://docs.aws.amazon.com/kms/latest/developerguide/logging-using-cloudtrail.html)。

**使用 CloudTrail 監控 Amazon Keyspaces 資料定義語言 (DDL) 操作**  
CloudTrail 透過記錄對您帳戶所採取的動作，來提供使用者活動的可見性。CloudTrail 會記錄每個動作的重要資訊，包括提出請求的人、使用過的服務、執行過的動作、該動作的參數以及透過 AWS 服務傳回的回應元素。此資訊可協助您追蹤對 AWS 資源所做的變更，並針對操作問題進行疑難排解。CloudTrail 可讓您更輕鬆地確保內部政策和法規標準的合規性。  
所有 Amazon Keyspaces [DDL 操作](cql.ddl.md)都會自動記錄在 CloudTrail 中。DDL 操作可讓您建立和管理 Amazon Keyspaces 金鑰空間和資料表。  
當 Amazon Keyspaces 中發生活動時，該活動會與事件歷史記錄中的其他服務 AWS 事件一起記錄在 CloudTrail 事件中。如需詳細資訊，請參閱[使用 記錄 Amazon Keyspaces 操作 AWS CloudTrail](https://docs.aws.amazon.com/keyspaces/latest/devguide/logging-using-cloudtrail.html)。您可以在 中檢視、搜尋和下載最近的事件 AWS 帳戶。如需詳細資訊，請參閱 *AWS CloudTrail 使用者指南*中的 [使用 CloudTrail 事件歷史記錄檢視事件](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/view-cloudtrail-events.html)。  
若要持續記錄 中的事件 AWS 帳戶，包括 Amazon Keyspaces 的事件，請建立[追蹤](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html)。線索能讓 CloudTrail 將日誌檔案交付至 Amazon Simple Storage Service (Amazon S3) 儲存貯體。根據預設，當您在主控台上建立線索時，線索會套用至所有 AWS 區域。該追蹤會記錄來自 AWS 分割區中所有區域的事件，並將日誌檔案交付到您指定的 S3 儲存貯體。此外，您可以設定其他 AWS 服務，以進一步分析和處理 CloudTrail 日誌中所收集的事件資料。

**標記 Amazon Keyspaces 資源以進行識別和自動化**  
您可以將中繼資料以標籤形式指派給 AWS 資源。每個標籤都是簡單的標籤，其中包含客戶定義的金鑰和選用值，可讓您更輕鬆地管理、搜尋和篩選資源。  
標記允許實現分組控制。雖然標籤不具固有類型，但能讓您依用途、擁有者、環境或其他條件分類資源。下列是一些範例：  
+ 存取 – 用於根據標籤控制對 Amazon Keyspaces 資源的存取。如需詳細資訊，請參閱[以 Amazon Keyspaces 標籤為基礎的授權](security_iam_service-with-iam.md#security_iam_service-with-iam-tags)。
+ 安全性 – 用來判斷資料保護設定等需求。
+ 機密性 – 資源支援的特定資料機密性層級的識別符。
+ 環境：用來區分開發、測試和正式作業基礎結構。
如需詳細資訊，請參閱[AWS 標記策略](https://aws.amazon.com/answers/account-management/aws-tagging-strategies/)和[將標籤和標籤新增至資源](https://docs.aws.amazon.com/keyspaces/latest/devguide/tagging-keyspaces.html)。