These examples demonstrate how to perform several Amazon Quantum Ledger Database (Amazon QLDB) operations using the developer preview version of the AWS SDK for Rust.
Amazon QLDB) is a fully managed ledger database that provides a transparent, immutable, and cryptographically verifiable transaction log owned by a central trusted authority.
- Create a ledger (CreateLedger)
- List your ledgers (ListLedgers)
- Start a ledger session (StartSession)
- We recommend that you grant this code least privilege, or at most the minimum permissions required to perform the task. For more information, see Grant Least Privilege in the AWS Identity and Access Management User Guide.
- This code has not been tested in all AWS Regions. Some AWS services are available only in specific Regions.
- Running this code might result in charges to your AWS account.
You must have an AWS account, and have configured your default credentials and AWS Region as described in https://github.com/awslabs/aws-sdk-rust.
This code example creates an Amazon QLDB ledger in the Region.
cargo run --bin create-ledger -l LEDGER [-r REGION] [-v]
where:
- LEDGER is the name of the ledger to create.
- REGION is the region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
- -v enables displaying additional information.
This code example lists your Amazon QLDB ledgers in the Region.
cargo run --bin list-ledgers [-r REGION] [-v]
where:
- REGION is the region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
- -v enables displaying additional information.
This code example creates a low-level Amazon QLDB session against a ledger in the Region.
Avoid using the QldbSession API directly. Instead, use a higher-level driver, such as the Amazon QLDB Driver for Rust.
cargo run --bin qldb-helloworld -l LEDGER [-r REGION] [-v]
where:
- LEDGER is the name of the ledger to create the session against.
- REGION is the region in which the client is created. If not supplied, uses the value of the AWS_REGION environment variable. If the environment variable is not set, defaults to us-west-2.
- -v enables displaying additional information.
- AWS SDK for Rust repo
- AWS SDK for Rust API Reference for Amazon QLDB
- AWS SDK for Rust API Reference Guide
To propose a new code example to the AWS documentation team, see CONTRIBUTING.md. The team prefers to create code examples that show broad scenarios rather than individual API calls.
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. SPDX-License-Identifier: Apache-2.0