User Tools

Site Tools


Guides: Web server: Part 1

Setting up your Amazon EC2 instance

Visit Amazon Web Services and create an account You will have to put credit card details in, but you won't be charged for your first year if you select a product in the free tier (the free tier has an adequate server for what we'll need, just don't create a second one).

Get logged in to the AWS site to you see your username beside the bell icon. Hit the orange button “Sign in to console”

  • In the top-right of the nav bar left of “Support” is a region, click this to change your region to EU e.g. Ireland
  • In the top-left of the nav bar click Services then EC2, or search for EC2 in the search bar.
  • Click Launch Instance
  • Select Ubuntu Server 18.04 LTS, 64-bit (x86)
  • Choose the General Purpose t2.micro option (it should say “Free tier eligible” in green)
  • Click Review and Launch, then Launch

It may take a few minutes for Amazon to approve your launch request
You'll be asked to set up a key pair and save it to your machine. Select Create a new pair and hit Continue. It's important you don't lose this file or you'll lose whatever is in your EC2 instance and will have to launch a new one.

Now we should add security rules so when we make the web pages they will be accessible by anyone with a browser.


In the navigation pane choose Security Groups. Select Create Security Group.
Give it a name and a description.
Click Add Rule.
Enter the following rule settings:

Protocol TCP
Port range 80
Source anywhere

Click Create.

Then we need to assign that rule to our server instance.
Back in the side menu select Instances.
Tick your instance.
Go to Actions > Networking > Change Security Groups.
Tick your security group and Apply.

You should now be able to connect to your instance.

Make sure you DON'T disable the existing ticked Security Groups (those are the ones that let you SSH into the server) i.e. install-wizard.

On Mac/Linux/Windows

Mac and Linux systems (as well as Windows 10+) have builtin OpenSSH tools to connect to your server:

ssh -i youridentityfile.pem ubuntu@your_server_ip

Having trouble with permissions or accessing the PEM file? You probably have to set correct permissions on the PEM file. Further information is here

chmod 600 youridentityfile.pem

On Windows

If you don't have SSH installed (you get a command not found error when trying to run ssh from the command prompt), you'll need to download PuTTY and convert your PEM file to PPK:

  • Download PuTTY from You generally want to choose the '64 bit MSI (Windows Installer)' option.
  • You'll have to convert the PEM file from Amazon to a ppk file that PuTTY can use. From the start menu run PuTTYgen
    • Under 'Type of key to generate' choose RSA
    • Press the Load button and select the PEM file you downloaded from Amazon
    • Press Save private key and save the newly generated ppk file somewhere you'll be able to find it

To use PuTTY to connect to your server:

  • Open PuTTY from the start menu
    • In the 'Host Name' box enter ubuntu@your_amazon_public_IP (replace your_amazon_public_IP with the IP of your new EC2 server - this IP can be found in the instance list on your Amazon console, you might have to scroll a little to the right to see it)
    • Under 'Connection type' choose SSH
    • Ensure the port is 22
    • In the category pane, expand 'SSH' then choose 'Auth'. Click Browse and choose the ppk file you generated earlier.
    • Optional, but recommended: Choose 'Session' from the top of the category list, enter a name in 'Saved sessions'' then press Save (this lets you reconnect to the server without repeating the above steps by just clicking on the session name next time you open putty
    • Click Open to connect. The first time you do this, you'll be given a notification of the finger print of the server, this is for information only - say Yes to trusting this certificate
guides/webserver/part1.txt · Last modified: 2022/07/04 13:30 by admin