3.14 Introduction EC2 AWS

In this lesson we discover EC2, which stands for Elastic Compute Cloud. EC2 is the most popular AWS service. It provides the ability to launch virtual machines, store data on virtual disks, distribute traffic across multiple servers, and scale services using Auto Scaling Groups. Mastering EC2 is the foundation for understanding how the AWS cloud works. We will jump straight into a hands-on exercise: launching our first Linux instance step by step.

Launching a first EC2 instance

  • Select your region (for example Paris) before launching anything.
  • Click Launch Instance and choose the Amazon Linux 2 AMI.
  • Pick the instance type — t2.micro with 1 vCPU and 1 GB RAM, sufficient and free-tier eligible.
  • Configure details: number of instances, purchase option (on-demand), VPC, subnet, public IP auto-assignment.
  • Add storage on the EBS root volume (default size is fine for the tutorial).
  • Add tags (Name = my first instance) and create a security group allowing SSH (TCP port 22) from anywhere (0.0.0.0/0).

Linux instances on AWS are secured exclusively by SSH using a key pair, never with a password. On the final screen, AWS asks you to download a new key pair as a .pem file — the standard SSH key format used by Amazon. You can only download it once, so save it carefully. Once the key is downloaded, click Launch Instance.

The instance enters the running state in a few seconds. Be aware that as soon as an instance is running on a paid type, you start being billed. From the EC2 console you can manage your instance with several actions on its state: stop, reboot, or terminate. If you stop an instance, the EBS storage and configuration persist when you start it again. If you terminate the instance, both the server and its storage are destroyed and the data is lost. This is the standard lifecycle of an EC2 machine. In the next lesson we will see how to connect to this instance over SSH.

Summary

This lesson introduces AWS EC2 (Elastic Cloud Computing), explaining its core purpose of provisioning virtual machines, managing virtual storage, and distributing workloads across instances. The tutorial walks through launching a Linux instance on AWS, covering practical steps including instance type selection, network configuration with VPC and subnets, storage setup, security group configuration, and SSH key pair generation for secure connection.

Key points

  • EC2 is AWS's most popular service for launching and managing virtual machine instances
  • Instance types differ in computational resources (CPU and memory), with t3.micro offering 1 vCPU and 1 GB memory suitable for most tutorials
  • Security groups function as firewalls; port 22 (SSH) must be open to enable remote Linux machine access
  • AWS instance configuration requires specifying VPC, availability zones, purchase options (on-demand vs. spot), and storage volume size
  • Public IP addresses can be auto-assigned when enabled, allowing external connectivity to launched instances
  • Key pairs are essential for secure SSH authentication without password-based login on Linux instances

FAQ

What is AWS EC2 and what problems does it solve?

EC2 (Elastic Cloud Computing) is AWS's primary service for provisioning virtual machines. It allows users to allocate computational resources, store data on virtual disks, distribute load across multiple instances, and auto-scale services using Auto Scaling groups—eliminating the need for physical server management.

How do you launch your first EC2 Linux instance?

Launch a Linux instance by selecting EC2 service, choosing an Amazon Linux 2 AMI image, selecting an appropriate instance type (t3.micro for tutorials), configuring network details (VPC, subnet, availability zone), enabling public IP assignment, setting up storage volume, creating a security group with SSH port 22 open, and generating or selecting an existing key pair for authentication.

Why is the security group configuration critical when launching an EC2 instance?

The security group acts as the instance's firewall, controlling inbound and outbound traffic. For Linux instances, port 22 (SSH) must be explicitly opened to allow remote shell access; without proper configuration, you cannot connect to your instance despite it being fully operational.