Create and Deploy Server to the Cloud

Overview

AWS EC2 allows you to deploy servers and resources for computers in the cloud, such as a Linux server.

Business Requirements

Project Overview

Table of Contents

  1. Part 1 - Setup an EC2 Instance
  2. Log into AWS Console
  3. Launching an EC2 Instance - The Manual Way
  4. Connecting to the Server
  5. Run Security Updates
  6. Install Something (nmap port scanning)
  7. Basic Linux Commands
  8. Troubleshooting & Common Problems
  9. Learning More

Part 1 - Setup an EC2 Instance

Log into AWS Console

  1. Log into your AWS Console through your learner lab

Launching an EC2 Instance - The Manual Way

  1. When in your AWS console, search EC2 in the search bar and click EC2

    EC2 Search
  2. Click Launch Instance

    EC2 Launch Instance
  3. Pick a name for the server like Ubuntu

    EC2 Server Name
  4. Click on Ubuntu

    EC2 Ubuntu Server
  5. Pick how much processing power and RAM you want. We will stick with the default t3.micro

    EC2 Instance Type

    If you are going to use a GUI (we are not), you will want to do at least a t3.small instance. This server doesn't have a GUI though. It is only accessible from a terminal.

  6. Click Create New Key Pair. This is the security key you need to connect to the server. It is like a password file.

    EC2 Key Pair
  7. Name the key and keep the settings at their default (RSA key pair type, and .pem key file format).

    EC2 Key Pair Name

    Click Create Key Pair and this will download it to your computer. Make sure to save this in a place where you will remember where it is.

  8. Select the ports that you want open to be able to access the server. (e.g port 22 (selected by default) to ssh into the server)

    EC2 Network Settings
  9. Pick how much hard drive space you need on the server. Leave the default of 8 GB.

    EC2 Configure Storage

    Click Launch Instance

Connecting to the Server

  1. Click Connect to Instance

    EC2 Connect to Instance
  2. Click Connect.

    EC2 Connect to Instance From Amazon
    • Alternatively, you could use PowerShell or terminal to ssh in with the key you downloaded earlier. You would need to find the public IP of your EC2 instance in the details page under instances in the EC2 dashboard and run the following command (replace 3.3.3.3 with your public IPv4 address):

      ssh -i yourkey.pem ubuntu@3.3.3.3

Run Security Updates (Optional but Highly Recommended)

apt is a package manager that we use to install software on Debian-based Linux distributions such as Debian, Ubuntu, and Mint. For this assignment, you are using a Ubuntu distribution of Linux so you will use apt to install updates to the operating system software.

  1. Make sure to update the instance often

    This gets the updates for the server:

    sudo apt update

    This applies the updates for the software and services that need updates

    sudo apt upgrade
  2. Linux Kernel Upgrades (take a snapshot and test on a copy first - dev server if possible):

    This applies Linux minor kernel updates to the operating system. (This update takes some time to do, so only run this if you have time)

    sudo apt dist-upgrade
    sudo reboot
  3. Major OS upgrades (take a snapshot and test on a copy first - dev server if possible):

    Check the LTS version and see when the end of life is for that version of Ubuntu. You might have to do a major upgrade:

    This does a major update from something like Ubuntu 22 to Ubuntu 24 (Only run this if you need to):

    sudo do-release-upgrade
    sudo reboot

Install Something (nmap port scanning)

  1. This installs nmap, a tool to scan servers to see what ports are open on a system
    sudo apt install nmap
  2. This scans the local server you are running it from to see what ports are open
    nmap localhost

Basic Linux Commands

Do NOT DELETE server

Next week, we will use this Ubuntu Server so don't delete it.

Troubleshooting & Common Problems

If the server isn't working

Additional Linux Commands