Elastic Compute Service (EC2)

Pooja MehtaPooja Mehta
4 min read

Overview:

This project involved launching a Linux-based virtual server on AWS using Amazon EC2, providing practical exposure to foundational cloud compute concepts. The objective was to understand the process of provisioning an instance, configuring access, and securely connecting via SSH using AWS’s default settings.

Key steps included:

  • Selecting a free-tier Amazon Machine Image (AMI) and instance type (t2.micro)

  • Launching the instance within the default Virtual Private Cloud (VPC)

  • Creating a key pair and configuring security group rules to allow inbound SSH traffic

  • Accessing the instance securely using terminal commands

Key AWS Services Used:

  • Amazon EC2: Launched and managed a virtual machine

  • Default Amazon VPC: Used for network and subnet configuration

  • Security Groups: Defined rules to allow SSH (port 22) access

  • Key Pairs: Generated to securely connect via SSH

  • Amazon EBS: Used as block storage for the instance (automatically attached)

Steps:

  1. Access the EC2 Console
    Begin by logging in to your AWS Management Console. In the top search bar, type “EC2” and select the EC2 service from the dropdown list to navigate to the EC2 dashboard.

  1. Create an SSH Key Pair
    Before launching an instance, create a key pair to enable secure SSH access to your Linux-based EC2 instance.
  • Navigate to the Key Pairs section under Network & Security.

  • Click Create key pair, specify a name, and choose the file format (e.g., .pem for Linux/Mac).

  • The browser will prompt you to download the private key file – ensure it is saved securely, as this file is required to connect to the instance.

  1. Launch a New EC2 Instance
    On the EC2 dashboard, click Launch Instance to begin the configuration process.

  2. Select an Amazon Machine Image (AMI)
    Choose an AMI, which acts as a template for your instance’s operating system. For this example, select a Free Tier eligible AMI, such as Amazon Linux.

  1. Choose an Instance Type
    Select an appropriate instance type based on your use case. For Free Tier usage, choose t2.micro or t3.micro (if eligible).

  2. Configure Key Pair for Access
    Under the Key Pair (login) section, choose the key pair you created earlier to enable SSH access to the instance.

  1. Configure Network Settings
  • Use the default VPC for networking.

  • Select a subnet, which also determines the Availability Zone.

  • Ensure Auto-assign Public IP is enabled so that the instance is reachable over the internet.

  1. Set Up the Security Group
    Security groups act as virtual firewalls.
  • Create a new security group or use an existing one.

  • Add a rule to allow SSH (port 22) from your IP address to permit secure access.

  1. Configure Storage
    In the storage section, define the root volume (default is usually 8 GB). You can modify the size or add additional volumes based on your requirements.

  1. Advanced Settings
    The Advanced Details section allows you to configure IAM roles, user data scripts, and other settings. For now, these can be left at their default values.

  2. Launch the Instance
    Review your configuration and click Launch Instance.

  • The instance state will initially show as pending.

  • Once fully provisioned, the state will change to running, and the status check should show 2/2 checks passed.

  1. Access Instance Details
    Detailed information about the instance (public IP, DNS name, instance ID, etc.) can be found in the Description tab below the instance list.

  1. Connect to the EC2 Instance
    To connect:
  • Select the instance and click Connect (top right).

  • Choose the SSH client option.

  • Follow the displayed instructions using the terminal (on Mac/Linux) and the downloaded private key file to securely connect.

This will establish a secure terminal session to your EC2 instance.

Learning Outcome:

Through this project, I gained hands-on experience with launching and connecting to an EC2 instance using AWS’s default VPC. I learned how to configure key pairs for secure SSH access, set up basic network and security settings, laying a strong foundation for working with cloud-based infrastructure.

0
Subscribe to my newsletter

Read articles from Pooja Mehta directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Pooja Mehta
Pooja Mehta