0% found this document useful (0 votes)
155 views30 pages

AWS Compute Services

The document provides an introduction to AWS Compute Services, explaining the concept of compute in cloud computing and how it enables businesses to run applications and scale resources efficiently. It details various AWS services such as EC2, ECS, EKS, Lambda, and Fargate, along with real-world examples and use cases for each service. Additionally, it outlines different EC2 instance types and their specific applications, helping users choose the right service based on their needs.

Uploaded by

chauhanranjeet52
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
155 views30 pages

AWS Compute Services

The document provides an introduction to AWS Compute Services, explaining the concept of compute in cloud computing and how it enables businesses to run applications and scale resources efficiently. It details various AWS services such as EC2, ECS, EKS, Lambda, and Fargate, along with real-world examples and use cases for each service. Additionally, it outlines different EC2 instance types and their specific applications, helping users choose the right service based on their needs.

Uploaded by

chauhanranjeet52
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

Module 1: Introduction to AWS Compute Services

Overview of Compute in Cloud Computing

What is Compute?

Compute in cloud computing refers to the processing power needed to run applications, services, and
workloads in the cloud. Instead of managing physical servers, cloud providers like AWS offer compute
resources that can be provisioned, scaled, and managed as per business needs.

How Compute Works in the Cloud?

Cloud compute provides virtualized computing power that allows users to:
✔ Run applications (web apps, enterprise apps, AI models, etc.).
✔ Process large amounts of data in real time.
✔ Scale resources up or down based on demand.

IT Example of Compute in Cloud

Example 1: Hosting an E-Commerce Website

• Use Case: An online store (like Amazon or Flipkart) needs a website to handle millions of
customer transactions.

• Solution: AWS Compute resources such as Amazon EC2 (Virtual Machines) can host the
website’s backend, while AWS Lambda (Serverless) can process transactions dynamically.

• Outcome: The store runs 24/7, handling traffic spikes during sales without downtime.

Example 2: Video Streaming Service (Like Netflix or Hotstar)

• Use Case: Streaming platforms need high-performance computing to deliver video content
smoothly.

• Solution: AWS Compute services like EC2, Amazon ECS (Containers), and AWS Lambda help
process and stream videos efficiently.

• Outcome: Users can watch HD videos without buffering, even with millions of viewers online.

Non-IT Example of Compute in Real Life

Example 1: Restaurant Kitchen as Compute Power

• Scenario: Imagine a restaurant kitchen as a compute resource.

• Process:
o The chef (compute power) prepares food.

o The storage room (storage) keeps ingredients.

o The waiters (networking) serve food to customers.

• Outcome: The kitchen scales up during peak hours (dinner time) and slows down when demand
is low.

Example 2: Factory Production Line as Compute Power

• Scenario: A factory producing cars operates using different machines.

• Process:

o Compute: Machines assemble car parts (EC2 instances running apps).

o Storage: Warehouse stores raw materials (AWS S3 for data storage).

o Networking: Trucks deliver finished cars to showrooms (AWS VPC for data transfer).

• Outcome: The production line works efficiently without overloading machines.

=====================================================================================

Module 2: Key AWS Compute Services Overview

1. Amazon EC2 (Elastic Compute Cloud) - Virtual Machines on Demand

What is EC2?

Amazon EC2 provides virtual machines (VMs) in the cloud to run applications. You can launch, stop, and
resize EC2 instances as needed.

Features of EC2:

✔ Different instance types (General Purpose, Compute-Optimized, Memory-Optimized).


✔ Scalability (Auto Scaling Groups & Elastic Load Balancing).
✔ Pay-as-you-go pricing model.

IT Example: Running an E-Commerce Website

• A company like Flipkart runs its website on EC2 instances to handle millions of daily users.

• During Big Billion Days, it scales up EC2 instances to handle peak traffic.

• After the sale, it scales down to reduce costs.

Non-IT Example: Renting vs. Buying a Car


• EC2 = Renting a car → You pay only for the duration you use the car.

• Traditional On-Prem Servers = Buying a car → High upfront cost, but permanent ownership.

Outcome: EC2 gives flexibility to "rent" computing power instead of buying hardware.

2. Amazon ECS (Elastic Container Service) - Managed Containers

What is ECS?

Amazon ECS is a container orchestration service that helps deploy and manage Docker containers in
AWS.

Features of ECS:

✔ Uses Docker for packaging applications.


✔ Easily integrates with AWS Fargate (serverless containers).
✔ Provides auto-scaling based on demand.

IT Example: Running a Banking Application

• A bank runs different microservices (account management, transactions, fraud detection).

• Each microservice runs in a Docker container, managed by ECS.

• ECS ensures that if one service fails, others continue running.

Non-IT Example: Food Court with Multiple Stalls

• ECS is like a food court where different food stalls (containers) operate independently.

• If one stall runs out of ingredients, others continue serving.

Outcome: ECS helps manage multiple applications (microservices) efficiently.

3️. Amazon EKS (Elastic Kubernetes Service) - Managed Kubernetes

What is EKS?

Amazon EKS is a fully managed Kubernetes service for deploying containerized applications.

Features of EKS:

✔ Automates Kubernetes cluster management.


✔ Works across AWS, on-premises, and hybrid environments.
✔ Supports auto-scaling and load balancing.
IT Example: Netflix Using Kubernetes for Video Streaming

• Netflix runs thousands of microservices to stream videos worldwide.

• EKS automatically scales up/down microservices based on demand.

• Ensures high availability and fault tolerance.

Non-IT Example: Automated Manufacturing Factory

• A factory produces different car parts on demand.

• If demand increases, more machines (pods in Kubernetes) are activated.

• If a machine breaks down, others continue working.

Outcome: EKS ensures that applications scale automatically and recover quickly from failures.

4️. AWS Lambda - Serverless Compute

What is AWS Lambda?

AWS Lambda allows you to run code without managing servers. It executes functions only when
triggered, reducing costs.

Features of Lambda:

✔ Event-driven (triggers from API Gateway, S3, DynamoDB).


✔ Auto-scales instantly based on demand.
✔ Pay-per-execution (cheaper than EC2 for small tasks).

IT Example: AI-Powered Chatbot

• A chatbot automatically responds to customer queries.

• Lambda functions process messages and fetch answers from a database.

• No need to manage servers, reducing operational costs.

Non-IT Example: Motion Sensor Lights

• Lights turn on automatically when movement is detected.

• No need to keep lights ON all the time (saving energy).

Outcome: Lambda is perfect for event-driven applications, saving cost and resources.

5️. AWS Fargate - Serverless Containers


What is Fargate?

AWS Fargate allows you to run containers without managing servers. It works with ECS and EKS.

Features of Fargate:

✔ Fully managed serverless container service.


✔ No need to provision EC2 instances for running containers.
✔ Auto-scales based on demand.

IT Example: Running an AI Model for Fraud Detection

• A bank runs an AI-based fraud detection system using Fargate.

• Fargate automatically scales up the service during high transaction periods.

• The bank doesn’t have to manage servers, saving costs.

Non-IT Example: Cloud Kitchen

• A cloud kitchen rents space and cooks food only when an order is received.

• It doesn’t need a physical restaurant (just like Fargate doesn’t need dedicated servers).

Outcome: Fargate eliminates server management for containers, making it easy to scale applications.

6️. AWS Batch - Large-Scale Job Processing

What is AWS Batch?

AWS Batch runs large-scale computational workloads efficiently.

Features of AWS Batch:

✔ Used for scientific computing, simulations, and big data processing.


✔ Auto-scales based on job demand.
✔ No need to manually allocate resources.

IT Example: Weather Forecasting Models

• Weather agencies run complex simulations using AWS Batch.

• AWS Batch automatically allocates resources based on demand.

Non-IT Example: Exam Grading System

• A university processes thousands of exam papers using an AI-based grading system.

• AWS Batch automatically scales up/down computing power based on workload.


Outcome: AWS Batch is perfect for running batch processing tasks without managing infrastructure.

7️. AWS Outposts - Hybrid Cloud Computing

What is AWS Outposts?

AWS Outposts extends AWS cloud services to on-premises data centers.

Features of AWS Outposts:

✔ Provides AWS cloud experience inside private data centers.


✔ Ideal for banks, healthcare, and government organizations.
✔ Supports hybrid cloud (mix of on-prem and AWS cloud).

IT Example: A Bank Storing Sensitive Data On-Prem

• A bank needs cloud computing power but must keep data on-prem.

• AWS Outposts provides AWS services inside the bank’s data center.

Non-IT Example: Hybrid Solar Power System

• A solar power system runs on both solar and grid electricity.

• AWS Outposts is similar – it runs both on-prem and AWS cloud.

Outcome: Outposts help industries maintain data security while using cloud benefits.

8️. AWS Local Zones & Wavelength - Edge Computing

What is AWS Local Zones & Wavelength?

AWS Local Zones and Wavelength bring AWS services closer to end-users for low latency applications.

Features of Local Zones & Wavelength:

✔ Reduces latency for gaming, AI, and media applications.


✔ Ideal for real-time applications like AR/VR, self-driving cars.

IT Example: 5️G-Powered Video Streaming

• AWS Wavelength runs real-time video streaming for 5️G mobile networks.

Non-IT Example: Traffic Lights Controlled by AI

• AI-based traffic lights adjust in real-time based on road congestion.


Outcome: Edge computing brings AWS closer to users, reducing delays.

Summary:

Choosing the Right AWS Compute Service for Different Use Cases

AWS offers multiple compute options based on business needs:

AWS Compute
Use Case IT Example Non-IT Example
Service
Websites,
Amazon EC2 Running a corporate Renting a car instead of
Databases,
(Virtual Machines) website on AWS buying one
Enterprise Apps
Auto-scaling chatbot
AWS Lambda Automated tasks, Motion-sensor street lights
processing customer
(Serverless) API execution turning on only at night
queries
Hosting a banking app
Amazon ECS & EKS Running A food court where different
with multiple
(Containers) microservices stalls serve different dishes
microservices
AWS Fargate Running containers Ordering food via Swiggy
Deploying an AI chatbot
(Serverless without managing without worrying about
on a website
Containers) servers cooking
A factory producing
Large-scale job Running simulations for
AWS Batch thousands of products in
processing weather forecasting
batches
Running AWS services A hybrid solar power system
Hybrid cloud (on-
AWS Outposts inside a private data using both solar and grid
premises + cloud)
center electricity
Traffic lights adjusting
Edge computing Running AI-based real-
AWS Wavelength dynamically based on road
(low latency) time voice assistants
congestion

=====================================================================================

Module 3️. Introduction to Amazon EC2

What is EC2?

Amazon Elastic Compute Cloud (EC2) is a web service that provides scalable virtual machines in the
cloud. It enables users to launch virtual servers (instances) on demand without purchasing physical
hardware.

Key Features:

• Pay-as-you-go pricing
• Multiple instance types for different workloads

• Elasticity: Scale up/down as needed

• Secure: IAM roles, security groups, key pairs

Real-World Examples:

IT Example:

• A startup needs to host a website. Instead of buying a physical server, they launch an EC2
instance, configure a web server (Apache/Nginx), and make their site live.

Non-IT Example:

• EC2 is like a car rental service. Instead of buying a car (physical server), you rent one (EC2
instance) for only as long as you need it.

Use Cases for EC2

EC2 is used for a wide range of applications:


✔ Web Hosting: Running websites, blogs, and web applications.
✔ Big Data Processing: Running large-scale analytics using Hadoop, Spark, etc.
✔ AI & Machine Learning: Training ML models with high-performance instances.
✔ Gaming Servers: Hosting multiplayer gaming environments.
✔ Application Testing & Development: Developers test applications in different environments.

Different Types of EC2 Instances

AWS provides 7️ categories of instances to match different workloads.

1. General Purpose Instances

Best for: Balanced performance, suitable for most applications.


Example Use Cases: Web servers, small databases, development/testing.
Example Instances: t3.micro, m5.large
Real-World Example: A startup hosting its website uses t3.micro to run a lightweight web
application.

2. Compute Optimized Instances


Best for: High CPU workloads needing fast processing.
Example Use Cases: Game servers, media encoding, scientific modeling.
Example Instances: c5.xlarge, c6g.medium
Real-World Example: A gaming company runs a multiplayer game on c5.xlarge for fast computations.

3️. Memory Optimized Instances

Best for: Applications requiring high RAM (Memory).


Example Use Cases: Large databases, real-time analytics, in-memory caching.
Example Instances: r5.large, x1e.32xlarge
Real-World Example: A bank using x1e.32xlarge to store and process customer transaction data in-
memory.

4️. Storage Optimized Instances

Best for: High-speed disk storage and large data processing.


Example Use Cases: Big data analytics, logging, NoSQL databases.
Example Instances: i3.large, d2.2xlarge
Real-World Example: A data analytics company uses d2.2xlarge for storing and processing massive
logs efficiently.

5️. GPU Instances

Best for: AI/ML training, deep learning, and graphics processing.


Example Use Cases: Machine learning model training, 3D rendering, video processing.
Example Instances: g5.xlarge, p4d.24xlarge
Real-World Example: A self-driving car company trains its AI model using p4d.24xlarge.

6️. Accelerated Computing Instances

Best for: Specialized hardware acceleration like AI inference & FPGA-based tasks.
Example Use Cases: AI inference, high-frequency trading, genomics.
Example Instances: inf1.xlarge, f1.4xlarge
Real-World Example: A healthcare company uses inf1.xlarge to process real-time AI medical
diagnostics.
7️. High-Performance Computing (HPC) Instances

Best for: Massive parallel processing & scientific computing.


Example Use Cases: Weather forecasting, CFD simulations, large-scale genomics.
Example Instances: hpc6a.48xlarge, c7gn.16xlarge
Real-World Example: A university uses hpc6a.48xlarge to run climate change simulation models.

Instance Type Use Case Example Instance


Balanced performance for web apps,
General Purpose t3.micro, m5.large
dev environments
High CPU workloads (gaming, media
Compute Optimized c5.xlarge, c6g.medium
processing)
High RAM needs (databases, real-time
Memory Optimized r5.large, x1e.32xlarge
analytics)
High disk speed and storage (data
Storage Optimized i3.large, d2.2xlarge
warehousing, logging)
Machine learning, AI, graphics
GPU Instances g5.xlarge, p4d.24xlarge
rendering
Specialized workloads (AI inference,
Accelerated Computing inf1.xlarge, f1.4xlarge
FPGA, DL)
HPC (High-Performance Scientific simulations, complex hpc6a.48xlarge,
Computing) modeling c7gn.16xlarge

Final Takeaway: Which One to Choose?

Instance Type Best for... Example Use Case


General Purpose Balanced workloads Web apps, Dev/Test
Compute Optimized High CPU tasks Game servers, media processing
Memory Optimized RAM-heavy apps Large databases, real-time analytics
Storage Optimized High disk I/O Big Data, NoSQL, logging
GPU Instances AI/ML, graphics Deep learning, 3D rendering
Accelerated Computing Specialized workloads AI inference, FPGA workloads
Supercomputing
HPC Instances Scientific simulations, genomics
needs

EC2 Instance Type: Real life Example

1. General Purpose Instances (Balanced Performance)

Use Case: Suitable for web apps, small databases, and development environments.
Real-Life Example:
Imagine you’re running a small e-commerce store. You don’t need heavy computing power but require a
reliable server to handle user traffic, store product data, and process orders. A t3️.micro or m5️.large
instance can efficiently run your website, ensuring smooth user experience without excessive costs.

2. Compute Optimized Instances (High CPU Performance)

Use Case: Best for workloads requiring high processing power like gaming, media encoding, and ad
serving.

Real-Life Example:
A multiplayer online game like PUBG or Fortnite requires fast processing to track thousands of players’
actions in real-time, render animations, and prevent lag. A c5️.xlarge instance is used to execute high-
speed calculations, ensuring seamless gameplay without delays.

3️. Memory Optimized Instances (High RAM Needs)

Use Case: Ideal for large databases, in-memory analytics, and caching.
Real-Life Example:
A banking system processes millions of transactions daily. To quickly retrieve customer records, account
balances, and transaction histories, banks use high-RAM instances like r5️.large to store frequently
accessed data in memory, reducing delays in financial operations.

4️. Storage Optimized Instances (High Disk Performance)

Use Case: Used for applications that require fast access to large volumes of data, such as data
warehousing, logging, and big data processing.
Real-Life Example:
A stock exchange like the New York Stock Exchange (NYSE) handles massive amounts of real-time trade
data every second. To store and retrieve transaction logs instantly, they use i3️.large instances with high-
speed NVMe SSDs, ensuring no data loss and ultra-fast trade processing.

5️. GPU Instances (AI & Graphics Processing)

Use Case: Best for deep learning, AI model training, and graphics rendering.
Real-Life Example:
A Hollywood animation studio like Pixar creates 3D-animated movies with complex visual effects. To
render high-quality animations, special effects, and CGI, they use GPU-powered instances like
p4️d.24️xlarge, which can process millions of pixels per second, reducing rendering time from weeks to
days.

6️. Accelerated Computing Instances (AI Inference & Specialized Processing)

Use Case: Designed for AI/ML inference, real-time analytics, and medical imaging.
Real-Life Example:
A hospital is using AI to analyze MRI scans in real-time. Instead of waiting hours for manual diagnosis,
they deploy inf1.xlarge instances to run AI models that detect diseases like cancer within minutes,
improving patient care and early diagnosis.

7️. High-Performance Computing (HPC) Instances (Supercomputing)

Use Case: Best for scientific research, weather simulations, and aerospace engineering.
Real-Life Example:
A climate research center is studying hurricane patterns to predict storms. They run complex weather
simulations on hpc6️a.4️8️xlarge, analyzing terabytes of atmospheric data to forecast weather changes
and provide early warnings for disaster preparedness.

Summary Table for Quick Understanding

Instance Type Use Case Real-Life Example


Running an e-commerce website like
General Purpose Web apps, small businesses
Flipkart
Gaming, media processing,
Compute Optimized Running PUBG game servers
high-performance apps
Large databases, real-time Banking systems storing customer
Memory Optimized
analytics transactions
Big data, logging, data
Storage Optimized NYSE storing real-time trade data
warehousing
AI training, video rendering,
GPU Instances Pixar rendering 3D animated movies
deep learning
AI inference, real-time
Accelerated Computing AI-based medical imaging for hospitals
analytics

HPC Instances Scientific simulations, research Predicting hurricane patterns

=====================================================================================
Module 4️. EC2 Instance Configuration

How to Launch an EC2 Instance (Step-by-Step Guide)

Login to AWS Console → Go to EC2 Dashboard


Click Launch Instance
Choose an Amazon Machine Image (AMI)
Select an Instance Type (e.g., t2.micro for free tier)
Configure Instance Details (VPC, subnets, IAM roles)
Add Storage (Elastic Block Store - EBS)
Configure Security Groups (firewall rules)
Generate and download Key Pair for SSH access
Click Launch

Example:

• A startup launches an EC2 instance to host a WordPress website using an Ubuntu AMI and
t2.micro instance.

Module 5️. Choosing the Right AMI (Amazon Machine Image)

AMIs are pre-configured templates used to launch EC2 instances.

✔ Linux AMIs: Ubuntu, Amazon Linux, RHEL, etc.


✔ Windows AMIs: Windows Server 2019, Windows Server 2022
✔ Custom AMIs: Users can create their own customized images.

Amazon Machine Image (AMI) – Quick Overview

An Amazon Machine Image (AMI) is a pre-configured blueprint that contains the operating system,
software, and settings required to launch an EC2 instance in AWS.

Why is AMI Important?

✔ Acts as a template for creating virtual machines.


✔ Ensures consistency in deployments.
✔ Reduces manual setup time for new instances.

Types of AMIs

Provided AMIs – Amazon Linux, Windows, Ubuntu (default options).


Marketplace AMIs – Pre-configured images from third-party vendors.
Custom AMIs – User-created images with specific configurations.
Shared AMIs – AMIs shared between AWS accounts.

Using AMI During EC2 Launch

Choose an AMI from AWS or use a custom one.


Configure the instance (type, storage, security).
Launch multiple instances from the same AMI for scalability.

Key Benefits

Faster instance deployment


Standardized environments
Easy backup and restoration

Detailed Example of Using an AMI

IT Example: Web Server Deployment in AWS

Scenario: Imagine you are an IT administrator managing a team that needs to deploy multiple web
servers quickly. Instead of manually installing Apache/Nginx on every new EC2 instance, you can create a
custom AMI with the required software pre-installed.

Steps to Use AMI for Web Server Deployment

1. Choosing an AMI

• While launching an EC2 instance, select an AWS-provided AMI (e.g., Amazon Linux 2023).

2. Customizing the EC2 Instance

• After launching the instance, install Apache Web Server (sudo yum install httpd -y).

• Configure the necessary settings (firewall, ports, security groups).

• Verify the web server is running.

3️. Creating a Custom AMI

• Once the setup is complete, create an AMI from the running EC2 instance.

• This AMI can now be used to launch multiple web servers instantly.

4️. Launching Multiple Web Servers Using AMI

• Instead of repeating the setup process, simply launch new EC2 instances from the custom AMI.

• Every new instance will have Apache pre-installed, saving time & effort.
Result: A scalable solution where all deployed web servers are identical in configuration, improving
efficiency.

Non-IT Example: Factory Automation Blueprint

Scenario: A car manufacturing plant produces sedans and SUVs. Instead of designing each vehicle from
scratch, they use a blueprint (AMI equivalent).

1. Choosing the Right Blueprint (AMI Selection)

• The factory selects the base model of the car (Sedan or SUV).

2. Customizing Features (EC2 Configuration)

• Different factories might customize certain elements (e.g., leather seats, sunroof, engine tuning).

3️. Saving the Blueprint (Creating AMI)

• Once a car model is finalized, the factory saves the blueprint for mass production.

4️. Producing More Cars (Launching EC2 from AMI)

• Using the saved blueprint, the factory can produce thousands of identical cars efficiently.

Result: Just like AMIs standardize EC2 deployments, blueprints standardize car production, making
scaling easier.

=====================================================================================
Module 6️. Elastic Block Store (EBS) for EC2

Overview of Elastic Block Store (EBS) for EC2

EBS = Persistent Storage attached to EC2 instances, meaning data remains even if the instance is
stopped or restarted.

EBS Types & Use Cases:

✔ gp3️ (General Purpose SSD) – Best for web apps, small databases.
✔ io1/io2 (Provisioned IOPS SSD) – High-speed, low-latency storage for databases & transactional
workloads.
✔ st1 (HDD – Throughput Optimized) – Ideal for big data, data lakes, and log storage.

Real-Life Example:
A healthcare app stores patient records on EBS volumes attached to EC2, ensuring secure and persistent
data access.

=====================================================================================
Module 7️. Key Pair Authentication (SSH & Windows RDP)

Detailed Overview of Key Pair Authentication (SSH & Windows RDP) in AWS EC2

When launching an EC2 instance, AWS provides Key Pair Authentication to securely connect to the
instance. This key pair consists of:

• Public Key (stored on the EC2 instance).

• Private Key (downloaded and used by the user for authentication).

How Key Pair Authentication Works?

1. When launching an EC2 instance, AWS asks you to create or select an existing Key Pair.

2. The Public Key is automatically stored in the instance.

3. The Private Key (a .pem file) is downloaded by the user and used to authenticate the
connection.

Key Pair Authentication for Different OS:

✔ For Linux Instances – SSH Authentication:

• Connect using Secure Shell (SSH) from a terminal.

• Command:

• The .pem key file acts as a password to securely access the instance.

Example:
A developer wants to deploy a web app on an Amazon Linux EC2 instance. They use SSH and the private
key (your-key.pem) to access the server securely, then install and configure the app.

✔ For Windows Instances – RDP Authentication:

• Connect using Remote Desktop Protocol (RDP).

• The private key is used to decrypt the Windows administrator password.


• Steps:

1. Download .pem key file.

2. Open EC2 Dashboard → Instances → Connect → RDP Client.

3. Click Decrypt Password, using the .pem key.

4. Copy the password, open Remote Desktop Connection (RDP), and log in.

Example:
A finance team needs to run financial models on a Windows-based EC2 instance. They connect via RDP,
using the decrypted password from the private key, and access the Windows machine securely.

Why is Key Pair Authentication Important?

• Ensures secure, password-less access to EC2 instances.


• Prevents unauthorized access by enforcing encryption-based authentication.
• Eliminates weak password risks, as only the private key holder can access the instance.

Key Takeaway:
Using SSH (Linux) or RDP (Windows) with a private key ensures a secure and encrypted connection to
AWS EC2 instances without relying on traditional passwords.

=====================================================================================

Module 8️. EC2 Advanced Features

Elastic Load Balancer (ELB) – Ensuring Even Traffic Distribution

What is ELB?

ELB is a managed load-balancing service that automatically distributes incoming traffic across multiple
EC2 instances to prevent any single instance from becoming overwhelmed.

How ELB Works?

1. Receives incoming requests (from users, clients, or APIs).

2. Distributes the traffic evenly among healthy EC2 instances.

3. Monitors instance health and automatically routes requests away from unhealthy instances.

Types of Elastic Load Balancers:

• Application Load Balancer (ALB) – Best for web apps, supports HTTP/HTTPS, Layer 7 routing
• Network Load Balancer (NLB) – Best for low-latency, high-performance apps, operates at Layer 4
(TCP/UDP).
• Classic Load Balancer (CLB) – Legacy load balancer for basic routing needs.

Real-Life Example:
An e-commerce website uses an Application Load Balancer (ALB) to distribute millions of requests
across multiple EC2 instances. During a flash sale, ELB ensures that no single server is overloaded,
improving performance and reliability.

Auto Scaling – Dynamically Adjusting EC2 Instances

What is Auto Scaling?

Auto Scaling automatically adds or removes EC2 instances based on real-time traffic demand, ensuring
cost efficiency and application availability.

How Auto Scaling Works?

1. Auto Scaling Group (ASG) defines the minimum and maximum number of instances.

2. Scaling policies define when to scale up or down (e.g., CPU usage > 70%).

3. Auto Scaling dynamically launches or terminates EC2 instances as per traffic needs.

Types of Auto Scaling Policies:

• Dynamic Scaling – Adds/removes instances based on CPU usage, requests per second, or
memory utilization.
• Scheduled Scaling – Scales up or down at specific times (e.g., every morning at 9 AM).
• Predictive Scaling – Uses ML-based forecasting to predict future traffic and scale accordingly.

Real-Life Example:
A retail company running an online shopping platform experiences a surge in traffic during Black Friday
sales. Auto Scaling automatically increases EC2 instances to handle the load. Once the sale ends, it
scales down instances to save costs.

How ELB & Auto Scaling Work Together?

• ELB distributes traffic evenly across instances.


• Auto Scaling adds or removes instances as needed.
• Together, they ensure high availability, fault tolerance, and cost optimization.

Final Example:
A food delivery app (like Swiggy/Zomato) sees dinner-time traffic spikes.
1. ELB balances the traffic between multiple EC2 servers.
2. Auto Scaling scales up instances when demand increases.
3️. Once traffic decreases, Auto Scaling removes extra instances, reducing costs.

Key Takeaway:

ELB & Auto Scaling work together to ensure that your application remains responsive, scalable, and
cost-effective under fluctuating workloads.

=====================================================================================

Module 9. EC2 Pricing Models

1. On-Demand Instances – Pay-as-You-Go Model

What is it?

• Pay per second or per hour for compute capacity.

• No upfront commitment, no long-term contracts.

• Best for short-term, unpredictable workloads where you don’t know how long instances will be
needed.

When to Use On-Demand Instances?

✔ New applications or startups testing AWS infrastructure.


✔ Short-term workloads like software testing, PoCs.
✔ Apps with unpredictable traffic patterns (e.g., news websites, stock trading platforms).

Real-Life Example:
A media streaming startup launches a new video platform and is unsure about traffic demand. They use
On-Demand Instances so they can scale up if traffic spikes and shut down when demand reduces, paying
only for what they use.

2. Reserved Instances (RIs) – Best for Long-Term Cost Savings

What is it?

• You commit to a 1-year or 3️-year term in exchange for big discounts (up to 75% compared to
On-Demand).

• Ideal for steady-state workloads that require continuous operation.

When to Use Reserved Instances?


✔ Production workloads with predictable usage (e.g., ERP, databases).
✔ Companies running EC2 instances 24️/7️ (e.g., SaaS platforms, banking systems).
✔ Big enterprises looking for stable, cost-effective cloud solutions.

Real-Life Example:
A large bank runs its customer transaction system on AWS. Since this system must be operational 24️/7️,
they purchase Reserved Instances for 3 years, significantly reducing costs.

3️. Spot Instances – Up to 90% Cheaper Compute Capacity

What is it?

• AWS offers spare EC2 capacity at high discounts (up to 90% cheaper than On-Demand).

• However, AWS can reclaim the instance anytime (if demand increases), giving only a 2-minute
warning before termination.

• Best for workloads that are fault-tolerant and can handle interruptions.

When to Use Spot Instances?

✔ Big data processing & batch jobs (e.g., data analytics, log processing).
✔ Machine learning training workloads.
✔ Rendering graphics, video transcoding.
✔ High-performance computing (HPC) tasks.

Real-Life Example:
A biotech company running genome sequencing (which requires heavy computing power) uses Spot
Instances to process DNA sequencing data. Since these jobs can be paused and resumed, Spot Instances
save them millions in costs.

4️. Savings Plans – Flexible Discount Pricing

What is it?

• Similar to Reserved Instances, but more flexible.

• Commit to a spending amount ($/hour) for 1 or 3️ years instead of committing to specific


instance types.

• Can be applied across different instance families, regions, and OS types.

When to Use Savings Plans?


✔ Companies running workloads across multiple instance types.
✔ Teams that want cost savings but need flexibility.
✔ Hybrid cloud users managing different workloads dynamically.

Real-Life Example:
A gaming company runs multiplayer game servers but uses different EC2 instance families based on
demand. Instead of buying Reserved Instances for each type, they commit to a Savings Plan, which
applies discounts across all instances.

====================================================================================

5️. Dedicated Hosts – Compliance & Licensing Needs

What is it?

• A physical EC2 server fully dedicated to a single customer.

• Helps meet regulatory, security, and compliance requirements (e.g., healthcare, finance).

• Useful for bring-your-own-license (BYOL) software like Windows, SQL Server, etc.

When to Use Dedicated Hosts?

✔ Organizations with strict compliance needs (e.g., government, healthcare).


✔ Companies migrating legacy workloads requiring dedicated infrastructure.
✔ Firms using per-core software licenses (e.g., Oracle, Microsoft).

Real-Life Example:
A pharmaceutical company handling sensitive patient data needs a HIPAA-compliant environment. They
use Dedicated Hosts to ensure their data stays isolated from other AWS customers.

6️. Dedicated Instances – Private EC2 Instances for Security

What is it?

• Similar to Dedicated Hosts, but AWS manages the underlying physical infrastructure.

• Ensures that your EC2 instances run on isolated hardware, but you don’t get full host control.

When to Use Dedicated Instances?

✔ Companies needing isolation but not full host-level control.


✔ Workloads with strict security policies (e.g., financial institutions).

Real-Life Example:
A government agency running classified workloads requires complete isolation from other AWS
customers. They opt for Dedicated Instances to ensure their workloads remain secure and compliant.
7️. Capacity Reservations – Guaranteed Compute Capacity

What is it?

• Reserves compute capacity in a specific AWS region or Availability Zone (AZ).

• Unlike Reserved Instances, there’s no long-term commitment—you pay as long as the


reservation is active.

When to Use Capacity Reservations?

✔ For mission-critical workloads requiring guaranteed availability.


✔ When using AWS in high-demand regions (e.g., cloud gaming servers).

Real-Life Example:
A stock trading firm reserves compute capacity to handle stock market opening hours, ensuring zero
downtime when market activity is at its peak.

Choosing the Right EC2 Pricing Model Based on Your Use Case

Pricing Model Best For Cost Savings

On-Demand Short-term, unpredictable workloads ❌ No savings, highest cost


Reserved Instances
Long-term, steady-state workloads ✅ Up to 75% savings
(RIs)
Spot Instances Interruption-tolerant workloads ✅ Up to 90% savings

Flexible commitment for multiple


Savings Plans ✅ Up to 72% savings
instances
❌ High cost, but required for
Dedicated Hosts Compliance & licensing needs
security
Dedicated Instances Secure, isolated environments ❌ Higher cost than shared instances
Capacity Reservations Guaranteed compute capacity ❌ Pay for unused capacity

Final Takeaways:

• For unpredictable workloads → Use On-Demand.

• For steady-state workloads → Use Reserved Instances or Savings Plans.

• For batch processing or fault-tolerant jobs → Use Spot Instances.


• For compliance & regulatory needs → Use Dedicated Hosts/Instances.

• For guaranteed availability → Use Capacity Reservations.

By selecting the right EC2 pricing model, businesses can optimize cloud costs while ensuring
performance, security, and scalability.

=====================================================================================

Module 10. EC2 Instance Lifecycle – Stop, Start, Hibernate & Terminate

Amazon EC2 instances go through different lifecycle states based on how they are managed.
Understanding these states helps optimize cost, performance, and availability.

EC2 Instance States and Lifecycle Flow

An EC2 instance can be in one of the following states during its lifecycle:

1. Pending – The instance is launching.


2. Running – The instance is active and consuming resources.
3️. Stopping – The instance is in the process of stopping.
4️. Stopped – The instance has been shut down but can be restarted.
5️. Hibernated – The instance is paused while retaining RAM state.
6️. Terminated – The instance is permanently deleted.

1. Stop & Start – Temporary Shutdown Without Losing Data

What Happens When You Stop an EC2 Instance?

• The instance shuts down, but its root EBS volume (storage) remains intact.

• No compute charges (CPU/RAM) while stopped.

• You still pay for storage (EBS volume).

• Public IP is lost (unless using an Elastic IP).

• The instance can be started again anytime.

What Happens When You Start an EC2 Instance?

• A stopped instance restarts, maintaining previous configurations (OS, software, storage).

• It may launch on a different underlying host in AWS.

When to Use Stop & Start?


✔ For cost savings when instances are not in use (e.g., shutting down at night).
✔ For maintenance/upgrades without losing instance data.
✔ For troubleshooting an instance by rebooting it cleanly.

Real-Life Example:
A small SaaS startup turns off non-production EC2 instances overnight to save on compute costs while
keeping the storage intact.

2. Hibernate – Faster Resume with RAM Persistence

What Happens When You Hibernate an EC2 Instance?

• The instance saves its RAM state to disk (EBS volume) before shutting down.

• On restart, it resumes exactly where it left off, keeping all applications & memory states intact.

• No compute charges while hibernated, only storage charges.

• Public IP is lost (unless using an Elastic IP).

Hibernate vs. Stop

When to Use Hibernate?

✔ For faster startup times when resuming work.


✔ For keeping in-memory application states intact.
✔ For software development environments that need to resume quickly.

Real-Life Example:
A software development team hibernates EC2 instances at the end of the workday so they can resume
work quickly in the morning without waiting for applications to restart.

3️. Terminate – Permanent Deletion of an Instance


What Happens When You Terminate an EC2 Instance?

• The instance is permanently deleted and CANNOT be restarted.

• All data on instance storage (ephemeral disks) is lost.

• EBS volumes are deleted unless "Delete on Termination" is disabled.

• No further charges apply after termination.

When to Use Terminate?

✔ For decommissioning instances permanently.


✔ For cleaning up unused instances to avoid costs.
✔ For environments where instances should not persist after use (e.g., Auto Scaling).

Real-Life Example:
A retail company automatically terminates temporary EC2 instances used for handling peak Black
Friday traffic once the sales event ends.

EC2 Lifecycle State Transitions

Current State Can Transition To Notes


Pending Running Instance is starting
Stopping, Hibernate, Stop saves storage, Hibernate keeps RAM,
Running
Terminate Terminate deletes instance
Restarting keeps instance ID, Terminate deletes
Stopped Running, Terminate
instance
Running resumes RAM state, Terminate deletes
Hibernated Running, Terminate
instance
Terminated ❌ Cannot transition Instance is permanently deleted

Best Practices for Managing EC2 Lifecycle

✔ Use Stop instead of Terminate for cost savings on non-critical workloads.


✔ Enable Hibernate for faster startup times when working on long-running applications.
✔ Use Auto Scaling Groups to automatically terminate and replace instances as needed.
✔ Attach an Elastic IP to retain public IP when stopping/hibernating instances.
✔ Schedule instance shutdown using AWS Instance Scheduler to automate stopping at non-peak hours.
Final Takeaways

• Stop an instance to save costs but keep storage.

• Hibernate an instance for faster startup and RAM persistence.

• Terminate an instance when you no longer need it.

By effectively using these EC2 lifecycle states, businesses can optimize cloud costs, improve efficiency,
and ensure seamless operations.

5️. EC2 Hands-on Labs (Practical Learning)

Lab 1: Launching Linux & Windows EC2 Instances


Lab 2: Connecting via SSH & RDP
Lab 3️: Attaching & Expanding EBS Volumes
Lab 4️: Configuring Auto Scaling & Load Balancing

Project Example:

• Deploy a WordPress Website on EC2 with an Auto Scaling Group and ELB.

Final Outcome

By completing this module, students will:


Understand EC2 concepts and best practices.
Launch, configure, and secure EC2 instances.
Implement Auto Scaling and Load Balancing.
Optimize EC2 costs with the right pricing model.

=====================================================================================

Module 11. EC2 Hands-on Labs

1. Launching a Linux & Windows EC2 Instance

Steps to Launch an EC2 Instance:

1. Login to AWS Console → Navigate to EC2 Dashboard


2. Click "Launch Instance"
3. Choose an Amazon Machine Image (AMI)
• Linux: Amazon Linux 2, Ubuntu, CentOS, etc.

• Windows: Windows Server 2019/2022

4. Select Instance Type

• For Free Tier: t2.micro

• For production: Choose based on CPU, RAM needs

5. Configure Instance Details

• Network (VPC, Subnets): Define where the instance runs

• IAM Role: Grant permissions if required

6. Add Storage (EBS Volume)

• Default: 8 GiB for Linux, 30 GiB for Windows

7. Configure Security Groups

• Linux: Allow SSH (Port 22)

• Windows: Allow RDP (Port 3️3️8️9)


Generate Key Pair → Download .pem file for SSH/RDP access
Click "Launch"

Real-Life Use Case:


A web developer launches an Amazon Linux EC2 instance to set up a LAMP stack (Linux, Apache,
MySQL, PHP) for hosting a website.

2. Connecting via SSH (Linux) & RDP (Windows)


SSH Access to Linux EC2 Instance (Mac/Linux/Windows with Git Bash):

RDP Access to Windows EC2 Instance:

1. Copy Public IP from EC2 Dashboard.


2. Open Remote Desktop Connection (Windows: mstsc.exe).
3. Enter the Public IP and click Connect.
4. Retrieve the Administrator password from AWS (Decrypt using Key Pair).
5. Enter the password and log in.
Real-Life Use Case:
A cloud engineer logs into an EC2 Linux instance via SSH to configure a Node.js backend, while a
Windows-based application team accesses an EC2 instance via RDP to manage an SQL Server database.

3️. Attaching & Expanding EBS Volumes

Steps to Attach an EBS Volume to EC2

1. Go to EC2 Dashboard → Click Volumes under EBS.


2. Create a New Volume → Choose gp3️ (General Purpose SSD).
3️. Attach the volume to an existing running EC2 instance.
4️.Login via SSH (Linux) or RDP (Windows) to mount the volume.

Expanding an EBS Volume (Increase Storage Size)

1. Go to EC2 Dashboard → Select your EBS Volume.


2. Click Modify Volume → Increase the size (e.g., from 8 GiB to 20 GiB).
3️. Resize the filesystem inside the instance:

Linux (Amazon Linux/Ubuntu):

Windows (Disk Management):


1. Open Disk Management → Locate the EBS disk.
2. Right-click → Select Extend Volume.

Real-Life Use Case:


A startup running an e-commerce site expands its EC2 instance storage from 3️0 GB to 100 GB as
website traffic increases and more product data needs to be stored.

4️. Configuring Auto Scaling with EC2

Steps to Set Up Auto Scaling Group (ASG)


1. Go to EC2 Dashboard → Click Auto Scaling Groups.
2. Click Create Auto Scaling Group → Provide a name.
3. Select a Launch Template or Create a New One.
4. Define Instance Count

• Min: 2

• Desired: 3

• Max: 5

5. Set Scaling Policies

• Scale out when CPU > 7️0% (Add more instances).

• Scale in when CPU < 3️0% (Reduce instances).


Attach an Elastic Load Balancer (ELB) (Optional).
Review & Create ASG.

Real-Life Use Case:


A retail company configures Auto Scaling to automatically increase EC2 instances during peak sales
events (like Black Friday) and scale them down when traffic returns to normal.

Final Takeaways

✔ Launch & connect to EC2 (Linux & Windows) using SSH/RDP.


✔ Attach and expand EBS volumes to increase storage as needed.
✔ Use Auto Scaling to optimize cost and ensure high availability.

You might also like