Skip to content

Alternator and AWS CLI

Konstantin Osipov edited this page Apr 20, 2023 · 1 revision

prerequisites

  • Working Scylla with Alternator Enabled

For example, with Docker:

docker run --name some-scylla-alt --hostname some-scylla-alt -d scylladb/scylla-nightly:alternator --alternator-port 8000

scylla-ip (to be used below) will be

docker inspect -f '{{ .NetworkSettings.IPAddress }}' some-scylla

Install AWS CLI

install pip, Boto on CentOS / Fedora/ RHEL

sudo yum install epel-release
sudo yum -y install python-pip
sudo pip install --upgrade pip
sudo pip install --upgrade boto3

Source: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html

  • edit AWS config file ~/.aws/config
[default]
region = us-east-1
aws_access_key_id=foo
aws_secret_access_key=bar

Note these options will not be used when using endpoint-url below, but are required by AWS CLI

Install AWS CLI

  • pip install --upgrade --user awscli
  • validate aws cli install

Source: https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html

$ aws --version
aws-cli/1.16.208 Python/2.7.5 Linux/5.2.4-1.el7.elrepo.x86_64 botocore/1.12.198

Using AWS CLI with Scylla Alternator

aws  --endpoint-url 'http://172.17.0.2:8000'  dynamodb create-table --table-name MusicCollection --attribute-definitions AttributeName=Artist,AttributeType=S AttributeName=SongTitle,AttributeType=S --key-schema AttributeName=Artist,KeyType=HASH AttributeName=SongTitle,KeyType=RANGE --provisioned-throughput ReadCapacityUnits=5,WriteCapacityUnits=5
{
    "TableDescription": {
        "AttributeDefinitions": [
            {
                "AttributeName": "Artist",
                "AttributeType": "S"
            },
            {
                "AttributeName": "SongTitle",
                "AttributeType": "S"
            }
        ],
        "TableName": "MusicCollection",
        "KeySchema": [
            {
                "AttributeName": "Artist",
                "KeyType": "HASH"
            },
            {
                "AttributeName": "SongTitle",
                "KeyType": "RANGE"
            }
        ],
        "TableStatus": "ACTIVE",
        "CreationDateTime": 1568185708,
        "ProvisionedThroughput": {
            "ReadCapacityUnits": 5,
            "WriteCapacityUnits": 5
        },
        "TableId": "f47fa3c0-d462-11e9-a47e-000000000000"
    }
}

Example from: https://docs.aws.amazon.com/cli/latest/reference/dynamodb/create-table.html#examples

Clone this wiki locally