Managing Amazon EC2 Servers

ServerPilot is the easiest way to run PHP applications like WordPress on Amazon EC2 servers and keep your servers secure.

Here we'll show you how to create an EC2 server that can be managed by ServerPilot.

EC2 was built for sysadmins, not web developers.

Amazon's EC2 is an extremely complicated service. If you are not an experienced Linux system administrator who is very comfortable with SSH, the command line, Linux networking, filesystems, and firewalls, you should not use EC2.

Using EC2 without the proper knowledge can result in downtime, broken apps, data loss, and vulnerabilities.

EC2 is more expensive than other server providers specifically because of this high complexity needed by enterprises that web developers do not need.

If you're not a sysadmin, you should use a developer-friendly server provider, such as DigitalOcean, Linode, or Rackspace.

Create an EC2 Instance

First, log in to the AWS Management Console.

Once logged in, click on EC2. You'll be shown your EC2 Dashboard.

Next, click on Instances in the left menu and then click on the Launch Instance button. The instance creation tool will begin.

Now, select Ubuntu Server 16.04 LTS 64-bit as your Amazon Machine Image (AMI).

Next, choose an instance type. That is, choose how much memory and how many CPUs you want your server to have.

Do not click Next. Instead, click Review and Launch.

You'll be taken to Step 7 to review your instance. Click Launch.

Now you need to choose which SSH key can be used to log in to this server.

If you already have an SSH key configured with EC2, select it from the list. If you don't have an SSH key, select Create New, give your key pair a name, and click Download. Your browser will download a file with your SSH private key.

Finally, click Launch Instance.

Now, click Instances in the left menu to go back to your list of EC2 instances. You should see your new instance in the list.

When your server status changes from "pending" to "running," select it from the list so you can view its details.

Configure the Security Group

Next, we need to modify the default firewall Amazon configures for EC2 servers. In EC2, the firewall is called the security group. You can see the name of the security group for your instance in the instance details screenshot above (in this case, it's "launch-wizard-1").

By default, Amazon blocks ports 80 (HTTP) and 443 (HTTPS). If you don't perform the following steps, your apps won't work.

To modify the security group, click on Security Groups in the left menu. Select the security group being used by your new instance. Then, click on the Inbound tab to see the firewall rules for your server. As you can see below, the default firewall for EC2 servers allows only port 22 (SSH).

To allow ports 80 and 443, you will need to edit the inbound rules. Make your rules look like those in the screenshot below. (Click Add Rule if you need another line.) Then, click Save.

You should now see ports 80 and 443 listed in your server's security group as in the screenshot below.

Connect Your EC2 Server to ServerPilot

Wow, EC2 is complicated. Thankfully, your server's now ready for ServerPilot.

You just need your server's IP address so you can SSH into it.

Head back on over to the instance details (click on Instances in the left menu and choose your instance from the list). Your server's public IP address will be shown in the Description tab.

Now SSH into your server as the user ubuntu. The ubuntu user has full sudo privileges and was created by EC2. The SSH key you chose when creating your EC2 server will be able to log in as this user.

Once you're able to SSH in, you'll need to manually connect your server to ServerPilot.

That's It

Once you've connected your server to ServerPilot, you can start installing PHP apps like WordPress. ServerPilot will take care of configuring and securing your server.

Last updated: December 21, 2016