TechyPilots Info
TechyPilots.INFO
Home/Tutorials/Cloud/AWS/Amazon EC2
AWS Compute Tutorial

Amazon EC2

Learn Amazon EC2 and understand how AWS virtual servers, instance types, AMIs, storage, networking, security, and scaling work together.

Level: Beginner
Service: Amazon EC2

EC2 Learning Path

Learn AWS Virtual Servers

Understand EC2 Instances

Choose Amazon Machine Images

Select Instance Types

Configure Security Groups

Manage Storage and Networking

Introduction

What is Amazon EC2?

Amazon Elastic Compute Cloud, commonly known as Amazon EC2, provides virtual servers that can run applications and workloads in the AWS cloud.

Instead of purchasing and maintaining physical servers, you can create virtual compute resources based on your workload requirements.

EC2 is commonly used for websites, APIs, application servers, development environments, backend services, automation, and many other cloud workloads.

Core Concepts

EC2 fundamentals every beginner should understand

Before launching EC2 workloads, it is important to understand the main components used to create and manage virtual servers.

01

EC2 Instances

An EC2 instance is a virtual server running in AWS. You can use instances to run applications, websites, APIs, development environments, and other workloads.

Key Topics

  • Virtual servers
  • Operating systems
  • CPU and memory
  • Cloud workloads
02

Amazon Machine Images

An Amazon Machine Image, or AMI, provides the software configuration used when launching an EC2 instance, including the operating system and optional software.

Key Topics

  • Operating system images
  • Application templates
  • Custom images
  • Instance configuration
03

Instance Types

EC2 instance types provide different combinations of compute, memory, storage, and networking resources for different workload requirements.

Key Topics

  • General purpose
  • Compute optimized
  • Memory optimized
  • Storage optimized
04

Security and Networking

EC2 instances operate inside AWS networking environments and can use security groups and other controls to manage network access.

Key Topics

  • VPC
  • Subnets
  • Security groups
  • Network access

EC2 Architecture

How EC2 fits into AWS infrastructure

EC2 instances typically run inside an Amazon VPC. The VPC contains networking components such as subnets and routing rules.

Depending on the workload, an EC2 instance may communicate with the internet, other cloud services, databases, load balancers, storage systems, or private infrastructure.

Simplified EC2 Architecture

Internet
    │
    ▼
┌─────────────────┐
│ Internet Gateway│
└─────────────────┘
    │
    ▼
┌─────────────────┐
│      VPC        │
│                 │
│  ┌───────────┐  │
│  │  Subnet   │  │
│  │           │  │
│  │   EC2     │  │
│  │ Instance  │  │
│  └───────────┘  │
│                 │
└─────────────────┘

Launching an Instance

The basic EC2 launch workflow

Launching an EC2 instance involves selecting the required operating system, compute resources, networking configuration, security settings, and storage.

Step 1

Choose an AMI

Select the operating system and software configuration that will be used to create the EC2 instance.

Step 2

Choose an Instance Type

Select compute and memory resources based on the requirements of your application or workload.

Step 3

Configure Networking

Select the VPC and subnet where the EC2 instance will run.

Step 4

Configure Security

Apply security groups to control permitted inbound and outbound network traffic.

Step 5

Configure Storage

Attach the required storage volumes for the operating system, applications, and data.

Step 6

Launch the Instance

Review the configuration and launch the virtual server into your AWS environment.

Instance Types

Choose compute resources for your workload

Different workloads require different combinations of CPU, memory, storage, and networking capabilities.

General Purpose

Designed for balanced workloads that require a combination of compute, memory, and networking resources.

Compute Optimized

Designed for workloads that require significant processing power and CPU performance.

Memory Optimized

Designed for applications that require large amounts of memory and fast access to in-memory data.

Storage Optimized

Designed for workloads that require high storage capacity or high-performance storage access.

Accelerated Computing

Designed for specialized workloads that can use additional hardware acceleration capabilities.

Security Groups

Control network traffic to EC2 instances

Security groups are used to define network traffic rules for EC2 instances and other supported AWS resources.

You can configure rules based on protocols, ports, and allowed traffic sources. Security should be configured according to the requirements of the workload.

Avoid exposing unnecessary services to the public internet and follow the principle of least privilege when configuring network access.

Example Security Configuration

Inbound Rules

SSH
Protocol: TCP
Port: 22
Source: Trusted IP Address

HTTP
Protocol: TCP
Port: 80
Source: Allowed Traffic

HTTPS
Protocol: TCP
Port: 443
Source: Allowed Traffic

EC2 Storage

Understand storage options for EC2 workloads

Amazon EBS

Block storage volumes that can be attached to EC2 instances for operating systems, applications, and persistent data.

Instance Store

Temporary storage physically associated with certain EC2 instance types and suitable for specific temporary workloads.

Snapshots

Point-in-time backups that can be used for backup, recovery, and creating new storage volumes.

AWS CLI EC2 Commands

# Configure AWS CLI

aws configure

# Describe EC2 instances

aws ec2 describe-instances

# Describe available regions

aws ec2 describe-regions

# Start an instance

aws ec2 start-instances \
  --instance-ids INSTANCE_ID

# Stop an instance

aws ec2 stop-instances \
  --instance-ids INSTANCE_ID

AWS CLI

Manage EC2 from the command line

The AWS Command Line Interface can be used to retrieve information about EC2 resources and automate infrastructure operations.

Command-line workflows can be useful when working with scripts, automation pipelines, infrastructure management, and cloud operations.

Scaling

Scale EC2 workloads when demand changes

Applications may require additional compute capacity as traffic or workload requirements increase.

EC2 workloads can be designed to scale by adding or removing compute resources based on application requirements and infrastructure architecture.

1Monitor application demand
2Define scaling requirements
3Add compute capacity when required
4Remove unnecessary capacity
5Maintain availability across infrastructure

What You Will Learn

Build your EC2 foundation

Virtual Server Management

Understand how cloud virtual servers are created, configured, started, stopped, and managed.

Cloud Networking

Learn how EC2 instances connect to VPCs, subnets, security groups, and network infrastructure.

Infrastructure Design

Understand how compute, storage, security, and networking work together in cloud architectures.

Scaling Concepts

Learn the basic concepts behind scaling infrastructure as application requirements change.

Next Step

Start building with Amazon EC2

You now understand the basic concepts behind Amazon EC2. Continue exploring AWS services and build practical cloud infrastructure projects.