Allow an AWS EC2 Instance Access to an RDS Database

Sam Julien
InstructorSam Julien

Share this video with your friends

Send Tweet
Published 2 years ago
Updated 2 years ago

By default, AWS service instances are created in isolation and can't access other services without your explicit permission.

We need to give our Elastic Compute Cloud (EC2) instance access to the Relational database service (RDS) we just created. To do so, we will edit the inbound rules of our database to include the security group that we set for EC2. This will allow access for every item in that security group but currently we only have our EC2 instance.

Instructor: [0:00] We've got our database set up. Now we just need to make sure that our EC2 instance, where we're going to be running node, is able to talk to our database.

[0:09] To do that, we're going to click into our database here. We're going to scroll down here to where this security section is. You can see I'm in this connectivity and security area. We're going to click on the security group here. Once that loads, we can scroll down. Let's pull this up to make it easier to see and scroll down a little bit.

[0:31] We want this inbound rules section. Click on that. We want to edit our inbound rules. You can see here there's already one for MySQL for my IP address. We want to edit inbound rules, because what we want to do is add in the security group for our EC2 instance.

[0:49] You can see here I've got this MySQL for port 3306. That's what we want. We also want the security group that we created for our Ghost server. If I just start typing in Ghost, you can see here I've got this Ghost security groups. I can click that and go ahead and click save rules.

[1:10] Now that's going to allow...You can see here it's listed in our inbound rules. It's going to allow anything in that Ghost security group to access our database through port 3306. The only thing right now that's in that Ghost security group is our EC2 instance.

[1:26] That's basically it. That's what we need to do to open up that port of communication between our EC2 server and our RDS database.