mobilequickie / rds-aurora-mysql-serverless

Getting started with Amazon Aurora Serverless Databae with Data API for building cloud enabled serverless backends for mobile and web applications.
Apache License 2.0
13 stars 4 forks source link

What does the lambda function do? #1

Open tommedema opened 5 years ago

tommedema commented 5 years ago

There's a mysterious lambda function in the cloudformation file that I cannot wrap my mind around. It's been explained as:

Creates a new AWS Lambda function (Node.js) with three environment variables (database name, cluster arn, and secrets arn) for connecting directly to your serverless database and making SQL statements through HTTP requests

Why would the user need to create a separate lambda function to accept HTTP requests? Isn't the whole point of the Data API that Aurora can start accepting HTTP requests? So why would developers themselves have to create another HTTP endpoint?

Is there a way for us to inspect the lambda code at bucket cloudformation-templates-useast-1 and key rds-aurora-serverless/rds-data-api-lambda-function.zip?

TheAshwanik commented 2 years ago

I am confused with this too. But I guess it could be due to the fact that , DATA API is available for only Aurora serverless DB , And you can't give an Amazon Aurora Serverless DB cluster a public IP address. You can access an Aurora Serverless DB cluster only from within a virtual private cloud (VPC), based on the Amazon VPC service. And if we still need to access the DATA API, from outside the VPC, we may need to create a lambda, expose via API gateway and pass on SQL statement for lambda to execute the DATA API. Just my thoughts.. .