Amazon QLDB driver for Go - Amazon Quantum Ledger Database (Amazon QLDB)

Amazon QLDB driver for Go

To work with data in your ledger, you can connect to Amazon QLDB from your Go application by using an AWS-provided driver. The following topics describe how to get started with the QLDB driver for Go.

Driver resources

For more information about the functionality supported by the Go driver, see the following resources:

Prerequisites

Before you get started with the QLDB driver for Go, you must do the following:

  1. Follow the AWS setup instructions in Accessing Amazon QLDB. This includes the following:

    1. Sign up for AWS.

    2. Create an AWS Identity and Access Management (IAM) user with the appropriate QLDB permissions.

    3. Get an IAM access key for development.

  2. (Optional) Install an integrated development environment (IDE) of your choice. For a list of commonly used IDEs from the Go ecosystem, see Editor plugins and IDEs on the Go website.

  3. Download and install one of the following versions of Go from the Go downloads site:

    • 1.15 or later – QLDB driver for Go v3

    • 1.14 – QLDB driver for Go v1 or v2

  4. Configure your development environment for the AWS SDK for Go:

    1. Set up your AWS credentials. We recommend creating a shared credentials file.

      For instructions, see Specifying Credentials in the AWS SDK for Go Developer Guide.

    2. Set your default AWS Region. To learn how, see Specifying the AWS Region.

      For a complete list of available Regions, see Amazon QLDB endpoints and quotas in the AWS General Reference.

Next, you can set up a basic sample application and run short code examples—or you can install the driver in an existing Go project.

  • To install the QLDB driver and the AWS SDK for Go in an existing project, proceed to Installation.

  • To set up a project and run short code examples that demonstrate basic data transactions on a ledger, see the Quick start tutorial.

Installation

The QLDB driver for Go is open-sourced in the GitHub repository awslabs/amazon-qldb-driver-go. QLDB supports the following driver versions and their Go dependencies.

Driver version Go version Status Latest release date
1.x 1.14 or later Production release June 16, 2021
2.x 1.14 or later Production release July 21, 2021
3.x 1.15 or later Production release August 11, 2022

To install the driver

  1. Ensure that your project is using Go modules to install project dependencies.

  2. In your project directory, enter the following go get command.

    3.x
    $ go get -u github.com/awslabs/amazon-qldb-driver-go/v3/qldbdriver
    2.x
    $ go get -u github.com/awslabs/amazon-qldb-driver-go/v2/qldbdriver

Installing the driver also installs its dependencies, including the AWS SDK for Go or AWS SDK for Go v2, and Amazon Ion packages.

For short code examples of how to run basic data transactions on a ledger, see the Cookbook reference.