Alternator API - connect to Scylla using Golang

I am trying to write a client in Golang using AWS SDK to connect to Scylla through Alternator interface. I was able to do that in python using this script:

import boto3
dynamodb = boto3.resource('dynamodb', endpoint_url='http://localhost:8000',
                          region_name='None', aws_access_key_id='None', aws_secret_access_key='None')

dynamodb.create_table(
    AttributeDefinitions=[
        {
            'AttributeName': 'key',
            'AttributeType': 'S'
        },
    ],
    BillingMode='PAY_PER_REQUEST',
    TableName='display_name_tagging',
    KeySchema=[
        {
            'AttributeName': 'key',
            'KeyType': 'HASH'
        },
    ])

Does anyone know how would I do that in Golang and AWS SDK?

As previously answered via Slack, you can find a nice example on how to integrate the AWS SDK for Go with Alternator under alternator-load-balancing/try.go at master · scylladb/alternator-load-balancing · GitHub

The example in question makes use of our Alternator Load Balancing library to ensure requests are load balanced automatically on the client side. Should you not be using it, just remove the references to the library and proceed as usual.

Cheers!

1 Like