1

I have a lambda function that retrieves records from AWS Aurora Serverless db. Now I thought of adding api gateway to trigger the lambda function but I get this error Connect an AWS Lambda function triggered by API Gateway to Aurora Serverless MySQL database.

[ERROR] BadRequestException: An error occurred (BadRequestException) when calling the ExecuteStatement operation: 
Access denied for user 'admin'@'10.x.xx.xxx' (using password: YES); Error code: 1045; SQLState: 28000
Traceback (most recent call last):
  File "/var/task/index.py", line 11, in handler
    sql="SELECT * FROM ecomdev.Customer;"

What is causing BadRequestException when calling the ExecuteStatement operation on Aurora Serverless db. I have used AWS CDK to create the stacks. I went through this question But it follows a different which I feel is not necessary. Please help me out if you have encountered this error.

sji gshan
  • 11
  • 1

1 Answers1

0

Error 1045 apparently means 'Access denied'. Have you set the credentials properly in your Lambda? Does the lambda use the right execution role? Seems to be some more good info here.

shearn89
  • 3,403
  • 2
  • 15
  • 39