How to query an AWS RDS service through the AWS API?

Asked

Viewed 50 times

0

I have an AWS RDS service database and an API on AWS API GATEWAY services. One of the data request options when creating methods is to use other AWS services.

Researching this post i saw that it is not possible to directly access the RDS data. For this you would have to use a lambda function and pass the query.

Could someone explain how to access a RDS through the Lambda API Gateway?

1 answer

0

You would have to create a Gateway API pointing to the Lambda function that will make the Query via your preferred programming language, a tip is to create the lambda function first and then create the API, when creating it you will already have the option to link with the Lambda function.

Be aware of the Return syntax that the Lambda function will need to obey.

In Node.js it is more or less like this:

  var response = {
    "statusCode": 200,
    "headers": {
                "isBase64Encoded": "true",
            "Access-Control-Allow-Origin" : "*",
            'Access-Control-Allow-Credentials' : true
         },
    "body": JSON.stringify(returnString)};

};

callback(null, response);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.