Set up an Amazon Relational Database Service (RDS) Instance

Sam Julien
InstructorSam Julien

Share this video with your friends

Send Tweet
Published a year ago
Updated a year ago

The next service that we need to create is a database. If you look at the Ghost documentation you'll notice that MySQL 5.7 or 8.0 is required to run. This is why we will be using Amazon's Relational Database Service (RDS) which is a relational database that supports SQL.

Most of our install will be the default settings with a few key exceptions. You'll want to make sure you choose MySQL as the database as well as the free tier option or you could incur a non-trivial charge to your AWS account.

Instructor: [0:00] We got our server set up, our instance of EC2 that's going to host the node server that Ghost is going to run on.

[0:09] We also need a database. Ghost uses a relational database, that's something like SQL instead of something like MongoDB, which is a non-relational or NoSQL database. For AWS, relational databases are done through RDS, relational database service.

[0:29] You can see I've got it here in my recently visited services. You might not have that. You can go over to services. Open that up. Down here, we have a database section. There's many, many different options at AWS.

[0:43] We're going to use RDS, which is relational database service. Once that loads, you'll see this dashboard here. We're going to click this big orange button for Create Database, and go ahead and X out of this. I'm going to go through the standard creation process, even though we're going to use a lot of the default settings here.

[1:07] We're going to be using MySQL. The reason I know this is because if we go over to the Ghost installation docs, I'm going to zoom out of this a little bit, if you look on here and scroll down for Prerequisites, you can see Ubuntu, the different versions, we just set up an EC2 instance with Ubuntu 20.04, and you can see here MySQL 5.7 or 8..

[1:34] These versions are important because there are different features in different versions. We're going to use MySQL 8., or whatever the latest version of MySQL 8 is.

[1:44] Click on MySQL, we'll scroll down, and then here's the important thing if you don't want to get charged a bunch of money. If you have access to the Free Tier, make sure you select the Free Tier option here. That way, you're not going to get charged for this.

[1:58] If your account is old enough to where you don't have access to the Free Tier, you're going to want to make sure you use dev and test. If you scroll down to the bottom, you're going to see this charge.

[2:10] This won't charge immediately. This will charge after the month of usage. As long as you remember to delete this database instance after you're done with this course, then you won't get charged very much. If you do have access to the Free Tier, I highly recommend going ahead and using the Free Tier for this.

[2:32] We need to name our database. Let's call it, Ghost database. We also need some credentials for this. In the real world, you're going to want to do a lot of things to make this secure. For our purposes, I'm going to make these easy to remember. I'm going to change this admin to Ghost admin.

[2:56] For the master password, I'm going to make it simple and type, ghost db admin, ghost db admin. The one thing you want to make sure of here is you want to avoid special characters in this master password. It already tells you that you can't use things like slashes or single quotes or double quotes.

[3:19] I'm going to also recommend, at least for this demo, but also for this installation process, that you avoid things like exclamation points. We're going to need to type this password into the terminal when we set up Ghost, and terminals have a lot of special characters. I've run into a lot of installation problems when I've had super complicated passwords for this.

[3:39] Keep it something simple that you can remember because we're going to need it in a little bit. Scrolling down, we're going to leave all of these the same, but feel free to look through these. We're going to use a regular DB instance class. You can always click on these info boxes to bring up more information about what these things mean.

[3:57] Since we're doing a demo, we don't care too much about the storage or auto-scaling, things like that. We can leave all these things as is since we're using the Free Tier. If you had a real application that you needed to make sure you had enough storage, and you needed to make sure that it automatically increased in storage as you went on, you can mess with these settings.

[4:18] We're also going to leave the availability and durability the same. For connectivity, we have our default VPC, so we're going to leave it in the defaults. The only thing that we need is we need this public access set to Yes. This is the way that we're going to let our EC2 instance connect to the database.

[4:39] We're also going to create a new VPC security group for our database. Let's call it Ghost DB. We can leave our availability zone to No preference. Then we'll leave all these as the defaults. You can see here that, for estimated monthly cost, because I'm in the Free Tier, there's no estimated monthly cost.

[5:00] I'm going to go ahead and create database here and let that run. It usually takes a few minutes to run, so we'll let that set up. While you're waiting, you can also look at the credential details. That way, you can copy the username and password so that you can access it later.

[5:17] I'm going to fast forward this, so you don't have to sit here and watch it. After several minutes, you should see that the database has been successfully created.