

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

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