Prerequisites for connecting from Amazon EKS to Amazon Keyspaces - Amazon Keyspaces (for Apache Cassandra)
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Prerequisites for connecting from Amazon EKS to Amazon Keyspaces

Create the following Amazon resources before you can begin with the tutorial
  1. Before you start this tutorial, follow the Amazon setup instructions in Accessing Amazon Keyspaces (for Apache Cassandra). These steps include signing up for Amazon and creating an Amazon Identity and Access Management (IAM) principal with access to Amazon Keyspaces.

  2. Create an Amazon Keyspaces keyspace with the name aws and a table with the name user that you can write to from the containerized application running in Amazon EKS later in this tutorial. You can do this either with the Amazon CLI or using cqlsh.

    Amazon CLI
    aws keyspaces create-keyspace --keyspace-name 'aws'

    To confirm that the keyspace was created, you can use the following command.

    aws keyspaces list-keyspaces

    To create the table, you can use the following command.

    aws keyspaces create-table --keyspace-name 'aws' --table-name 'user' --schema-definition 'allColumns=[ {name=username,type=text}, {name=fname,type=text},{name=last_update_date,type=timestamp},{name=lname,type=text}], partitionKeys=[{name=username}]'

    To confirm that your table was created, you can use the following command.

    aws keyspaces list-tables --keyspace-name 'aws'

    For more information, see create keyspace and create table in the Amazon CLI Command Reference.

    cqlsh
    CREATE KEYSPACE aws WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'} AND durable_writes = true; CREATE TABLE aws.user ( username text PRIMARY KEY, fname text, last_update_date timestamp, lname text );

    To verify that your table was created, you can use the following statement.

    SELECT * FROM system_schema.tables WHERE keyspace_name = "aws";

    Your table should be listed in the output of this statement. Note that there can be a delay until the table is created. For more information, see CREATE TABLE.

  3. Create an Amazon EKS cluster with a Fargate - Linux node type. Fargate is a serverless compute engine that lets you deploy Kubernetes Pods without managing Amazon Amazon EC2 instances. To follow this tutorial without having to update the cluster name in all the example commands, create a cluster with the name my-eks-cluster following the instructions at Getting started with Amazon EKS – eksctl in the Amazon EKS User Guide. When your cluster is created, verify that your nodes and the two default Pods are running and healthy. You can do so with the following command.

    kubectl get pods -A -o wide

    You should see something similar to this output.

    NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES kube-system coredns-1234567890-abcde 1/1 Running 0 18m 192.0.2.0 fargate-ip-192-0-2-0.region-code.compute.internal <none> <none> kube-system coredns-1234567890-12345 1/1 Running 0 18m 192.0.2.1 fargate-ip-192-0-2-1.region-code.compute.internal <none> <none>
  4. Install Docker. For instructions on how to install Docker on an Amazon EC2 instance, see Install Docker in the Amazon Elastic Container Registry User Guide.

    Docker is available for many different operating systems, including most modern Linux distributions, like Ubuntu, and even macOS and Windows. For more information about how to install Docker on your particular operating system, go to the Docker installation guide.

  5. Create an Amazon ECR repository. Amazon ECR is an Amazon managed container image registry service that you can use with your preferred CLI to push, pull, and manage Docker images. For more information about Amazon ECR repositories, see the Amazon Elastic Container Registry User Guide. You can use the following command to create a repository with the name my-ecr-repository.

    aws ecr create-repository --repository-name my-ecr-repository

After completing the prerequisite steps, proceed to Step 1: Configure the Amazon EKS cluster and setup IAM permissions.