Course Content
Introduction to Cloud Computing
Introduction to Cloud Computing
Connecting to the RDS Instance
Security Group Configuration
As you may have noticed, we're using the same security groups that we used when creating and operating the EC2 instance. There, we have permission to connect via SSH keys and HTTP ports from any IP address.
We also need to add one option for connecting to the database. As you may know, MySQL databases typically operate on port 3306, so we need to allow connections from this port in the security groups. We can allow connections from any IP by setting 0.0.0.0/0, or we can allow connections only from our own IP for greater security, simply by specifying our IP.
Since we'll be allowing connections from any IP, let's navigate to the security group settings we specified when creating the database instance and add a new permission:
As you can see, AWS itself offers us an option for inbound rules for MySQL or Aurora. We see that the connection will be made using the TCP protocol and have a Port Range of 3306, as it should be in MySQL DBMS.
I also allowed connections from any IP by specifying 0.0.0.0/0. However, you can choose the "My IP" option here to allow the connection from your IP address.
Connecting to MySQL Workbench
As I mentioned earlier, we'll be managing our cloud database from our local computer.
To do this, open MySQL Workbench and click on the connect
button:
You'll see the following window. Here, we need to enter the data we specified when creating the database instance.
Let's go through it step by step:
- Connection Name: Here, we specify the connection name that will be displayed in MySQL Workbench. This name won't affect other settings;
- Connection Method: By default, this is TCP/IP, so let's leave it as is or select it if your default value is different;
- Hostname: Here, we need to paste the endpoint provided by AWS when we created the database instance. I'll show you where to find this endpoint in the screenshot below;
- Port: 3306. This is the standard port we'll be using;
- Username: Here, you need to enter the username we specified when creating the database instance. In our case, it's
root
; - Password: Here, you need to enter the password you specified when creating the database instance. In my case, it's
thisismypassword
; - Default Schema: Leave this field blank since we currently don't have a suitable schema.
You can find the database endpoint in AWS here:
After entering all the data, click on Test Connection
to verify the accuracy of the entered data and the connection. Your connection window should look something like this:
Now, you can click OK
in the bottom right corner, and the new connection will appear in your MySQL Workbench.
As you can see, it has appeared for me too:
You can also go to your list of database instances in AWS and see that new connections with MySQL have appeared for the instance you connected to:
Great job. We've successfully connected to the database instance through the local workbench. In the next chapter, we'll look at the basic commands we can use with such an instance and what our database will look like.
Everything was clear?