How do I query an AWS RDS service through the AWS API?

0

I have a database in the AWS RDS service and an API in the AWS API GATEWAY services. One of the options for requesting data when creating a method is to use other AWS services.

Searching for 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 an RDS through the Lambda Gateway API?

    
asked by anonymous 22.11.2017 / 07:41

1 answer

0

You would have to create a Gateway API pointing to the Lambda function that will make 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 of link with the Lambda function.

Pay attention to the syntax of the return that the Lambda function will have to obey.

In node.js it looks something 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);
    
23.03.2018 / 13:56