d95cc86400
## Motivation and Context <!--- Why is this change required? What problem does it solve? --> <!--- If it fixes an open issue, please link to the issue here --> This change adds a new crate, `aws-smithy-wasm`, that exports a SDK compatible WASI http client. This is a continuation of the work in #2520 using the now stabilized WASI 0.2.0 interfaces from the [wasi crate](https://crates.io/crates/wasi). This supports, but does not finalize the work for #2087 ## Description <!--- Describe your changes in detail --> Add a new crate, `aws-smithy-wasm` which exports a function `wasi_http_client` that will provide the user with a WASI compatible http client. This client is implemented by using the `wasi::http::outgoing_handler` [ref](https://docs.rs/wasi/0.12.0+wasi-0.2.0/wasi/http/outgoing_handler/index.html) along with some utility implementations of `TryFrom` to transform back and worth between the types from the `http` crate and the `wasi::http` types. It also exports a unit struct `WasmSleep` that impls the `AsyncSleep` trait needed by the SDK. ## Testing <!--- Please describe in detail how you tested your changes --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> This is tested via an integration test in `aws/sdk/integration-tests/webassembly` that uses the wasi http-client to vuild a config and an operation (that is not sent). It is further tested in a new canary (`wasm_canary`) that calls the S3 `list_objects_v2` API. ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [X] I have updated `CHANGELOG.next.toml` if I made changes to the smithy-rs codegen or runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._ --------- Co-authored-by: Eduardo Rodrigues <eduardomourar@users.noreply.github.com> Co-authored-by: Eduardo de Moura Rodrigues <16357187+eduardomourar@users.noreply.github.com> Co-authored-by: ysaito1001 <awsaito@amazon.com> Co-authored-by: John DiSanti <jdisanti@amazon.com> Co-authored-by: Russell Cohen <rcoh@amazon.com> Co-authored-by: John DiSanti <john@vinylsquid.com> |
||
---|---|---|
.. | ||
audio | ||
src | ||
.gitignore | ||
README.md |
README.md
Canary Lambda
This is a Rust Lambda that exercises the AWS SDK for Rust in a real Lambda
environment. It is intended to be rebuilt with the latest or previous AWS
SDK version in the aws-sdk-rust
repository, deployed, and then run to
determine that that version is still OK.
For example, after releasing a new version of the SDK to crates.io, this can be compiled against that new version, deployed, and run to verify the deployed SDK is functioning correctly. Similarly, it can be used to verify the previous version of the SDK continues to work after the deployment of the new version.
Running the canary locally
For testing, it's helpful to be able to run the canary locally. To accomplish this, you first need to generate a Cargo.toml:
cd ../canary-runner
# to use a version of the SDK, use `--sdk-version` instead
cargo run -- build-bundle \
--sdk-path ../../../aws/sdk/build/aws-sdk/sdk/ \
--canary-path ../canary-lambda \
--manifest-only
Next, come back to the canary-lambda
directory where you can use cargo run
in --local
mode to
invoke the canary:
Note: if your default configuration does not provide a region, you must provide a region via the
AWS_REGION
environment variable.
export CANARY_S3_BUCKET_NAME=<your bucket name>
export CANARY_S3_MRAP_BUCKET_ARN=<your MRAP bucket ARN>
# run with `--all-features` so you run all canaries (including canaries that don't work against older versions)
cargo run --all-features -- --local
Building locally for Lambda from Amazon Linux 2
- Build a code bundle:
$ cd smithy-rs/tools/ci-cdk/canary-runner
$ cargo run -- build-bundle --canary-path ../canary-lambda --sdk-release-tag <release-tag> --musl
This will place a zip file in smithy-rs/target/release
that can be uploaded and tested against Lambda.
Building locally for Lambda from non Amazon Linux 2 system
- Make sure the
musl-gcc
wrapper is installed. - Add the musl target for Rust:
$ rustup target add x86_64-unknown-linux-musl
- Build a code bundle:
$ cd smithy-rs/tools/ci-cdk/canary-runner
$ cargo run -- build-bundle --canary-path ../canary-lambda --sdk-release-tag <release-tag> --musl
This will place a zip file in smithy-rs/target/x86_64-unknown-linux-musl/release
that can be
uploaded and tested against Lambda.
How to add a new canary
The canary Lambda runs a list of canaries in parallel asynchronously. To add a new canary, do the following:
- If new permissions are required, grant them to the OIDC role that is used to
run the canary Lambda using the CDK in the
tools/ci-cdk/
directory. Be sure to deploy these changes to the canary AWS account. - Add a new module to this
canary-lambda/
project to hold the canary code. This should be implemented as an async function that returns an empty result. - Wire up the new canary in the
get_canaries_to_run
function in thecanary
module.