Articles → AWS SDK AND NODE.JS → Connect To AWS RDS Using Node.Js
Connect To AWS RDS Using Node.Js
Steps
- Create a publicly accessible database.
- Create a node.js program to access RDS.
- Output.
Create A Publicly Accessible Database
Create A Node.Js Program To Access RDS
var mysql = require('mysql');
var connection = mysql.createConnection({
host : '<Your database host>',
user : 'admin',
password : 'test1234',
port : 3306
});
connection.connect(function(err) {
if (err) {
console.error('Database connection failed: ' + err.stack);
return;
}
console.log('Connected to database.');
});
connection.end();
Output
Click to Enlarge