The first thing that we need to do is set up a linux server for Ghost to run on. We will be using Elastic Computing Cloud (EC2) to do just that.
I'll walk you through launching an instance of EC2. To do so we will set the Amazon Machine Image (AMI) and instance type, add storage, add tags for organization, create a security group to control who has SSH and HTTP/HTTPS access to the server, and finally create a key pair for that SSH access.
Instructor: [0:00] We're going to be setting up Ghost with Node on a Linux server. The next step that we need to take is to create that server using AWS EC2. EC2 stands for elastic compute cloud.
[0:17] We can either click on here and recently visited services, or if you don't have that there, go up to services. Right up here at the top is compute. You can click on EC2.
[0:28] You launch EC2 in region. I am currently in the Ohio region. That's going to be perfectly fine for us.
[0:35] EC2 instances are like virtual servers. They have a template basically that gives us all of the memory and things that we need to do things like install Node or install a reverse proxy like NGINX.
[0:51] To get started, we need to click this big orange button for Launch Instance. We can click Launch Instance again here. There are a few choices that we need to make. The first one is the Amazon Machine Image, or AMI. This is the template for the operating system and things like that.
[1:09] We're going to be using Ubuntu, so I'm going to scroll down to Ubuntu Server 20.04. Notice this free tier eligible. This is going to be important for us. We're going to always want to make sure we're using any of the free tier levels, so you don't get charged a bunch of money for any of these things. Go ahead and select this.
[1:30] Next, we need to choose an instance type. This refers to the amount of computing power. AWS has all these different types of computers that you can rent out from them. They vary in their processor speed and memory, and things like that.
[1:47] For this tutorial, we're going to use the t2.micro. This is a free tier eligible. This is a baseline, simple general purpose computer that we can use to host our Node server, which is going to run Ghost. We're going to leave this as is. We could go to Review and Launch, but we are going to look at some of these other details that we're going to check out here.
[2:10] Click on Next Configure Instance Details. We're going to leave all of these as the defaults. Notice here our VPC, that is the default VPC setup in this region. We're going to leave that. We're also going to leave this Auto-assign Public IP. This ends up being useful later on. We're going to leave this as the default setting, which is to enable the public IP.
[2:33] These other options all relate to various behaviors you can do to keep your system running at different times, or to monitor the system. We're going to leave all of these off because most of them incur additional charges and we don't need them.
[2:48] If you're using this in the real world at some point, you're probably going to want to look through these options and you can make your system very robust and powerful. I'm going to go ahead and leave all these as the defaults.
[3:00] Let's go ahead and look at the storage. We're going to leave this as the default as well, but I want to show you this system. We have 8GB here by default in an SSD, and that's going to be plenty for what we're trying to do, just installing Ghost.
[3:14] The next section is the tag section. This is useful because in the real world, you're going to end up having a lot of these different instances, and you might want to have some sort of tag that lets you know the purpose of the instance.
[3:30] Let's go ahead and add a name tag, and I'm going to say, Ghost server. Then I'm going to go to the security group. We're going to create a new security group. A security group is a group of rules that's going to control the traffic for our instance, and this is important.
[3:48] I'm going to go ahead and rename this security group to Ghost Security Group, to make this easy for us. I'll change the description to be Ghost Security Group, and we need to do a couple of things here.
[4:00] One thing we need to do is create a rule for SSH, which we have by default here, but instead of having this custom is saying, ../, that means all traffic. Anybody on the Internet could SSH into this instance, and we don't want that.
[4:17] Instead, we want to set this to our own IP address. AWS provides an option for that, so let's go ahead and select my IP. Of course, my IP is going to be different than your IP.
[4:26] Then, we also need to open up the ports for HTTP and HTTPS since that's what Ghost will be using. We're not going to set up HTTPS in this course, but we'll go ahead and open up the port in case you want to do that as well.
[4:44] I'm going to go ahead and add a rule here, and scroll down here to HTTP. AWS will go ahead and populate that. Notice that we have this . again. This is what we want. This is all of the IPv4 IP addresses, so we're opening up that.
[5:01] , this is the notation for IPv6 which is a different protocol, but it's the equivalent, basically, of seeing all traffic. Notice that this is on port 80. By default, all Web traffic will go as port 80.
[5:17] Let's do the same thing for HTTPS. I'm going to add a rule, and then scroll down to HTTPS. HTTPS is in port 443. You can see here that we're doing the same thing where we're opening up all of the traffic to HTTPS. This is what'll let Ghost communicate with the outside Internet.
[5:37] This is the instance. Let's go ahead and go to Review and Launch. All of this looks good. We have our Ubuntu Server with our t2.micro. We've got our security group set up with our protocols, and everything is looking good. I'm going to go ahead and click Launch.
[5:54] There's one additional step that we're going to need to do. We're going to need to create a key pair, a public and private key, that we're going to use to SSH into the server. If you're on an existing AWS account, you might have an existing key pair. I'm in a brand new account here, so I don't have one.
[6:12] Let's go ahead and do Create New Key Pair. I'm going to call this key pair, Ghost key. What happens here is you download this key pair. A download will start, and it's going to be this .pem file. It doesn't matter where you keep this file.
[6:27] You want to make sure you know where it is because, when we log into the server using our terminal, we're going to need that private key in order to get in. It's going to match the key with our IP address. With that, we can go ahead and do, Launch Instances. We're going to let that spin up.
[6:47] Go ahead and click on this Instance ID here, and it takes us over to our instances. Notice that this is highlighted over here. This is our EC2 Dashboard. We have our instances. You can see that our instance is already up and running.
[7:04] If I click on it, I can see a bunch more information about it. You can see that I have both a public IP address and a private IP address. That's how we can create and launch our EC2 instance that will run our Ghost server.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!