Deploy your build publicly using AWS Resource within 20 Minutes using AWS EBS AND RDS !!!! - High Level P-1
Tags: rds, ec2, eb, springboot
Published: 2022-03-25 14:29:34

## AWS RDS[Relational Database Service] - 

_It is a web service running "in the AWS cloud" designed to simplify the setup, operation, and scaling of a relational database for use in applications._

**Advantages**
Not worry about
1. Replication
2. Auto backups
3. Auto Recovering
4. Caching

Hope you have an account in AWS cloud! Else you can create an account in AWS(Its not a rocket science, its very simple).

**Amazon RDS is pay as you go.**
> Storage is billed per gigabyte per month, and I/O is billed per million-request.

**_Search and open RDS service in AWS as below mentioned snap._**

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

## Steps to follow to create a database in RDS.
**
- Click create database

- Choose **Standard create** database creation method

- Select Engine Type as MySQL.
 Amazon Aurora(optimized combined version of postgres and MySQL), MariaDB, PostgreSQL, Oracle, Microsoft SQL Server are the different engines which are available in RDS Service.

- Select the version which is matching the version that you've used in springboot.

- Choose Free tier(Use RDS Free Tier to develop new applications, test existing applications, or gain hands-on experience with Amazon RDS)
 

- Give a name for your DB instance.

- Setup the db credentials (username and password for db)

- Make the RDS visibility as publicly access mentioned below snap

- Keep other things as default and click Create Database

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

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jywsi756gvdmmr88xopk.png)
  ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7tyyrd8h2lrfi1typdoq.png)
 ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q6pdlxdmbo2msq7jfnhe.png)
 **TADAAAH!!! DB CREATED Successfully** 

 ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ews3zxvoe3mkaec5olqs.png)
 
Click the demo-db identifier and you can see that an _endpoint_  and the _port number 3306_ are shown under Connectivity and Security area. 

Before testing the connection in MYSQL Workbench you should open the port number 3306 for this demo-db.

If you scroll down you can see two security group roles are present which is mentioned as default under **Security Groups section**.

Select a SG(Security group) from that who is having CIDR/IP - Inbound as Type. SG acts like a firewall for RDS [Restricting the access], so we have to open the port 3306[Allowing access to request which is coming only from port 3306].

**Integrate demo-db [RDS] to our SpringBoot app**

Use this configuration in _application.properties_ file:
**spring.datasource.url**=jdbc:mysql://<_Give endpoint as hostname>:3306/schema_name
**spring.datasource.username**=<_username given during initial setup for RDS_>
**spring.datasource.password**=<_password given during initial setup for RDS_>

> Please check/test connection using MySql WorkBench by configure connection by giving hostname as endpoint which is generated after the db creation in RDS and give credentials which is given during db setup.

_**Yaaay!!!Now you're successfully configured springboot to RDS.
Now your data will be stored in cloud!!!**_

**Next Part we will discuss how to deploy the fat jar in Elastic BeanStalk.**