AWS SDK for Rust
BETA! - Breaking Changes
The primary testing going on right now is for V2 signatures for support of older S3 compatible systems and third party applications that use an S3 interface. V4 signatures may fail at the moment but this will change real soon.
AWS SDK with initial emphasis on S3. Supports both V2 and V4 authentication signatures. Allows for custom app config, environment variables, standard /.aws/credentials and future Iam credentials. No environmental assumptions or opinions are made on how your access to AWS should be handled.
S3
The initial access is for solid AWS S3 support. The SDK is built to allow non-aws environments that support an S3 API interface such as Ceph and other object stores to accessible from Rust.
Proxy
In many corporate environments the use of proxies are mandatory. Proxies are usually handled by setting the following environment variables:
http_proxy=<whatever your proxy url>:<whatever port if any>
https_proxy=<whatever your proxy url>:<whatever port if any>
no_proxy=<whatever IPs, domains, hosts, etc that should not go through a proxy (separate by commas)>
You can also pass in the proxy settings via Url to the S3Client or pass in None
. This will allow you to use your own config file if desired so that you can read in the proxy settings and pass them S3Client.
Configuring Credentials
Before using the SDK, ensure that you've configured credentials. The best
way to configure credentials on a development machine is to use the
~/.aws/credentials
file, which might look like:
[default]
aws_access_key_id = <whatever access_key_id>
aws_secret_access_key = <whatever secret_access_key>
You can learn more about the credentials file from this blog post.
Alternatively, you can set the following environment variables:
AWS_ACCESS_KEY_ID=<whatever access_key_id>
AWS_SECRET_ACCESS_KEY=<whatever secret_access_key>
Using the Rust SDK
To use a service in the SDK, create a service variable by calling the S3Client::new(...)
function. Once you have a service client, you can call API operations which each
return response data and a possible error.
To list buckets from S3, you could run:
// NOTE: See the src/main.rs for more examples...
extern crate aws_sdk_rust;
extern crate url;
extern crate hyper;
use DefaultCredentialsProvider;
use Region;
use Endpoint;
use S3Client;
Inspiration
If you need access to other AWS systems instead of S3 then take a look at rusoto (https://github.com/rusoto/rusoto). Initial inspiration comes from there, Python Boto3 and aws-sdk-go.
Library Development
Paths
Structure is broken down into the following paths:
common
errors
s3
XML
AWS S3 uses XML for transmitting and receiving (headers too). At this time there are no good implementations of XML Serialization (serde works for Deserialization) so each XML construct for sending and receiving from S3 had to be defined with a parser/writer (project rusoto did a lot of the heavy lifting in this area).
Other AWS Services primarily use JSON and De/Serialization is possible for those service.