Error "The security token included in the request is invalid" invoking lambda function url

0

Hi,

This is the follow up of this question - https://repost.aws/questions/QUE8NpRj91RW-9p1MiOv9iYQ/calling-iam-auth-function-urls-from-lambda

I am trying to invoke the lambda with function url (lets name this as "funcUrlLambda" ) from another lambda (lets say this as "apiGwLambda"). I have given apiGwLambda role permission in funcUrlLambda. In apiGwLambda, I am doing the signv4 with the access key and secret key from lambda env variables.

For signV4, I am using the code from these links https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-examples-using-sdks.html#sig-v4-examples-using-sdk-java https://docs.aws.amazon.com/AmazonS3/latest/API/samples/AWSS3SigV4JavaSamples.zip

But I am getting this error {"message":"The security token included in the request is invalid."} from funcUrlLambda. It would be super helpful if some one could provide help on this ?

Code getting the access key and secret key in lambda

        val accessKey = System.getenv("AWS_ACCESS_KEY_ID")
        val secretKey = System.getenv("AWS_SECRET_ACCESS_KEY")
1 Answer
0

Hi, I would suggest that you try the Lambda URL with No-Auth option first, just to pinpoint the issue: is it related to the execution role (permissions) of the apiGwLambda, or, is it purely related to access tokens provided.

Could you provide the policy used by the execution role of apiGwLambda as well (assuming this is the lambda that will actually invoke funcUrlLambda)?

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions