# Amazon Keyspaces code examples for the SDK for .NET ## Overview Shows how to use the AWS SDK for .NET to work with Amazon Keyspaces (for Apache Cassandra). *Amazon Keyspaces is a scalable, highly available, and managed Apache Cassandra-compatible database service.* ## ⚠ Important * Running this code might result in charges to your AWS account. For more details, see [AWS Pricing](https://aws.amazon.com/pricing/?aws-products-pricing.sort-by=item.additionalFields.productNameLowercase&aws-products-pricing.sort-order=asc&awsf.Free%20Tier%20Type=*all&awsf.tech-category=*all) and [Free Tier](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all). * Running the tests might result in charges to your AWS account. * We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege). * This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services). ## Code examples ### Prerequisites For prerequisites, see the [README](../README.md#Prerequisites) in the `dotnetv3` folder. ### Get started * [Hello Amazon Keyspaces](Actions/HelloKeyspaces.cs#L4) (`ListKeyspaces`) ### Single actions Code excerpts that show you how to call individual service functions. * [Create a keyspace](Actions/KeyspacesWrapper.cs#L23) (`CreateKeyspace`) * [Create a table](Actions/KeyspacesWrapper.cs#L39) (`CreateTable`) * [Delete a keyspace](Actions/KeyspacesWrapper.cs#L63) (`DeleteKeyspace`) * [Delete a table](Actions/KeyspacesWrapper.cs#L78) (`DeleteTable`) * [Get data about a keyspace](Actions/KeyspacesWrapper.cs#L94) (`GetKeyspace`) * [Get data about a table](Actions/KeyspacesWrapper.cs#L109) (`GetTable`) * [List keyspaces](Actions/KeyspacesWrapper.cs#L125) (`ListKeyspaces`) * [List tables in a keyspace](Actions/KeyspacesWrapper.cs#L144) (`ListTables`) * [Restore a table to a point in time](Actions/KeyspacesWrapper.cs#L163) (`RestoreTable`) * [Update a table](Actions/KeyspacesWrapper.cs#L188) (`UpdateTable`) ### Scenarios Code examples that show you how to accomplish a specific task by calling multiple functions within the same service. * [Get started with keyspaces and tables](Scenarios/KeyspacesBasics.cs) ## Run the examples ### Instructions For general instructions to run the examples, see the [README](../README.md#building-and-running-the-code-examples) in the `dotnetv3` folder. Some projects might include a settings.json file. Before compiling the project, you can change these values to match your own account and resources. Alternatively, add a settings.local.json file with your local settings, which will be loaded automatically when the application runs. After the example compiles, you can run it from the command line. To do so, navigate to the folder that contains the .csproj file and run the following command: ``` dotnet run ``` Alternatively, you can run the example from within your IDE. #### Hello Amazon Keyspaces This example shows you how to get started using Amazon Keyspaces. #### Get started with keyspaces and tables This example shows you how to do the following: * Create a keyspace and table. The table schema holds movie data and has point-in-time recovery enabled. * Connect to the keyspace using a secure TLS connection with SigV4 authentication. * Query the table. Add, retrieve, and update movie data. * Update the table. Add a column to track watched movies. * Restore the table to its previous state and clean up resources. ### Tests ⚠ Running tests might result in charges to your AWS account. To find instructions for running these tests, see the [README](../README.md#Tests) in the `dotnetv3` folder. ## Additional resources * [Amazon Keyspaces Developer Guide](https://docs.aws.amazon.com/keyspaces/latest/devguide/what-is-keyspaces.html) * [Amazon Keyspaces API Reference](https://docs.aws.amazon.com/keyspaces/latest/APIReference/Welcome.html) * [SDK for .NET Amazon Keyspaces reference](https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/Keyspaces/NKeyspaces.html) --- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0