Global SDK definition #777
-
Hello! It is considered best practice to define the AWS SDK globally outside of the lambda handler so that it can be used around the same Lambda instance in a warm start. However, as a Rust newbie, I don't know how to do that with aws_sdk_rust, or if I need to do it in the first place. The code looks terribly complicated to try to make it happen, especially since asynchronous functions are required during the initialization process of the SDK. What can I do about this problem? Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I realized that I might as well simply pass the SDK initialized as a local variable to run() as an argument before doing Is there any problem with this other than the function signatures getting slightly messy? |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Your solution sounds fine to me, with the caveat that I'm not a lambda expert and I haven't run any performance tests.
Also, and my apologies if you've already tried this, but you may get a more authoritative answer asking this question of the aws-lambda-rust-runtime folks.