lambdr icon indicating copy to clipboard operation
lambdr copied to clipboard

S3

Open YouNeedJ opened this issue 1 year ago • 6 comments

hello, I am Johann Falla from Colombia and I am using the tutorial "https://mdneuzerling.com/post/r-on-aws-lambda-with-containers/", I generate a .RDATA file that has some functions and when I implement the lambda to make the call to the s3 generates me error "{ "error_message": "Error in parse_aws_s3_response(r, Sig, verbose = verbose) "error_message: "Error in parse_aws_s3_response(r, Sig, verbose = verbose): Bad Request (HTTP 400).\n" }" I already gave the lambda permission to use s3, also inside the function in sagemaker I put Sys.setenv("AWS_ACCESS_KEY_ID"="xxxxxxxx", "AWS_SECRET_ACCESS_KEY"="xxxxxxx", "AWS_DEFAULT_REGION"="us-east-1") what could I be missing, Thank you

Translated with www.DeepL.com/Translator (free version)

YouNeedJ avatar Oct 10 '22 20:10 YouNeedJ

I'm also not able to access my S3 bucket from within lambda after setting the ENV variables & including a credentials file

phoward38 avatar Oct 13 '22 16:10 phoward38

I solved it, the credentials are ok when we are in console, but they must be removed to use the function from the lambda, and the lambda must be given s3 permission.

YouNeedJ avatar Oct 13 '22 17:10 YouNeedJ

@YouNeedJ Do you mind explaining how you authenticate to s3? I've given lambda s3 permissions, but I'm not sure what you mean by:

they must be removed to use the function from the lambda

Would really appreciate it!

phoward38 avatar Oct 13 '22 19:10 phoward38

this is the function with the authentication parameters:

            Sys.setenv("AWS_ACCESS_KEY_ID"="xxxxxxxx",
            "AWS_SECRET_ACCESS_KEY"="xxxxxxx",
            "AWS_DEFAULT_REGION"="us-east-1")

             s3load(object = "xxxxxxxxxxxxxxxxx", bucket = "xxxxxxxx")
                          

This is how it works in the Jupyter Notebook, but in order to upload the function already in the lambda you must remove the authentication parameters, so that the role of the lambda and the authentication of the code do not conflict, so that the final code remains:

              s3load(object = "xxxxxxxxxxxxxxxxx", bucket = "xxxxxxxx")
            

YouNeedJ avatar Oct 13 '22 19:10 YouNeedJ

What error do you get when trying to log in?

YouNeedJ avatar Oct 13 '22 20:10 YouNeedJ

@YouNeedJ That was the issue! Thanks so much

phoward38 avatar Oct 13 '22 21:10 phoward38