Using RDS instead of Dynamodb?

Hello there!

I am relatively new to deploying on AWS and using the serverless stack. I’ve gone through a fair bit of the serverless stack tutorial and it has given me a good basic understanding of AWS and dynamodb.

However I am struggling to finding a suitable way on how to implement RDS in the application. I understand that RDS is a hosted database and that I would need to create a user within the RDS instance (or possibly use an IAM user?)

I’m just a little lost on how this can be done. I’ve also seen some differing ways of connecting to the RDS, using the aws RDS, or the standard node.js.

  const test = new aws.RDS({
    apiVersion: "XXXX",
    accessKeyId: "",
    secretAccessKey: "",
    region: "REGION",
    endpoint: "ENDPOINT"
	});

    var mysql = require('mysql');
    var connection = mysql.createConnection({
        host: "<rds_endpoint>",
        user: "<rds_username>",
        password: "<password>",
        database: "<db_name>",
    });

Part of the reason I am selecting RDS is because I am planning on performing many batch update operations to existing databases. I believe this can become very expensive so I decided on using a standard normalized database (mysql) on RDS.

If anyone has any input or suggestions, I would greatly appreciate it.

So you can use RDS instead but I’m not sure how well it performs under load. I haven’t personally used it. Just ensure that the RDS connection is created outside the Lambda function itself. Above this line for example:

That way, it does’t make a new connection for every single request.

Also, I would wait to use Aurora Serverless if possible. That seems to be better optimized for Lambda functions.