From 946c9de914e5e6f700d046ba929c2a342b573a75 Mon Sep 17 00:00:00 2001
From: Pat Hickey
Date: Tue, 10 Mar 2026 14:37:47 -0700
Subject: [PATCH] no more wstd-aws crate: instead example shows upstreamed
functionality
---
.github/workflows/ci.yaml | 2 +-
Cargo.toml | 9 +-
{aws => aws-example}/.gitignore | 0
aws-example/Cargo.toml | 26 +++++
{aws => aws-example}/README.md | 53 ++++++----
{aws/examples => aws-example/src/bin}/s3.rs | 23 ++---
aws/Cargo.toml | 31 ------
aws/src/lib.rs | 101 --------------------
test-programs/build.rs | 59 ++++++++----
test-programs/tests/aws_s3.rs | 35 ++-----
10 files changed, 122 insertions(+), 217 deletions(-)
rename {aws => aws-example}/.gitignore (100%)
create mode 100644 aws-example/Cargo.toml
rename {aws => aws-example}/README.md (51%)
rename {aws/examples => aws-example/src/bin}/s3.rs (87%)
delete mode 100644 aws/Cargo.toml
delete mode 100644 aws/src/lib.rs
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 026420a..1362609 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -52,7 +52,7 @@ jobs:
run: cargo check --workspace --all --bins --examples
- name: wstd tests
- run: cargo test -p wstd -p wstd-axum -p wstd-aws --target wasm32-wasip2 -- --nocapture
+ run: cargo test -p wstd -p wstd-axum --target wasm32-wasip2 -- --nocapture
- name: test-programs tests
run: cargo test -p test-programs -- --nocapture
diff --git a/Cargo.toml b/Cargo.toml
index 79c0f74..3519604 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -44,7 +44,7 @@ serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
[workspace]
-members = ["aws",
+members = [
"axum",
"axum/macro",
"macro",
@@ -59,7 +59,7 @@ license = "Apache-2.0 WITH LLVM-exception"
repository = "https://github.com/bytecodealliance/wstd"
keywords = ["WebAssembly", "async", "stdlib", "Components"]
categories = ["wasm", "asynchronous"]
-rust-version = "1.88"
+rust-version = "1.91.1"
authors = [
"Yoshua Wuyts ",
"Pat Hickey ",
@@ -69,11 +69,6 @@ authors = [
[workspace.dependencies]
anyhow = "1"
async-task = "4.7"
-aws-config = { version = "1.8.8", default-features = false }
-aws-sdk-s3 = { version = "1.108.0", default-features = false }
-aws-smithy-async = { version = "1.2.6", default-features = false }
-aws-smithy-types = { version = "1.3.3", default-features = false }
-aws-smithy-runtime-api = { version = "1.9.1", default-features = false }
axum = { version = "0.8.6", default-features = false }
bytes = "1.10.1"
cargo_metadata = "0.22"
diff --git a/aws/.gitignore b/aws-example/.gitignore
similarity index 100%
rename from aws/.gitignore
rename to aws-example/.gitignore
diff --git a/aws-example/Cargo.toml b/aws-example/Cargo.toml
new file mode 100644
index 0000000..1e4f034
--- /dev/null
+++ b/aws-example/Cargo.toml
@@ -0,0 +1,26 @@
+[package]
+name = "wstd-aws-example"
+description = "demonstrate use of aws-smithy-wasm wstd support"
+publish = false
+version = "0.6.5"
+edition = "2024"
+license = "Apache-2.0 WITH LLVM-exception"
+repository = "https://github.com/bytecodealliance/wstd"
+keywords = ["WebAssembly", "async", "stdlib", "Components"]
+categories = ["wasm", "asynchronous"]
+rust-version = "1.91.1"
+authors = [
+ "Pat Hickey ",
+]
+[[bin]]
+name = "s3"
+
+[dependencies]
+anyhow = "1"
+clap = { version = "4.5", features = ["derive"] }
+aws-config = { version = "1.8.15", default-features = false }
+aws-sdk-s3 = { version = "1.125.0", default-features = false }
+aws-smithy-wasm = "0.1.10"
+wstd = "0.6.5"
+
+[workspace]
diff --git a/aws/README.md b/aws-example/README.md
similarity index 51%
rename from aws/README.md
rename to aws-example/README.md
index d404bcd..8c391c1 100644
--- a/aws/README.md
+++ b/aws-example/README.md
@@ -1,8 +1,23 @@
-# wstd-aws: wstd support for the AWS Rust SDK
+# wstd-aws-example: using wstd support in the AWS Rust SDK
-This crate provides support for using the AWS Rust SDK for the `wasm32-wasip2`
-target using the [`wstd`] crate.
+The AWS Rust SDK has support for using the [`wstd`] crate on the
+`wasm32-wasip2` target to use the wasi-http interface. This example shows how
+to use it.
+
+## TL;DR
+
+* depend on `aws-*` crates released recently enough to have MSRV of 1.91.1 (on
+ or after March 4, 2026). Use `default-features = false` so tokio doesn't get
+ sucked in.
+* depend on `aws-smithy-wasm` and setup your `Config` with:
+ ```
+ config
+ .sleep_impl(aws_smithy_wasm::wasi::WasiSleep)
+ .http_client(aws_smithy_wasm::wasi::WasiHttpClientBuilder::new().build())
+ ```
+
+## Explanation
In many wasi settings, its necessary or desirable to use the wasi-http
interface to make http requests. Wasi-http interfaces provide an http
@@ -17,14 +32,16 @@ and if they do, they will not use the wasi-http interfaces. To avoid using
http over sockets, make sure to set the `default-features = false` setting
when depending on any `aws-*` crates in your project.
-To configure `wstd`'s wasi-http client for the AWS Rust SDK, provide
-`wstd_aws::sleep_impl()` and `wstd_aws::http_client()` to your
+To configure the AWS Rust SDK to use `wstd`'s wasi-http client, use the
+[`aws_smithy_crate`](https://docs.rs/aws-smithy-wasm/latest/aws_smithy_wasm/)
+at version 0.10.0 or later. Provide `aws_smithy_wasm::wasi::WasiSleep` and
+`aws_smithy_wasm::wasi::WasiHttpClientBuilder::new().build()` to your
[`aws_config::ConfigLoader`]:
```
let config = aws_config::defaults(BehaviorVersion::latest())
- .sleep_impl(wstd_aws::sleep_impl())
- .http_client(wstd_aws::http_client())
+ .sleep_impl(aws_smithy_wasm::wasi::WasiSleep)
+ .http_client(aws_smithy_wasm::wasi::WasiHttpClientBuilder::new().build())
...;
```
@@ -44,11 +61,12 @@ a single function.
Compile it with:
```sh
-cargo build -p wstd-aws --target wasm32-wasip2 --release --examples
+cargo build -p wstd-aws-example --target wasm32-wasip2 --release
```
When running this example, you will need AWS credentials provided in environment
-variables.
+variables, and you should substitute in a region and bucket where your
+credentials have permissions to list the bucket and read items.
Run it with:
```sh
@@ -57,19 +75,20 @@ wasmtime run -Shttp \
--env AWS_SECRET_ACCESS_KEY \
--env AWS_SESSION_TOKEN \
--dir .::. \
- target/wasm32-wasip2/release/examples/s3.wasm
+ target/wasm32-wasip2/release/s3.wasm \
+ --region us-west-2 \
+ --bucket wstd-example-bucket
```
or alternatively run it with:
```sh
-cargo run --target wasm32-wasip2 -p wstd-aws --example s3
+cargo run --target wasm32-wasip2 -p wstd-aws-example --example s3 -- \
+ --region us-west-2 --bucket wstd-example-bucket
```
-
which uses the wasmtime cli, as above, via configiration found in this
-workspace's `.cargo/config`.
-
-By default, this script accesses the `wstd-example-bucket` in `us-west-2`.
-To change the bucket or region, use the `--bucket` and `--region` cli
-flags before the subcommand.
+workspace's `.cargo/config.toml`.
+By default, the subcommand `list` will be run, listing the contents of the
+bucket. To get an item from the bucket, use the subcommand `get [-o
+