How to set up a Linux server for Free on AWS

Amazon Web Services has a 12-month free tier that lets you spin up a Linux server at no cost. In this guide, we’ll walk through setting up an Ubuntu server on AWS—from creating your free account and launching your EC2 instance to securely connecting via SSH.

1. Sign up for a free AWS account

Head over to the AWS website and register for a free account if you don’t already have one. Just follow the prompts to set up your account, and you’ll be good to go.

2. Navigate to the AWS EC2 Dashboard

Once your account is created and you’re logged in, look for the EC2 (Elastic Compute Cloud) service from the AWS Management Console. EC2 is where you’ll create and launch your server.

If you don’t see it on your screen immediately, click the Services button in the top bar to choose it from the quick select, or search for EC2 in the search bar at the top of the page.

3. Set up your free tier Linux server

Once on the EC2 dashboard click the orange button to Launch Instance, and on the Launch an instance screen you’ll configure your server. You’ll need to :

  1. Enter a Name for your server: This is simply a label to help you identify your server within the AWS console.
  2. Choose an Amazon Machine Image (AMI): Here, you’ll select Ubuntu as your operating system. Look for the free tier-eligible Ubuntu Server 20.04 LTS (HVM), SSD Volume Type. This is the base image that AWS will use to spin up your server.
  3. Review and Launch: Review the other options and hit “Launch Instance.”

After you click “Launch Instance,” you’ll be prompted to select a key pair. This key pair is crucial because it will allow you to securely connect to your new Ubuntu server via SSH. Here’s what you need to do:

  1. Select the option to “Create new key pair.” This will generate a new private-public key pair specifically for this instance.
  2. Name Your Key Pair: Enter a name for your key pair in the “Key pair name” field. For simplicity, you might choose something like “ubuntu.”
  3. Select Key Pair Type: AWS gives you two key pair types: RSA and ED25519. The default is RSA, which is widely supported. Unless you have a specific reason to use ED25519, it’s recommended to stick with RSA.
  4. Choose Private Key File Format : You’ll also need to choose the format for your private key file. The options are .pem for use with OpenSSH (which is standard for most Unix-based systems) or .ppk for use with PuTTY (a popular SSH client for Windows). Stick with .pem if you’re using a Linux or Mac system.
  5. Download the Key Pair: After clicking “Launch Instance,” AWS will prompt you to download the private key file. Download this file and store it in a secure location on your computer. You’ll need this key to SSH into your server. Remember: This is the only time you can download this key, so make sure not to lose it.

Once the key pair is set up and you’ve downloaded the private key, AWS will begin launching your instance. You’ll see a success message where you can click on the link to the instance, which will take you to a list of all your EC2 instances.

4. Connect to your AWS Linux server via SSH

Once you’ve navigated to your instances, look for your server’s name and click on the link in Instance ID column, and copy your Public IPv4 address.

  1. Open your Terminal on Mac to connect.
  2. Navigate to the directory where you saved your key file. You can use the cd command followed by the path to your key file. For example, if your key file is in the Downloads folder, you would run cd downloads
  3. Run the following SSH command in your terminal to connect to your server:
ssh -i "your-key-filename.pem" ubuntu@your-public-ipv4-address
  1. When prompted, type yes to confirm the connection.

Note: If you see the error Permissions 0644 for 'ubuntu.pem' are too open. in step 3, it means the permissions on your key file are too open, and SSH will refuse to use it. To fix this, you’ll need to change the permissions on the file. Run chmod 400 ubuntu.pem, which ensures that only you, the owner, can read the file. After adjusting the permissions, try connecting to your instance again.


That’s all for today! Next time, we’ll dive into setting up a free Ubuntu server with a GUI on AWS. We’ll go through installing the XFCE desktop environment, and configuring a VNC server for remote access to your GUI. Stay tuned to get your AWS instance up and running with a fully functional Linux desktop!


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *