Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/asaaki/rust-wasm-on-lambda-edge
Rust/WASM on AWS Lambda@Edge (CloudFront)
https://github.com/asaaki/rust-wasm-on-lambda-edge
aws aws-cloudfront aws-lambda aws-lambda-edge cloudfront nodejs rust rust-lang wasm wasm-bindgen wasm-pack
Last synced: 2 months ago
JSON representation
Rust/WASM on AWS Lambda@Edge (CloudFront)
- Host: GitHub
- URL: https://github.com/asaaki/rust-wasm-on-lambda-edge
- Owner: asaaki
- License: apache-2.0
- Created: 2021-01-16T18:30:49.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-21T16:49:08.000Z (3 months ago)
- Last Synced: 2024-10-22T05:48:10.755Z (3 months ago)
- Topics: aws, aws-cloudfront, aws-lambda, aws-lambda-edge, cloudfront, nodejs, rust, rust-lang, wasm, wasm-bindgen, wasm-pack
- Language: Rust
- Homepage: https://markentier.tech/posts/2021/01/rust-wasm-on-aws-lambda-edge/
- Size: 1.5 MB
- Stars: 29
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE-APACHE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# Rust/Wasm on AWS Lambda@Edge (CloudFront)
**Read the accompanying [blog post][mt-post] to this project.**
Since we still cannot have native Rust (or WebAssembly for that matter) on AWS Lambda@Edge, we have to come up with our own solution.
Here I present mine: using the AWS Lambda Node.js enviroment to execute our Wasm blob generated from Rust code.## tl;dr
```sh
make build
make call
make zip
# upload to your AWS Lambda and attach it to a CloudFront distribution (as viewer request trigger)
# check the Cloudwatch logs in the regions you made requests
# be happy - Have a nice day!
```This demo doesn't do anything fancy. In fact, it does not alter the request at all and only passes it through as-is.
The function will make a few log statements, check the Cloudwatch logs in the regions you received requests for your CloudFront distribution.
This setup is good to test for the baseline performance.
After the cold-start some requests later the function duration should be **around 1 to 2 ms.**
Depending on the region and where you are, this translates to 40 to 50 ms in request latency for a small static asset,
while without any trigger attached the same request would take around 25 ms.## License
Licensed under either of Apache License, Version
2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
be dual licensed as above, without any additional terms or conditions.[mt-post]: https://markentier.tech/posts/2021/01/rust-wasm-on-aws-lambda-edge/