Link to home
Start Free TrialLog in
Avatar of Manikandan Thiagarajan
Manikandan ThiagarajanFlag for India

asked on

what is aws how to connect to relational database service from application and database server

what is aws howto connect to aws relation database service and database server
Avatar of David Favor
David Favor
Flag of United States of America image

1) Same connection approach whether you're using AWS or any other database instance hosting tech.

You must open a path (firewall rules if on different machines) between your Site/App/API server (where your code lives) + database (where your SQL database instance runs).

Tip: Running your code + database on separate machines is very slow, as your speed is now limited to TCP connection speed, rather than local memory speed.

2) Then you must run a database daemon process, for example mysqld (MariaDB/MySQL).

3) They you'll connect to #2 using a credential including dbhost/dbname/dbuser/dbpass.

4) For #3 to work, you must also have created a GRANT providing a matching credential, which allows access of your database by your code.

5) AWS or bare metal machine or container or VPS slice... all the same tech, from a database hosting/connection standpoint.

Said differently, there's no difference between AWS or any other hosting tech.
Avatar of Manikandan Thiagarajan

ASKER

how to connect applicaton to aws rds and ds
you must open a path (firewall rules if on different machines) between your Site/App/API server (where your code lives) + database (where your SQL database instance runs).

how to open a path please explain

Site/App/API  could i use apigateway

regards
manikandan t


,


it all depends on your infrastructure and code.
if the code is hosted on an EC2 instance and the database is hosted on the same machine, then you just need to define the host, port, username and password in your code, and the connection will succeed.

however, if the code is hosted on another instance, or if your database is hosted on RDS what you will need to do is use the instance endpoint as your host.
also you will have to take care of the security groups for your instance. you can simply attach an IAM role to your ec2 instance that allows it access to all RDS resources.

please describe your current stack and infrastructure so that we advise you better,

db
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.