Example on how to use non-bundled AWS SDK Clients & Utils
We lack an example on how to use clients and SDKs that are not provided with LLRT.
Hi @richarddavison,
I think this initiative will make LLRT more user-friendly.
From what I have worked on locally, here are some points to consider:
- When adding a new
@aws-sdkmodule, which version should I adopt? - How do I prove that the module I want to bundle is "popular" and get approval for bundling?
I can't contribute directly to this issue because I can't write English, but I would like to contribute by following the documentation and working on the @aws-sdk/lib-storage bundle.
Please note that this text was translated by DeepL :)
Hi, I tried using client-ecs in LLRT, and managed to get it working.
The main points were:
- set bundle target platform to browser
- pass credentilas and region explicitly from Lambda environment variables
- mark uuid as external
Here's the actual code that I used: https://github.com/tmokmss/cdk-lambda-llrt/pull/4/files
When I wanted to use LLRT as a runtime for CLI, the ideal platform would be node even though LLRT doesn't support full Node.js features. Why does it require to set browser?
Also, bundled SDKs are hard to control their versions by users. It would be better to provide flexibility to let users decide whether they want to import SDKs explicitly, or use the bundled versions.
Hi @riywo. Thanks for your comment, these are valid concerns .LLRT provides SDKs for since they have been optimized specifically for optimal performance on Lambda (with some dependencies replaced with Rust implementations, such as XML parsing). The reason why we target browsers is that the browser API more closely matches what you get out of the box with LLRT, and wouldn’t work with AWS SDK otherwise (without explicit config, mainly due to the lack of http and https modules). We’ll update the repo with an example on how to add non-provided SDKs. We may also add a non-bundled build of LLRT in the future (already possible to do if building from source with a feature flag). Hope this makes sense.
Fixed in: https://github.com/awslabs/llrt/pull/410