# Connecting Amazon RDS To Visual Studio Code

**Amazon RDS (Relational Database Service)** is a managed database service provided by Amazon Web Services (AWS). It allows you to set up, operate, and scale a relational database in the cloud with ease. RDS supports several popular database engines, including Amazon Aurora, MySQL, PostgreSQL, Oracle, and SQL Server.

### **<mark>Let's Begin the Demonstration</mark>**

Step 1: Go to the AWS management console, search for **RDS** and click on it.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664150225/218f54fd-5460-4bd5-8cf3-b6124b0dadbe.png align="center")

Step 2: Click on **Create database**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664158567/61096baa-454b-46dd-b101-19d56adb7e8b.png align="center")

* Select the **Standard create**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686668302902/81461889-b79a-47c6-8b68-8c521e24c496.png align="center")

Step 3: From the **Templates**, select the **Free tier**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664181055/2661820b-2534-497e-a017-564b79724192.png align="center")

Step 4: Select **MySQL** from the **Engine options**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664194324/0a484d8f-2554-4999-980c-9f08abdc315e.png align="center")

Step 5: Under the **Settings**

* Give a name to the **database instance identifier**
    
* enter the **Master username and Password**  **<mark>(Note it down, you need to remember this )</mark>**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686668621686/fcfe326f-1501-4cef-b995-a5b558cd1f73.png align="left")

Step 6: From the instance configuration, select **Burstable classes**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664244001/02a07675-ac0d-4d24-8ae4-4b5c98113428.png align="center")

Step 7: Under Storage select **general purpose SSD(gp2)**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664263164/3f4bd5e6-7755-4f58-bda2-14229be5ec77.png align="center")

Step 8: From the **Connectivity,**

* select **Don't connect to an EC2 compute resource.**
    
* Select **Default VPC,** from the **Virtual private cloud(VPC)**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664269211/4639ec9c-0b31-4b9f-8c06-74ee7ae51ef0.png align="center")

* **I**n the **Public access,** select **yes**
    
* Under the **VPC security group(firewall),** you can choose existing or create new. For now, we create a new one and named it as **“sec-group”** and also selected **“us-east-1a" Availability Zone.**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664283890/77a30091-0901-4cd8-a516-ea05e4e3ff2e.png align="center")

Step 9: Under **Database authentication**

* Choose **Password authentication**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664293413/f974c664-e8d0-40db-9dfd-343be3f25ab5.png align="center")

* **unselect,** Enable Enhanced monitoring
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664298276/0786da6f-984b-401e-acf4-21d31c8fa9e8.png align="center")

Step 10: In the **Additional configuration**

* Give the **initial database name. F**or now say **“worlddb”** <mark>(NOTE the Database Name)</mark>
    
* **Unselect** under Backup and Encryption
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664327764/22f68612-624d-401b-9eb1-6342cf14772b.png align="center")

* Unselect **Enable auto minor version upgrade,** under **Maintenance**
    
* Select **no preference** under **Maintenance window**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664335726/ec377503-dd2d-44c2-8739-40bb22c7b528.png align="center")

Step 11: Click on **Create database**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686671740616/f67fea74-7318-48bb-b163-afdf1f0a9098.png align="left")

Step 12: You  need to have pre-installed **SQLTools** and **SQL Server(mssql)**

* below the extensions click on **SQLTools**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664349317/10d6f606-ad59-452c-b5d9-9d5a9061de16.png align="left")

Step 13: From the **connections** click on **Add New Connections icon.**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664363872/f834c453-068b-4c54-a6cf-9e81ef65b0fd.png align="left")

Step 14: Select **MySQL**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664369152/c990c23c-043b-418a-81dc-15c38c32d37d.png align="left")

Step 15: From the database under **Connectivity and security** copy the **endpoint** address.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664375087/94e293e9-bc65-4874-a679-40667acac3ea.png align="left")

Step 16: In the VS code under Connection Settings

* Give a name to the connection let’s say: **"justconnecting"**
    
* in the Server Address: Paste the endpoint address.
    
* Enter the database name, that you have created in the AWS RDS as **<mark>“initial database”</mark>** and noted down.
    
* Enter the database **<mark>Master</mark>** **<mark>username,&nbsp;</mark>** 
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664379003/83fa56ab-8f13-48af-9127-881d2695d58c.png align="left")

* Click on **TEST CONNECTION**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664384016/71e43daf-7b15-4faf-9d4f-9254ae3f9bcf.png align="left")

* Click on **Allow**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664387933/337a9e0f-72eb-400a-93ad-3ff574a295cb.png align="center")

* Enter the **Master** **Password** that you have noted down.
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664391640/232d77ba-8258-4329-a11a-89e164297585.png align="center")

* You should be able to see the **Sucessfully connected** Messagae. And click on **SAVE CONNECTION**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664395940/1a1b459f-6808-4cb0-9767-0ba61f29cbac.png align="left")

* Click on **CONNECT NOW**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664399182/60c27f89-f9a8-49c6-93d5-832e41ef4f11.png align="left")

* Now, you should be able to see the connections and Database below **CONNECTIONS**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664403669/7f89de62-0001-490d-a10a-8520eee64fb3.png align="left")

* Now click on the New SQL File on the right side on connetions
    
* Enter the below query
    
    ```sql
    use worlddb;
    CREATE TABLE student(
        Id int, 
        Name VARCHAR(20)
        );
    INSERT INTO student(Id, Name) 
    VALUES(1, 'Abi'),
    (2, 'Gaurav');
    
    SELECT * FROM student;
    ```
    
* Run the query using pressing **CTRL+ E+E**
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1686664407293/4c8e81e4-0029-41ce-85fe-c2f466104650.png align="center")

### CONGRATULATIONS!!!

You have successfully connected the AWS RDS to your Visual Studio Code.
