How to Allow AWS Lambda to access RDS Data API in Java SAM offline

220 views Asked by At

I am trying to access my Aurora Serverless DB from an AWS Lambda function I am developing using SAM and Java 8. I have added the appropriate policies to the template.yaml file. When I try to execute the Lambda offline using sam local invoke, I get:

"errorMessage":"The security token included in the request is invalid. (Service: AWSRDSData; Status Code: 403; Error Code: UnrecognizedClientException

When I deploy the application and run the Lambda from the console, everything runs just fine.

Also, I tried mirroring the function in Python using the same policies in the template.yaml file, everything worked fine both offline and deployed.

Is there something else I need to do in Java to make this work offline?

0

There are 0 answers