DevOps
Cloud Infrastructure
Amazon Web Services
EC2 Practical: Launching & Connecting

EC2 Practical: Launching & Connecting

Go from zero to a running cloud server in minutes. This hands-on walkthrough guides you through the process of launching an Amazon Linux instance and connecting to it via a terminal.


🏗️ Phase 1: Launching the Instance

  1. Log in to your AWS Management Console (opens in a new tab).
  2. Use the search bar to find EC2 and go to the dashboard.
  3. Click the orange Launch instance button.

Step 1: Name and Tags

  • Name: my-first-server
  • Tags help you organize resources at scale.

Step 2: Application and OS (AMI)

  • Select Amazon Linux from the Quick Start menu.
  • AMI: Amazon Linux 2023 AMI (Free tier eligible).

Step 3: Instance Type

  • Select t2.micro (or t3.micro depending on your region's free tier).

Step 4: Key Pair (Login)

  • Click Create new key pair.
  • Key pair name: my-devops-key.
  • Key pair type: RSA.
  • Private key file format: .pem (for OpenSSH).
  • CRITICAL: Click Create key pair and save the file to a secure folder on your computer. You cannot download it again.

Step 5: Network Settings

  • Firewall (Security Groups):
    • Check Allow SSH traffic from.
    • Set to My IP for maximum security.
  • Check Allow HTTP traffic from the internet (optional, for web servers).

Step 6: Launch

  • Review the summary on the right and click Launch instance.

🚀 Phase 2: Connecting to Your Server

Once the instance state is Running, follow these steps to gain terminal access.

Option A: EC2 Instance Connect (The Web Way)

  1. Select your instance in the EC2 Dashboard.
  2. Click Connect at the top.
  3. under the EC2 Instance Connect tab, click Connect.
  4. A browser-based terminal will open, logged in as ec2-user.

Option B: SSH Client (The Pro Way)

  1. Open your local terminal (Mac/Linux) or PowerShell (Windows).
  2. Navigate to the folder where you saved your .pem key.
  3. Set permissions (Linux/Mac only):
    chmod 400 my-devops-key.pem
  4. Connect:
    ssh -i "my-devops-key.pem" ec2-user@<YOUR_INSTANCE_PUBLIC_IP>

✅ Phase 3: Verify the Environment

Once connected, run these basic commands to explore your new server:

# Check the operating system version
cat /etc/os-release
 
# Check system memory and running processes
top
 
# Check the current user
whoami

[!CAUTION] Don't Get Billed! If you are done experimenting, remember to select your instance and go to Instance state -> Terminate instance. This permanently deletes the instance and stops all charges.