S3 Object Lambda Support #479
Answered
by
calavera
drauziooppenheimer
asked this question in
Q&A
|
Hi, is there any way to implement S3 Object Lambdas with the current runtime and, if so, is there any documentation/example of it? |
Answered by
calavera
May 11, 2022
Replies: 1 comment 2 replies
|
Yes, that's possible. You'll need to write the struct to represent the S3ObjectEvent because it doesn't look like it's defined in the Looking at the examples, in the documentation, this is how the code would look like, roughly: use lambda_runtime::{service_fn, Error, LambdaEvent};
use aws_lambda_events::s3::object_lambda::S3ObjectLambdaEvent;
pub(crate) async fn my_handler(event: LambdaEvent<S3ObjectLambdaEvent>) -> Result<(), Error> {
let object = event.payload.;
// Do something useful with the object here
Ok(())
}You can use the S3 SDK to write responses: https://docs.rs/aws-sdk-s3/0.11.0/aws_sdk_s3/client/struct.Client.html#method.write_get_object_response Let me know if that helps. |
2 replies
Answer selected by
drauziooppenheimer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, that's possible. You'll need to write the struct to represent the S3ObjectEvent because it doesn't look like it's defined in the
aws_lambda_eventscrate.Looking at the examples, in the documentation, this is how the code would look like, roughly:
You can use the S3 SDK to write responses:
https://docs.rs/aws-sdk-s3/0.11.0/aws_sdk_s3/client/struct.Client.html#method.write_get_object_r…