AWS Developer Tools Blog
A New AWS SDK for Rust – Alpha Launch
We’re excited to announce the alpha release of a new AWS SDK for Rust. AWS customers developing in Rust want a native Rust SDK so they can use the language constructs they are used to, and customers new to Rust want an SDK that behaves similarly to SDKs they have used in other language environments. With this alpha release, customers can try clients for seven AWS services and give feedback on ergonomics and usability.
I’ve been a co-maintainer of Rusoto, a community-developed AWS SDK for Rust, for the past year. On behalf of AWS, I want to thank the original authors, all my other co-maintainers, and the community who worked to build Rusoto since its first release in 2015. Maintaining functionality for the wide breadth of AWS services is incredibly difficult. I am proud to see how important that work has been for our customers.
Our primary design goal for the new SDK is to enable customer usage of new AWS Service APIs when they launch. Just like our newer SDKs, AWS used the Smithy toolchain and service models to build AWS SDK for Rust. In addition to enabling the use of new services on Day 1, this SDK contains features to create greater reliability and consistency in the developer experience. It will include AWS standard retry logic and consistent credential provider support as other AWS SDKs by the time of GA.
The AWS SDK for Rust alpha release we are launching today allows you to try clients for seven AWS services: Amazon DynamoDB, Amazon API Gateway, Amazon Kinesis, AWS Key Management Service, Amazon Polly, AWS Secrets Manager and Amazon Quantum Ledger Database. We are making the alpha version of the SDK available to the community to get your feedback early and incorporate your input into the design and implementation of this SDK. We are sharing our roadmap, which outlines the plan for adding features and support for all AWS services. We would love to hear your thoughts on what features and services are most important for you via GitHub Issues and Discussions. As the SDK approaches its production-ready GA launch, we will provide documentation for migrating from Rusoto to the new SDK. We will support the SDK following our standard maintenance policy at the GA launch.
Let’s dive in!
Getting Started with the SDK
During the alpha, you can install the SDK via a Git dependency. We’ll publish to crates.io when the SDK is Generally Available.
Here is an example of how to get started with the new AWS SDK for Rust, using DynamoDB to perform a common operation. Many more detailed examples are available in the SDK repository. This example assumes you already have Rust and Cargo installed. If you don’t, follow the instructions provided by Rust to install Rust and Cargo.
Instructions to get started:
- Create a new Rust project
- Within your Cargo.toml file, add dependencies for DynamoDB and Tokio
[dependencies]
aws-sdk-dynamodb = { git = "https://github.com/awslabs/aws-sdk-rust", tag = "v0.0.3-alpha"}
tokio = { version = "1", features = ["full"] }
3. Input your AWS credentials into your terminal as environment variables. Note: The alpha SDK only supports environment variable credential providers at this time.
# On Unix/MacOS/Linux
export AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
export AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
export AWS_DEFAULT_REGION=us-east-1
# On Windows
set AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
set AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
set AWS_DEFAULT_REGION=us-east-1
4. Make a request using DynamoDB:
#[tokio::main]
async fn main() -> Result<(), aws_sdk_dynamodb::Error> {
let client = aws_sdk_dynamodb::Client::from_env();
let req = client.list_tables().limit(10);
let resp = req.send().await?;
println!("Current DynamoDB tables: {:?}", resp.table_names.unwrap_or_default());
Ok(())
}
Today, the SDK only supports the Tokio async runtime and credentials from environment variables. Before SDK is generally available, we will implement standard credential providers. We are exploring ways to support multiple Rust async runtimes.
Contributing to the SDK’s development
Make sure to check out the contributing guide to get the latest information. Here’s how you can help and provide feedback:
- Try out the SDK and let us know where it could be improved – For the services the SDK supports, let us know if you run into any issues by submitting a GitHub Issue or starting a GitHub Discussion. Also, be sure to add your comments and “+1”s to GitHub Issues that have already been submitted to help us prioritize and plan effectively.
- Report defects – Inevitably, we expect there to be bugs in this alpha release. If you find one, let us know by submitting a GitHub Issue.
- Review the docs – It is essential the SDK docs are clear, accurate and up to date so everyone can successfully use the SDK. If you find an issue with the documentation, open an issue, or even better, submit a PR.
- Request for Comments (RFCs) – We are adding RFCs to the repo to propose major changes to the SDK. We will continually add more as we develop the SDK. Please review them, let us know what you think, and feel free to add your own!
- Help us prioritize high level libraries – Beyond the core SDK, high level libraries built on top of the SDK (like the S3 Encryption Client or the DynamoDB Mapper) make some AWS services easier to use. Let us know which libraries are most important to you via a GitHub Discussions.
The SDK’s Public Roadmap
The SDK currently provides support for AWS services that use the AWS JSON 1.0, AWS JSON 1.1, and restJson1 protocols. We will be adding support for more services as we expand our protocol support. You can find the complete list of the AWS services the SDK currently supports in our GitHub repository. You can follow our plans to add support for the remaining AWS services by reviewing our public roadmap on GitHub. The roadmap also includes new features we plan on adding, like new functionality for AWS services and support for additional credential providers. The purpose of the roadmap is to keep the community informed about what’s coming. We will keep this roadmap up to date with the team’s progress. Please add a “+1” to features most important to you. Your votes will help us prioritize our roadmap.
Give it a Try
The getting started guide is a great place to start using the SDK. Check it out and let us know what do you think!
We’re Hiring
The AWS SDK for Rust team is looking for developers to join our team. If you’d like to join, please see the open positions on our team.