Aurora Serverless AWS strong read consistency? - amazon-aurora

Is it possible to get strong read consistency (read-after-write) with Aurora Serverless? I'm using the data api client.

Aurora Serverless will always give you read-after-write consistency. It is pretty much a single (writer) instance Aurora provisioned cluster with serverless support to automatically scale (up or down) the compute.
https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.how-it-works.html

Related

How to use AWS Appsync with RDS Mysql database or with mysql aroura serverless database for real time syncing

I'm building an application that has Web(PHP-Laravel) as well as Android UI. I need real-time sync of data between both platforms. For that, I'm trying to use AWS Appsync but after reading the documentation I'm so much confused about which service I need to use. There are so many options for integration like AWS lambda, API Gateway. So which one is appropriate for my requirement? Secondly, I'm not able to figure out how to connect the RDS MySQL database with Appsync for real-time data. AWS documentation is so much confusing that I'm not able to get it. Kindly help me with this. Thanks in advance.

Is JDBC the only option to connect to aws hosted rds from aws lambda function

Like the title asks, im wondering if the only way of connecting to my aws hosted rds through aws lambda function in java is through a jdbc connection?
Does the aws sdk provide a way of doing this, querying the data and returning results without the need for jdbc?
I've looked through the aws api documentation but nothing is jumping out at me in terms of making a connection through the aws sdk alone, it seems to provide functions on more admin type tasks. .
The reason I ask is in the interest of speed, the jdbc connection takes a few seconds for a connection, but thought if the aws sdk could connect it may be quicker?
Depending on the kind of database you use there are different options.
If you want to reduce the connection latency, you could look into using RDS proxy, which will act as a reverse-proxy in from of the database instances and has a couple of connections ready for you to use.
It's also optimized to let you quickly establish connections through JDBC to it.
If you use Aurora Serverless, you might be able to use the Data API, which uses the AWS SDK to make requests to the database over HTTP. You can find more information on that in the docs: Using the Data API for Aurora Serverless.
You can also always use connection pooling in your lambda functions, which will at least make warm lambdas more performant but doesn't help you with cold starts.

access aurora serverless from public lambda

I want my lambda function to access the database aurora serverless mysql. After some research, I found that we need to keep the lambda under the same VPC as aurora serverless. But keeping lambda in VPC leads to increase the cold start and also in order to access the internet we need to use NAT gateway which leads to additional cost. Since our application is small we cannot afford additional cost. Is there any other way we can access the aurora serverless database without keeping the lambda function in vpc?
maybe for the small application you can reduce the security level and run you serverless Aurora in the default VPC with the default security group. I mean to make the public access to the database with the login/password security gate only. Yes, it is less secure but your billing will be small.
I do not see another way.
Aurora Serverless has a feature called Data API. This allows you to access the database over http from outside the VPC or from anywhere on the Internet.
So, your database can be in a private VPC and your Lambda can be outside the VPC.
However, at the time of writing this, Data API has a high latency. Simple requests can take up to 200 ms to complete.

Can Aurora RDS Serverless be restricted to a geography?

I am developing an application on AWS and it has regulatory needs to retain the data in a certain geography. I know that with RDS we can achieve the same. But if we use Aurora Server-less, can we define that my data does not leave the geography in which the Amazon data centre is located.
I have gone through the documentation of AWS. It seems to suggest that the data is geographically distributed to improve latency. But this would mean I do not have control over where the data is. My need is the opposite of it, where I want to restrict it to a certain geo location.
Aurora Serverless clusters are similar to Provisioned clusters - they are tied to a region. Provisioned clusters have new features like Global databases which makes the data available in other geographies, but Aurora Serverless does not support those features. Your data in, say, us-east-1 is not leaving that region.

Accessing Amazon Aurora from Lambda?

I am a beginner in AWS development and I had a question regarding accessing amazon aurora from lambda.
I have read that all instances of Amazon Aurora needs to be created inside a VPC. However, it seems that Lambda will incure massive latency for setting up elastic network interface (ENI) everytime it tried to access resources which is inside a VPC
https://medium.freecodecamp.org/lambda-vpc-cold-starts-a-latency-killer-5408323278dd
Since this could increase the cold start time by around 10s , is there a way to avoid this ENI setup latency while using Lambda to access Amazon RDS?
No. There is currently no "good" way to reliably prevent the coldstart.
(1) Yes, keeping the lambda function warm can help reduce the problem, but it will still be present.
(2) The only way would be if you run your rds "outside" a VPC (i.e. make it publicly available) and secure it using security groups. But this is a really bad idea for a lot of reasons (lambda ip addresses change so you need to leave the rds instance wide open for any attacker, violates aws best practices, etc).
AWS lambda + rds is currently not suitable if you need responsiveness. That's why Amazon is pushing the use of dynamodb with lambda so much (since that uses https).
Tldr if you need responsiveness + security stay away from lambda + rds.
What you need to do is make sure your lambda role has the AWSLambdaVPCAccessExecutionRole policy attached to it.
Your ENI is created on cold start. Avoid the cold start by creating another lambda to invoke your current lambda on a schedule to keep it warm.

Resources