AWS -Relational Database Service(RDS)
Tags: linux, devops, aws
Published: 2023-12-14 17:34:34

- Amazon Relational Database Service (Amazon RDS) is a collection of managed services that makes it simple to set up, operate, and scale databases in the cloud. Choose from eight popular engines: Amazon Aurora PostgreSQL-Compatible Edition, Amazon Aurora MySQL-Compatible Edition, RDS for PostgreSQL, RDS for MySQL, RDS for MariaDB, RDS for SQL Server, RDS for Oracle, and RDS for Db2. Deploy on premises with Amazon RDS on AWS Outposts or with elevated access to the underlying operating system and database environment using Amazon RDS Custom.

- Now we are going to create Mysql DB using RDS.we need to confirm the ports allowed in the Security groups of your AWS.

- 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wgvn2mj1co0nx54tcle6.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a6jixudvk682ogdcpfag.png)y

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/48oifrmoegtjqnjck9mw.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/id0a7qw0zpuqlo7dlmlz.png)

- install mysql-client on the local machine

```
sudo apt install mysql-client -y

```
Once DB is on available state select >modify >connectivity >public accessibility.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m4bomqjqse7yvoptosbf.png) 

- we can access the DB via terminal with the endpoint id,port username and password 

```
mysql -h demomysqldb.cg35jaodi4xh.ap-south-1.rds.amazonaws.com -P 3306 -u admin -p
```

```
kannan@kannan-PC:~$ mysql -h demomysqldb.cg35jaodi4xh.ap-south-1.rds.amazonaws.com -P 3306 -u admin -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 8.0.33 Source distribution

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.02 sec)


```

- we can create a PostgreSQL DB with the "Easy create" method

```
sudo apt install postgresql-client
```
- Lets see the another method to create a DB with "Standard create"

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zw6dhk8bikafk8ichpjd.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c433ewpb6j126lhfwl3l.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d3f13952eko9uhc4e42a.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5kks5fplhwie1cxzygdk.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0lb73nk3ystepvmrtdc3.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hrldetg7af0bs38x87sx.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w4tauzfo0pp5ax5he239.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ofbcsl8n9txzy19wc81c.png)

- install postgresql-client on the local machine

```
sudo apt install postgresql-client -y
```

- we can access the DB via terminal with the endpoint id,port username and password 
```
psql --host=database-1.cg35jaodi4xh.ap-south-1.rds.amazonaws.com --port=5432 --username=postgres --dbname=demodb --password
```

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qnogf1irxuvdek89hd2o.png)