

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

# Amazon Keyspaces （適用於 Apache Cassandra) 程式庫和工具
<a name="examples-tools"></a>

本節提供有關 Amazon Keyspaces （適用於 Apache Cassandra) 程式庫、程式碼範例和工具的資訊。

**Topics**
+ [程式庫和範例](#examples)
+ [反白的範例和開發人員工具庫](#highlights)

## 程式庫和範例
<a name="examples"></a>

您可以在 和 [AWS 範例](https://github.com/aws-samples)儲存庫的 GitHub 中找到 Amazon Keyspaces 開放原始碼程式庫[AWS](https://github.com/aws)和開發人員工具。

### Amazon Keyspaces （適用於 Apache Cassandra) 開發人員工具組
<a name="docker-container"></a>

此儲存庫為 Amazon Keyspaces 提供具有實用開發人員工具的 Docker 映像。例如，它包含具有最佳實務的 CQLSHRC 檔案、cqlsh 的選用 AWS 身分驗證擴展，以及執行常見任務的協助工具。工具組已針對 Amazon Keyspaces 最佳化，但也適用於 Apache Cassandra 叢集。

[https://github.com/aws-samples/amazon-keyspaces-toolkit](https://github.com/aws-samples/amazon-keyspaces-toolkit).

### Amazon Keyspaces （適用於 Apache Cassandra) 範例
<a name="code-examples"></a>

此儲存庫是我們 Amazon Keyspaces 範例程式碼的官方清單。儲存庫會依語言細分為區段 （請參閱[範例](https://github.com/aws-samples/amazon-keyspaces-examples#Examples/))。每個語言都有自己的範例子區段。這些範例示範常見的 Amazon Keyspaces 服務實作和模式，您可以在建置應用程式時使用。

[https://github.com/aws-samples/amazon-keyspaces-examples/](https://github.com/aws-samples/amazon-keyspaces-examples/).

### AWS Signature 第 4 版 (SigV4) 身分驗證外掛程式
<a name="auth-plugins"></a>

外掛程式可讓您使用 AWS Identity and Access Management (IAM) 使用者和角色來管理對 Amazon Keyspaces 的存取。

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

## 反白的範例和開發人員工具庫
<a name="highlights"></a>

以下是適用於 Amazon Keyspaces （適用於 Apache Cassandra) 的一系列實用社群工具。

### Amazon Keyspaces 通訊協定緩衝區
<a name="protocol_buffers"></a>

您可以搭配 Amazon Keyspaces 使用 Protocol Buffers (Protobuf)，提供 Apache Cassandra 使用者定義類型 (UDTs) 的替代方案。Protobuf 是一種免費且開放原始碼的跨平台資料格式，用於序列化結構化資料。您可以使用 CQL `BLOB`資料類型和重構 UDTs 來存放 Protobuf 資料，同時跨應用程式和程式設計語言保留結構化資料。

此儲存庫提供程式碼範例，可連線至 Amazon Keyspaces、建立新的資料表，以及插入包含 Protobuf 訊息的資料列。然後，會以強烈的一致性讀取資料列。

[https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/java/datastax-v4/protobuf-user-defined-types](https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/java/datastax-v4/protobuf-user-defined-types)

### CloudFormation 為 Amazon Keyspaces （適用於 Apache Cassandra) 指標建立 Amazon CloudWatch 儀表板的 範本
<a name="dashboard"></a>

此儲存庫提供 CloudFormation 範本，可快速設定 Amazon Keyspaces 的 CloudWatch 指標。使用此範本可讓您透過提供可部署的預先建置 CloudWatch 儀表板與常用的指標，更輕鬆地開始。

[https://github.com/aws-samples/amazon-keyspaces-cloudwatch-cloudformation-templates](https://github.com/aws-samples/amazon-keyspaces-cloudwatch-cloudformation-templates).

### 搭配 使用 Amazon Keyspaces （適用於 Apache Cassandra) AWS Lambda
<a name="lambda"></a>

儲存庫包含示範如何從 Lambda 連線至 Amazon Keyspaces 的範例。以下是一些範例。

C\$1/。NET：[https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/dotnet/datastax-v3/connection-lambda](https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/dotnet/datastax-v3/connection-lambda)。

Java：[https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/java/datastax-v4/connection-lambda](https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/java/datastax-v4/connection-lambda)。

另一個顯示如何從 Python Lambda 部署和使用 Amazon Keyspaces 的 Lambda 範例可從下列儲存庫取得。

[https://github.com/aws-samples/aws-keyspaces-lambda-python](https://github.com/aws-samples/aws-keyspaces-lambda-python)

### 搭配 Spring 使用 Amazon Keyspaces （適用於 Apache Cassandra)
<a name="spring"></a>

這是示範如何搭配 Spring Boot 使用 Amazon Keyspaces 的範例。

[https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/java/datastax-v4/spring](https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/java/datastax-v4/spring)

### 搭配 Scala 使用 Amazon Keyspaces （適用於 Apache Cassandra)
<a name="scala"></a>

這是示範如何使用 SigV4 身分驗證外掛程式搭配 Scala 連線至 Amazon Keyspaces 的範例。

[https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/scala/datastax-v4/connection-sigv4](https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/scala/datastax-v4/connection-sigv4)

### 搭配 使用 Amazon Keyspaces （適用於 Apache Cassandra) AWS Glue
<a name="glue"></a>

這是示範如何使用 Amazon Keyspaces 的範例 AWS Glue。

[https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/scala/datastax-v4/aws-glue](https://github.com/aws-samples/amazon-keyspaces-examples/tree/main/scala/datastax-v4/aws-glue)

### 要 CloudFormation 轉換的 Amazon Keyspaces （適用於 Apache Cassandra) Cassandra 查詢語言 (CQL)
<a name="cfn-converter"></a>

此套件實作命令列工具，將 Apache Cassandra 查詢語言 (CQL) 指令碼 CloudFormation 轉換為 (CloudFormation) 範本，這可讓 Amazon Keyspaces 結構描述在 CloudFormation 堆疊中輕鬆管理。

[https://github.com/aws/amazon-keyspaces-cql-to-cfn-converter](https://github.com/aws/amazon-keyspaces-cql-to-cfn-converter).

### 適用於 Java 的 Apache Cassandra 驅動程式的 Amazon Keyspaces （適用於 Apache Cassandra) 協助程式
<a name="java"></a>

此儲存庫包含搭配 Amazon Keyspaces （適用於 Apache Cassandra) 使用 DataStax Java 驅動程式時的驅動程式政策、範例和最佳實務。

[https://github.com/aws-samples/amazon-keyspaces-java-driver-helpers](https://github.com/aws-samples/amazon-keyspaces-java-driver-helpers).

### Amazon Keyspaces （適用於 Apache Cassandra) 快照壓縮示範
<a name="compression"></a>

此儲存庫示範如何壓縮、存放和讀取/寫入大型物件，以提高效能並降低輸送量和儲存成本。

[https://github.com/aws-samples/amazon-keyspaces-compression-example](https://github.com/aws-samples/amazon-keyspaces-compression-example).

### Amazon Keyspaces （適用於 Apache Cassandra) 和 Amazon S3 轉碼器示範
<a name="S3-codec"></a>

自訂 Amazon S3 Codec 支援透明、使用者可設定的 UUID 指標映射至 Amazon S3 物件。

[https://github.com/aws-samples/amazon-keyspaces-large-object-s3-demo](https://github.com/aws-samples/amazon-keyspaces-large-object-s3-demo).