

# Using NoSQL Workbench with Amazon Keyspaces (for Apache Cassandra)
<a name="workbench"></a>

NoSQL Workbench is a client-side application that helps you design and visualize nonrelational data models for Amazon Keyspaces more easily. NoSQL Workbench clients are available for Windows, macOS, and Linux. 

**Designing data models and creating resources automatically**  
NoSQL Workbench provides you a point-and-click interface to design and create Amazon Keyspaces data models. You can easily create new data models from scratch by defining keyspaces, tables, and columns. You can also import existing data models and make modifications (such as adding, editing, or removing columns) to adapt the data models for new applications. NoSQL Workbench then enables you to commit the data models to Amazon Keyspaces or Apache Cassandra, and create the keyspaces and tables automatically. To learn how to build data models, see [Create a new data model with NoSQL Workbench](workbench.datamodel.new.md) and [Edit existing data models with NoSQL Workbench](workbench.datamodel.edit.md). 

**Visualizing data models**  
Using NoSQL Workbench, you can visualize your data models to help ensure that the data models can support your application’s queries and access patterns. You can also save and export your data models in a variety of formats for collaboration, documentation, and presentations. For more information, see [Visualize data models with NoSQL Workbench](workbench.vizualizer.md).

**Topics**
+ [Download NoSQL Workbench](workbench.settingup.md)
+ [Getting started with NoSQL Workbench](workbench.start.md)
+ [Visualize data models with NoSQL Workbench](workbench.vizualizer.md)
+ [Create a new data model with NoSQL Workbench](workbench.datamodel.new.md)
+ [Edit existing data models with NoSQL Workbench](workbench.datamodel.edit.md)
+ [How to commit data models to Amazon Keyspaces and Apache Cassandra](workbench.commit.md)
+ [Sample data models in NoSQL Workbench](workbench.SampleModels.md)
+ [Release history for NoSQL Workbench](WorkbenchDocumentHistory.md)

# Download NoSQL Workbench
<a name="workbench.settingup"></a>

Follow these instructions to download and install NoSQL Workbench.

**To download and install NoSQL Workbench**

1. Use one of the following links to download NoSQL Workbench for free.  
****    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/workbench.settingup.html)

   \$1 NoSQL Workbench supports Ubuntu 12.04, Fedora 21, and Debian 8 or any newer versions of these Linux distributions.

1. After the download completes, start the application and follow the onscreen instructions to complete the installation.

# Getting started with NoSQL Workbench
<a name="workbench.start"></a>

To get started with NoSQL Workbench, on the Database Catalog page in NoSQL Workbench, choose Amazon Keyspaces, and then choose **Launch**. 

![\[Console screenshot that shows the NoSQL Workbench start page.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_welcome.png)


This opens the NoSQL Workbench home page for Amazon Keyspaces where you have the following options to get started: 

1. Create a new data model.

1. Import an existing data model in JSON format.

1. Open a recently edited data model.

1. Open one of the available sample models.

![\[Console screenshot that shows the data modeler start page.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_datamodel.png)


Each of the options opens the NoSQL Workbench data modeler. To continue creating a new data model, see [Create a new data model with NoSQL Workbench](workbench.datamodel.new.md). To edit an existing data model, see [Edit existing data models with NoSQL Workbench](workbench.datamodel.edit.md).

# Visualize data models with NoSQL Workbench
<a name="workbench.vizualizer"></a>

Using NoSQL Workbench, you can visualize your data models to help ensure that the data models can support your application’s queries and access patterns. You also can save and export your data models in a variety of formats for collaboration, documentation, and presentations.

After you have created a new data model or edited an existing data model, you can visualize the model.

## Visualizing data models with NoSQL Workbench
<a name="workbench.datamodel.visualize"></a>

When you have completed the data model in the data modeler, choose **Visualize data model**.

![\[Console screenshot showing a sample data model.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_visualize.png)


This takes you to the data visualizer in NoSQL Workbench. The data visualizer provides a visual representation of the table's schema and lets you add sample data. To add sample data to a table, choose a table from the model, and then choose **Edit**. To add a new row of data, choose **Add new row** at the bottom of the screen. Choose **Save** when you're done.

![\[Console screenshot showing how to add data to a table.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_adddata.png)


## Aggregate view
<a name="workbench.visualizer.aggregate"></a>

After you have confirmed the table's schema, you can aggregate data model visualizations.

![\[Console screenshot showing the aggregate view.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_aggview.png)


After you have aggregated the view of the data model, you can export the view to a PNG file. To export the data model to a JSON file, choose the upload sign under the data model name. 

**Note**  
You can export the data model in JSON format at any time in the design process.

![\[Console screenshot showing the data model export and commit options.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_aggview2.png)


You have the following options to commit the changes:
+ Commit to Amazon Keyspaces
+ Commit to an Apache Cassandra cluster

To learn more about how to commit changes, see [How to commit data models to Amazon Keyspaces and Apache Cassandra](workbench.commit.md).

# Create a new data model with NoSQL Workbench
<a name="workbench.datamodel.new"></a>

You can use the NoSQL Workbench data modeler to design new data models based on your application's data access patterns. To create a new data model for Amazon Keyspaces, you can use the NoSQL Workbench data modeler to create keyspaces, tables, and columns. Follow these steps to create a new data model.

1. To create a new keyspace, choose the plus sign under **Keyspace**.

    In this step, choose the following properties and settings.
   + **Keyspace name** – Enter the name of the new keyspace.
   + **Replication strategy** – Choose the replication strategy for the keyspace. Amazon Keyspaces uses the **SingleRegionStrategy** to replicate data three times automatically in multiple AWS Availability Zones. If you're planning to commit the data model to an Apache Cassandra cluster, you can choose **SimpleStrategy** or **NetworkTopologyStrategy**. 
   + **Keyspaces tags** – Resource tags are optional and let you categorize your resources in different ways—for example, by purpose, owner, environment, or other criteria. To learn more about tags for Amazon Keyspaces resources, see [Working with tags and labels for Amazon Keyspaces resources](tagging-keyspaces.md).

1. Choose **Add keyspace definition** to create the keyspace.  
![\[Console screenshot that shows how to create a keyspace.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_addkey.png)

1. To create a new table, choose the plus sign next to **Tables**. In this step, you define the following properties and settings.
   + **Table name** – The name of the new table.
   + **Columns** – Add a column name and choose the data type. Repeat these steps for every column in your schema.
   + **Partition key** – Choose columns for the partition key.
   + **Clustering columns** – Choose clustering columns (optional).
   + **Capacity mode** – Choose the read/write capacity mode for the table. You can choose provisioned or on-demand capacity. To learn more about capacity modes, see [Configure read/write capacity modes in Amazon Keyspaces](ReadWriteCapacityMode.md).
   + **Table tags** – Resource tags are optional and let you categorize your resources in different ways—for example, by purpose, owner, environment, or other criteria. To learn more about tags for Amazon Keyspaces resources, see [Working with tags and labels for Amazon Keyspaces resources](tagging-keyspaces.md).

1. Choose **Add table definition** to create the new table.

1. Repeat these steps to create additional tables.

1. Continue to [Visualizing data models with NoSQL Workbench](workbench.vizualizer.md#workbench.datamodel.visualize) to visualize the data model that you created.

![\[Console screenshot that shows how to create a new table.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_tableadd.png)


# Edit existing data models with NoSQL Workbench
<a name="workbench.datamodel.edit"></a>

You can use the data modeler to import and modify existing data models created using NoSQL Workbench. The data modeler also includes a few sample data models to help you get started with data modeling. The data models you can edit with NoSQL Workbench can be data models that are imported from a file, the provided sample data models, or data models that you created previously. 

1. To edit a keyspace, choose the edit symbol under **Keyspace**.

    In this step, you can edit the following properties and settings.
   + **Keyspace name** – Enter the name of the new keyspace.
   + **Replication strategy** – Choose the replication strategy for the keyspace. Amazon Keyspaces uses the **SingleRegionStrategy** to replicate data three times automatically in multiple AWS Availability Zones. If you're planning to commit the data model to an Apache Cassandra cluster, you can choose **SimpleStrategy** or **NetworkTopologyStrategy**. 
   + **Keyspaces tags** – Resource tags are optional and let you categorize your resources in different ways—for example, by purpose, owner, environment, or other criteria. To learn more about tags for Amazon Keyspaces resources, see [Working with tags and labels for Amazon Keyspaces resources](tagging-keyspaces.md).

1. Choose **Save edits** to update the keyspace.  
![\[Console screenshot that shows how to edit an existing table.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_table.png)

1. To edit a table, choose **Edit** next to the table name. In this step, you can update the following properties and settings.
   + **Table name** – The name of the new table.
   + **Columns** – Add a column name and choose the data type. Repeat these steps for every column in your schema.
   + **Partition key** – Choose columns for the partition key.
   + **Clustering columns** – Choose clustering columns (optional).
   + **Capacity mode** – Choose the read/write capacity mode for the table. You can choose provisioned or on-demand capacity. To learn more about capacity modes, see [Configure read/write capacity modes in Amazon Keyspaces](ReadWriteCapacityMode.md).
   + **Table tags** – Resource tags are optional and let you categorize your resources in different ways—for example, by purpose, owner, environment, or other criteria. To learn more about tags for Amazon Keyspaces resources, see [Working with tags and labels for Amazon Keyspaces resources](tagging-keyspaces.md).

1. Choose **Save edits** to update the table.

1. Continue to [Visualizing data models with NoSQL Workbench](workbench.vizualizer.md#workbench.datamodel.visualize) to visualize the data model that you updated.

# How to commit data models to Amazon Keyspaces and Apache Cassandra
<a name="workbench.commit"></a>

This section shows you how to commit completed data models to Amazon Keyspaces and Apache Cassandra clusters. This process automatically creates the server-side resources for keyspaces and tables based on the settings that you defined in the data model. 

![\[Console screenshot that shows the commit options.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_commit.png)


**Topics**
+ [Before you begin](#workbench.commit.preqequ)
+ [Connect to Amazon Keyspaces with service-specific credentials](workbench.commit.ssc.md)
+ [Connect to Amazon Keyspaces with AWS Identity and Access Management (IAM) credentials](workbench.commit.iam.md)
+ [Use a saved connection](workbench.commit.default.md)
+ [Commit to Apache Cassandra](workbench.commit.cassandra.md)

## Before you begin
<a name="workbench.commit.preqequ"></a>

Amazon Keyspaces requires the use of Transport Layer Security (TLS) to help secure connections with clients. To connect to Amazon Keyspaces using TLS, you need to complete the following task before you can start.
+  Download the following digital certificates and save the files locally or in your home directory.

  1. AmazonRootCA1

  1. AmazonRootCA2

  1. AmazonRootCA3

  1. AmazonRootCA4

  1. Starfield Class 2 Root (optional – for backward compatibility)

  To download the certificates, you can use the following commands.

  ```
  curl -O https://www.amazontrust.com/repository/AmazonRootCA1.pem
  curl -O https://www.amazontrust.com/repository/AmazonRootCA2.pem
  curl -O https://www.amazontrust.com/repository/AmazonRootCA3.pem
  curl -O https://www.amazontrust.com/repository/AmazonRootCA4.pem
  curl -O https://certs.secureserver.net/repository/sf-class2-root.crt
  ```
**Note**  
Amazon Keyspaces previously used TLS certificates anchored to the Starfield Class 2 CA. AWS is migrating all AWS Regions to certificates issued under Amazon Trust Services (Amazon Root CAs 1–4). During this transition, configure clients to trust both Amazon Root CAs 1–4 and the Starfield root to ensure compatibility across all Regions.

  Combine all downloaded certificates into a single `pem` file with the name *keyspaces-bundle.pem* in our examples. You can do this by running the following command. Take note of the path to the file, you need this later.

  ```
  cat AmazonRootCA1.pem \
   AmazonRootCA2.pem \
   AmazonRootCA3.pem \
   AmazonRootCA4.pem \
   sf-class2-root.crt \
   > keyspaces-bundle.pem
  ```

After you have saved the certificate file, you can connect to Amazon Keyspaces. One option is to connect by using service-specific credentials. Service-specific credentials are a user name and password that are associated with a specific IAM user and can only be used with the specified service. The second option is to connect with IAM credentials that are using the [AWS Signature Version 4 process (SigV4)](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html). To learn more about these two options, see [Create credentials for programmatic access to Amazon Keyspaces](programmatic.credentials.md).

To connect with service-specific credentials, see [Connect to Amazon Keyspaces with service-specific credentials](workbench.commit.ssc.md).

To connect with IAM credentials, see [Connect to Amazon Keyspaces with AWS Identity and Access Management (IAM) credentials](workbench.commit.iam.md).

# Connect to Amazon Keyspaces with service-specific credentials
<a name="workbench.commit.ssc"></a>

This section shows how to use service-specific credentials to commit the data model you created or edited with NoSQL Workbench.

1. To create a new connection using service-specific credentials, choose the **Connect by using user name and password** tab. 

   1. Before you begin, you must create service-specific credentials using the process documented at [Create service-specific credentials for programmatic access to Amazon Keyspaces](programmatic.credentials.ssc.md).

   After you have obtained the service-specific credentials, you can continue to set up the connection. Continue with one of the following:
   + **User name** – Enter the user name.
   + **Password** – Enter the password.
   + **AWS Region** – For available Regions, see [Service endpoints for Amazon Keyspaces](programmatic.endpoints.md).
   + **Port** – Amazon Keyspaces uses port 9142. 

   Alternatively, you can import saved credentials from a file.

1. Choose **Commit** to update Amazon Keyspaces with the data model.

![\[Console screenshot that shows a connection to Amazon Keyspaces using service-specific credentials.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_SSC.png)


# Connect to Amazon Keyspaces with AWS Identity and Access Management (IAM) credentials
<a name="workbench.commit.iam"></a>

This section shows how to use IAM credentials to commit the data model created or edited with NoSQL Workbench.

1. To create a new connection using IAM credentials, choose the **Connect by using IAM credentials** tab. 

   1. Before you begin, you must create IAM credentials using one of the following methods.
     + For console access, use your IAM user name and password to sign in to the [AWS Management Console](https://console.aws.amazon.com/console/home) from the IAM sign-in page. For information about AWS security credentials, including programmatic access and alternatives to long-term credentials, see [AWS security credentials](https://docs.aws.amazon.com/IAM/latest/UserGuide/security-creds.html) in the *IAM User Guide*. For details about signing in to your AWS account, see [How to sign in to AWS](https://docs.aws.amazon.com/signin/latest/userguide/how-to-sign-in.html) in the *AWS Sign-In User Guide*.
     + For CLI access, you need an access key ID and a secret access key. Use temporary credentials instead of long-term access keys when possible. Temporary credentials include an access key ID, a secret access key, and a security token that indicates when the credentials expire. For more information, see [ Using temporary credentials with AWS resources](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html) in the *IAM User Guide*.
     + For API access, you need an access key ID and secret access key. Use IAM user access keys instead of AWS account root user access keys. For more information about creating access keys, see [Manage access keys for IAM users](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html) in the *IAM User Guide*. 

     For more information, see [Managing access keys for IAM users](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html).

   After you have obtained the IAM credentials, you can continue to set up the connection.
   + **Connection name** – The name of the connection.
   + **AWS Region** – For available Regions, see [Service endpoints for Amazon Keyspaces](programmatic.endpoints.md).
   + **Access key ID** – Enter the access key ID.
   + **Secret access key** – Enter the secret access key.
   + **Port** – Amazon Keyspaces uses port 9142. 
   + **AWS public certificate** – Point to the AWS certificate that was downloaded in the first step.
   + **Persist connection** – Select this check box if you want to save the AWS connection secrets locally.

1. Choose **Commit** to update Amazon Keyspaces with the data model.

![\[Console screenshot that shows a connection to Amazon Keyspaces using IAM credentials.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_IAM.png)


# Use a saved connection
<a name="workbench.commit.default"></a>

If you have previously set up a connection to Amazon Keyspaces, you can use that as the default connection to commit data model changes. Choose the **Use saved connections** tab and continue to commit the updates.

![\[Console screenshot that shows the default connection to Amazon Keyspaces.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_connection.png)


# Commit to Apache Cassandra
<a name="workbench.commit.cassandra"></a>

This section walks you through making the connections to an Apache Cassandra cluster to commit the data model created or edited with NoSQL Workbench.

**Note**  
Only data models that have been created with `SimpleStrategy` or `NetworkTopologyStrategy` can be committed to Apache Cassandra clusters. To change the replication strategy, edit the keyspace in the data modeler.

1. 
   + **User name** – Enter the user name if authentication is enabled on the cluster.
   + **Password** – Enter the password if authentication is enabled on the cluster.
   + **Contact points** – Enter the contact points.
   + **Local data center** – Enter the name of the local data center.
   + **Port** – The connection uses port 9042.

1. Choose **Commit** to update the Apache Cassandra cluster with the data model.

![\[Console screenshot that shows a connection to Apache Cassandra.\]](http://docs.aws.amazon.com/keyspaces/latest/devguide/images/workbench/key_nosql_cassandra.png)


# Sample data models in NoSQL Workbench
<a name="workbench.SampleModels"></a>

The home page for the modeler and visualizer displays a number of sample models that ship with NoSQL Workbench. This section describes these models and their potential uses.

**Topics**
+ [Employee data model](#workbench.SampleModels.EmployeeDataModel)
+ [Credit card transactions data model](#workbench.SampleModels.CreditCardTransactionsDataModel)
+ [Airline operations data model](#workbench.SampleModels.AirlineOperations)

## Employee data model
<a name="workbench.SampleModels.EmployeeDataModel"></a>

This data model represents an Amazon Keyspaces schema for an employee database application.

Applications that access employee information for a given company can use this data model.

The access patterns supported by this data model are:
+ Retrieval of an employee record with a given ID.
+ Retrieval of an employee record with a given ID and division.
+ Retrieval of an employee record with a given ID and name.

## Credit card transactions data model
<a name="workbench.SampleModels.CreditCardTransactionsDataModel"></a>

This data model represents an Amazon Keyspaces schema for credit card transactions at retail stores.

The storage of credit card transactions not only helps stores with bookkeeping, but also helps store managers analyze purchase trends, which can help them with forecasting and planning.

The access patterns supported by this data model are:
+ Retrieval of transactions by credit card number, month and year, and date.
+ Retrieval of transactions by credit card number, category, and date.
+ Retrieval of transactions by category, location, and credit card number.
+ Retrieval of transactions by credit card number and dispute status.

## Airline operations data model
<a name="workbench.SampleModels.AirlineOperations"></a>

This data model shows data about plane flights, including airports, airlines, and flight routes.

Key components of Amazon Keyspaces modeling that are demonstrated are key-value pairs, wide-column data stores, composite keys, and complex data types such as maps to demonstrate common NoSQL data-access patterns.

The access patterns supported by this data model are:
+ Retrieval of routes originating from a given airline at a given airport.
+ Retrieval of routes with a given destination airport.
+ Retrieval of airports with direct flights.
+ Retrieval of airport details and airline details.

# Release history for NoSQL Workbench
<a name="WorkbenchDocumentHistory"></a>

The following table describes the important changes in each release of the *NoSQL Workbench* client-side application. 


****  

| Change | Description | Date | 
| --- | --- | --- | 
|  NoSQL Workbench for Amazon Keyspaces – GA.  |  NoSQL Workbench for Amazon Keyspaces is generally available.  |  October 28, 2020  | 
|  NoSQL Workbench preview released.  |  NoSQL Workbench is a client-side application that helps you design and visualize nonrelational data models for Amazon Keyspaces more easily. NoSQL Workbench clients are available for Windows, macOS, and Linux. For more information, see [NoSQL Workbench for Amazon Keyspaces](https://docs.aws.amazon.com/keyspaces/latest/devguide/workbench.html).  |  October 5, 2020  | 