image
DEMO: Creating a Keyspace and Table in Amazon Keyspaces (for Apache Cassandra)
Start course
Difficulty
Beginner
Duration
1h 2m
Students
17347
Ratings
4.6/5
starstarstarstarstar-half
Description

This is the second course in a two-part series on database fundamentals for AWS. This course explores four different AWS database services — Amazon Redshift, Amazon QLDB, Amazon DocumentDB, and Amazon Keyspaces — and the differences between them. As well as getting a theoretical understanding of these, you will also watch guided demonstrations from the AWS platform showing you how to use each database service.

If you have any feedback relating to this course, please feel free to share your thoughts with us at support@cloudacademy.com. The first course in this two-part series covers Amazon RDS, Amazon DynamoDB, Amazon ElastiCache, and Amazon Neptune. If you're looking for more information on these AWS database services, you can find that course here.

Learning Objectives

  • Obtain a solid understanding of the following Amazon database services: Redshift, Quantum Ledger Database (QLDB), DocumentDB, and Keyspaces.
  • Create an Amazon Redshift cluster
  • Create a ledger using Amazon QLDB
  • Create an Amazon DocumentDB cluster
  • Create a keyspace and table in Amazon Keyspaces for Apache Cassandra

Intended Audience

  • Individuals responsible for designing, operating, and optimizing AWS database solutions
  • Anyone preparing to take the AWS Certified Database Specialty exam

Prerequisites

To get the most out of this course, you should have a basic understanding of database architectures and the AWS global infrastructure. For more information on this, please see our existing blog post here. You should also have a general understanding of the principles behind different EC2 Instance families.

Transcript

Hello and welcome to this lecture, which will be a demonstration on how to create an Amazon Keyspaces database. And what I shall do, I shall create a keyspace and then a table that resides in that keyspace. So let's take a look.

So firstly, scroll down to the database category and then select Amazon keyspaces. As you can see, I don't have any keyspaces set up at the moment so I just need to click get started. Now much like in the QLDB demonstration, Amazon keyspaces also has a quick getting started guide that gives you a quick tutorial on how to create a keyspace, then how to create a table in your keyspace and then how to populate it with data and query your data.

As this is a fundamental level course, we're just going to create the keyspace and then create a table. Now I'm not going to use the getting started guide but if you'd like to explore this service further, then I recommend you going through those four steps.

Okay, so to create a keyspace we can select keyspaces on the left side here. Now remember a keyspace is essentially going to be a grouping of tables, that will be used by your applications to read all my data to. And it also defines how the replication is managed as well.

So from here, we simply click create keyspace. Now we need to give it a name, I'm just gonna call this; my keyspace. We can add any optional tabs if we'd like to. And this is the query that will be executed to create the keyspace that we specified above. So we can say this is going to create the name of my keyspace and it will also manage the replication across a single region strategy. So AWS will configure this replication for us across multiple availability zones. Click create keyspace and then we can see it's active. So it's very easy to create the keyspace.

Now we need to create a table within that keyspace. So if we now select that keyspace, we can see that it doesn't have any tables. Now the table itself, is where your database rights are stored. So now we need to create a table within the keyspace. So select create table. We can select the keyspace that we want this table to belong to. As we only have one, that's the my keyspace that we just created.

Now we can enter a table name. I'll just call this my table. Here, we can enter the schema information. So we can enter any columns that we want, for example; product name and then the type field for that column. As you can see, there's lots of different types that you can use. For this, I'll just use the character string. And if we want more than one column, we can add another column. For example; product ID, and this can be a decimal field.

Now we can add our partition key and we can see that a partition key is composed of one or more columns that are used to uniquely identify rows within a table. So we can select the columns that we'd like to act as the partition key. So as you can see, you can add more than one column. We then have clustering columns, which is optional, and this helps you to sort data within a partition.

For this demonstration, I'm not gonna have any clustered columns. Then if you scroll down to the read and write capacity settings, here we have the on-demand and provision modes that I discussed in a previous lecture. So the on-demand option simplifies billing for the actual read and writes that the application performs. Whereas provisioned, you can manage and optimize the reads and writes in advance.

So as you can see for read capacity, we can have this automatically scaling. I can set the minimum capacity units and the maximum capacity units. And when the utilization gets to 70%, it will automatically scale up. Similarly with the write capacity. You can copy the settings that you have above for the read scaling or you can set it manually.

So you can have different scaling patterns for both read and write capacity. I'm just gonna leave this as on-demand capacity mode, just for simplification. And then if we go down even further, we can see our point in time of recovery. We can either enable this or disable. It's always best to keep this enabled, just to allow you to recover from any incident at any point. Then you can add any optional tags. And finally, this just shows you the query that will be executed to create the table in keyspace, along with the column names and the types and also the primary key. And it also sets your capacity modes and the fact that we have point-in-time recovery enabled.

Once you're happy with all your options, simply select create table. And that has now created the my table in my keyspace. As you can see, the status is now active and if you select the table, you can see the partition key and your columns as well. And if you need to add any more columns, then you can do so here.

So that was just a very quick overview of how to firstly create a keyspace and then create a table. And finally, remember you can add additional tables to a keyspace. So if we go back into our keyspace, you can then go ahead and create an additional table within the same keyspace. And that's it for this demonstration.

Lectures

Course Introduction - Amazon Redshift - DEMO: Creating an Amazon Redshift Cluster - Amazon Quantum Ledger Database (QLDB) - DEMO: Creating a Ledger using Amazon QLDB - Amazon DocumentDB (With MongoDB Compatibility) - DEMO: Creating an Amazon DocumentDB Cluster - Amazon Keyspaces (for Apache Cassandra) - Course Summary

About the Author
Students
228694
Labs
1
Courses
215
Learning Paths
178

Stuart has been working within the IT industry for two decades covering a huge range of topic areas and technologies, from data center and network infrastructure design, to cloud architecture and implementation.

To date, Stuart has created 150+ courses relating to Cloud reaching over 180,000 students, mostly within the AWS category and with a heavy focus on security and compliance.

Stuart is a member of the AWS Community Builders Program for his contributions towards AWS.

He is AWS certified and accredited in addition to being a published author covering topics across the AWS landscape.

In January 2016 Stuart was awarded ‘Expert of the Year Award 2015’ from Experts Exchange for his knowledge share within cloud services to the community.

Stuart enjoys writing about cloud technologies and you will find many of his articles within our blog pages.