0% found this document useful (0 votes)
3 views25 pages

Cloud Computing Virtualization Containers

This document serves as a comprehensive study guide on cloud computing, focusing on virtualization and containers. It covers key characteristics of virtualized environments, various virtualization techniques, and their relationship with cloud computing, including service and deployment models. Additionally, it discusses the advantages and disadvantages of virtualization, technology examples like XEN and VMware, and the building blocks of containers.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views25 pages

Cloud Computing Virtualization Containers

This document serves as a comprehensive study guide on cloud computing, focusing on virtualization and containers. It covers key characteristics of virtualized environments, various virtualization techniques, and their relationship with cloud computing, including service and deployment models. Additionally, it discusses the advantages and disadvantages of virtualization, technology examples like XEN and VMware, and the building blocks of containers.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CLOUD COMPUTING

Virtualization and Containers


A Complete Study Guide

Topics Covered:
● Characteristics of Virtualized Environments
● Taxonomy of Virtualization Techniques
● Virtualization and Cloud Computing
● Pros and Cons of Virtualization
● Technology Examples: XEN and VMware
● Building Blocks of Containers
● Container Platforms: LXC and Docker
● Container Orchestration: Docker Swarm and Kubernetes
● Public Cloud VM (Amazon EC2) and Container (Amazon ECS) Offerings
1. Virtualization — Introduction

Virtualization is the technology that allows you to create multiple simulated environments (virtual
machines) from a single physical hardware system. Think of it like dividing one big computer
into several smaller, independent computers — each running its own operating system and
applications.

💡 Simple Analogy
Imagine a large apartment building. The entire building is the physical server. Each
apartment is a virtual machine (VM). Each apartment has its own kitchen, bedroom,
bathroom — residents live independently without interfering with others. The building
manager (hypervisor) manages everything.

1.1 Characteristics of Virtualized Environments

Virtualized environments have several key characteristics that make them powerful and flexible:

A. Partitioning
A single physical machine is divided into multiple virtual machines. Each VM gets its own share
of CPU, memory, storage, and network resources.
● Multiple operating systems run simultaneously on one server
● Resources are divided/allocated as needed
● Each VM is isolated from others

B. Isolation
Each virtual machine is completely isolated from others. If one VM crashes, it does NOT affect
other VMs running on the same hardware.
● Fault isolation: crashes in one VM don't spread
● Security isolation: VMs can't access each other's data
● Performance isolation: one VM can't consume all resources (resource limits apply)

C. Encapsulation
An entire VM (operating system, applications, files) is stored as files on disk. This makes VMs
easy to:
● Move from one server to another (migration)
● Back up and restore
● Clone (copy) quickly
D. Hardware Independence
Virtual machines do not depend on the physical hardware they were created on. They can be
moved to any server and will work the same way.

E. Resource Pooling
Physical resources (CPU, RAM, storage) are pooled together and shared dynamically across
multiple VMs. Resources can be added or removed without downtime.

Virtualized Environment Architecture


+------------------------------------------------------+
| Physical Hardware (Server) |
| CPU Cores | RAM | Hard Disk | Network Card |
+------------------------------------------------------+
| Hypervisor (VMM) |
| (Manages all Virtual Machines) |
+------------------+------------------+---------------+
| VM 1 | VM 2 | VM 3 |
| Windows 10 | Ubuntu Linux | CentOS |
| App A, App B | App C, App D | App E |
+------------------+------------------+---------------+

1.2 Taxonomy of Virtualization Techniques

Virtualization is not just one technique — there are several types, each used for different
purposes:

1. Full Virtualization
The guest operating system runs without any modifications. The hypervisor completely
simulates the hardware. The guest OS doesn't even know it's running in a virtual environment.
● Examples: VMware Workstation, VirtualBox
● Advantage: Any OS can run without modification
● Disadvantage: Slightly slower due to full hardware simulation

2. Para-Virtualization
The guest OS is modified slightly to communicate directly with the hypervisor. This makes it
faster than full virtualization.
● Examples: Xen (paravirtualization mode)
● Advantage: Better performance
● Disadvantage: Guest OS must be modified
3. Hardware-Assisted Virtualization
Modern CPUs (Intel VT-x, AMD-V) have built-in support for virtualization. The hypervisor uses
these CPU features to run VMs efficiently without software tricks.
● Examples: KVM (Kernel-based Virtual Machine)
● Advantage: Near-native performance

4. OS-Level Virtualization (Containers)


Instead of virtualizing hardware, the OS kernel is shared. Multiple isolated user-space instances
(containers) run on top of a single OS kernel.
● Examples: Docker, LXC
● Advantage: Very lightweight, fast startup
● Disadvantage: All containers must use the same OS kernel

5. Network Virtualization
Physical network resources are combined and divided into virtual networks. Example: VLANs
(Virtual Local Area Networks), SDN (Software-Defined Networking).

6. Storage Virtualization
Multiple physical storage devices appear as one large storage pool. Examples: SAN (Storage
Area Networks), NAS solutions.

Type Guest OS Modified? Performance Example

Full Virtualization No Moderate VMware, VirtualBox


Para-Virtualization Yes High Xen
HW-Assisted No Very High KVM
OS-Level (Containers) N/A (shares kernel) Highest Docker, LXC
2. Virtualization and Cloud Computing

Virtualization is the backbone of cloud computing. Without virtualization, cloud computing as we


know it would not exist. Here's how they are connected:

2.1 How Virtualization Enables Cloud Computing

Relationship: Virtualization → Cloud Computing


Physical Servers
|
v
Virtualization (Hypervisor) <-- Creates Multiple VMs
|
v
Resource Pooling (CPU, RAM, Storage pooled together)
|
v
On-Demand Provisioning (Allocate resources to users instantly)
|
v
Cloud Services (IaaS, PaaS, SaaS)

Cloud computing uses virtualization to:


● Host multiple customers on the same physical server (isolated from each
other)Multi-tenancy:
● Quickly create/destroy VMs to scale up or down based on demandElasticity:
● Charge users only for the virtual resources they usePay-as-you-go:
● Migrate VMs between physical servers for maintenance without downtimeHigh
availability:

2.2 Cloud Service Models

Model Full Name What You Get Example

IaaS Infrastructure as a VMs, storage, Amazon EC2, Azure


Service networking VMs
PaaS Platform as a Service Runtime, frameworks, Google App Engine,
databases Heroku
SaaS Software as a Service Ready-to-use apps Gmail, Office 365,
Salesforce
2.3 Cloud Deployment Models

● Resources owned by a cloud provider (AWS, Azure, GCP), shared among


customersPublic Cloud:
● Resources dedicated to a single organization, hosted on-premises or by a
providerPrivate Cloud:
● Mix of public and private — sensitive data on private, scalable workloads on
publicHybrid Cloud:
● Shared by organizations with common interests (e.g., government
agencies)Community Cloud:
3. Pros and Cons of Virtualization

3.1 Advantages of Virtualization

Advantage Explanation

Cost Savings Fewer physical servers needed → lower hardware, power, cooling, and
space costs. One server can do the job of 10!
Server Consolidation Run multiple workloads on a single server instead of buying a server for
each application.
Easy Backup & VMs are files → take a snapshot before making changes. If something
Recovery breaks, restore instantly.
Faster Deployment Spin up a new server in minutes (vs. days/weeks to buy and set up
physical hardware).
Testing & Developers can create isolated test environments quickly without affecting
Development production systems.
High Availability VMs can be live-migrated to another server if hardware fails — zero or
minimal downtime.
Energy Efficiency Running fewer servers means consuming less electricity — better for
environment and budget.
Scalability Easily add more VMs when load increases, and remove them when not
needed.

3.2 Disadvantages of Virtualization

Disadvantage Explanation

Performance Hypervisor adds a layer between hardware and VMs — there's always
Overhead some performance loss compared to running directly on hardware.
High Initial Cost Powerful servers capable of running many VMs and good storage are
expensive upfront.
Complexity Managing many VMs, hypervisors, and virtual networks can be complex
and requires skilled staff.
Security Risks If the hypervisor is compromised, ALL VMs on that server could be at risk
(hypervisor attacks).
VM Sprawl Easy creation of VMs can lead to too many unused VMs, wasting
resources and making management harder.
Single Point of If the physical server fails and no redundancy is in place, all VMs on it go
Disadvantage Explanation

Failure down.
4. Technology Examples: XEN and VMware

4.1 XEN Hypervisor

Xen is a free and open-source hypervisor developed at the University of Cambridge. It is a Type
1 (bare-metal) hypervisor — it runs directly on the hardware without a host OS.

XEN Architecture
+-------------------------------------------------------+
| Physical Hardware |
+-------------------------------------------------------+
| XEN HYPERVISOR |
+-----------+------------+------------+----------------+
| Domain 0 | Domain U | Domain U | Domain U |
| (Dom0) | (DomU 1) | (DomU 2) | (DomU 3) |
| Privileged| Guest OS 1 | Guest OS 2 | Guest OS 3 |
| Linux OS | (unprivil.)| (unprivil.)| (unprivil.) |
| Controls | Apps | Apps | Apps |
| hardware | | | |
+-----------+------------+------------+---------------+

Key Concepts in XEN


● The privileged control domain. It runs a Linux OS and has direct access to
hardware. It manages all other [Link] 0 (Dom0):
● Unprivileged guest domains (the regular VMs). They run applications but have no
direct hardware [Link] U (DomU):
● Sits between hardware and all domains. Controls CPU scheduling and memory
[Link] Hypervisor:

XEN Virtualization Modes


● Guest OS is modified to work with Xen. Faster but requires OS changes. Linux
works well with [Link] (PV):
● Uses CPU hardware extensions (Intel VT, AMD-V). Guest OS needs NO
modification. Works with Windows and [Link] Virtual Machine (HVM):
● Hybrid mode — uses HVM with paravirtualized drivers for best [Link] on
HVM (PVHVM):

💡 Where is Xen used?


Amazon Web Services (AWS) historically used Xen as its hypervisor for EC2 instances.
Many cloud providers and hosting companies use Xen for its reliability and performance.
4.2 VMware

VMware is the industry leader in virtualization technology. It provides both Type 1 (bare-metal)
and Type 2 (hosted) hypervisors and a complete suite of virtualization products.

Key VMware Products


● Type 1 bare-metal hypervisor. Runs directly on server hardware without a host
OS. Used in enterprise data [Link] ESXi:
● Complete virtualization platform combining ESXi + vCenter Server. Manages entire
data [Link] vSphere:
● Centralized management tool for multiple ESXi hosts and their [Link]
vCenter Server:
● Type 2 hypervisor for desktop use. Runs on Windows/Linux. Used by developers
for [Link] Workstation:
● Type 2 hypervisor for Mac [Link] Fusion:

VMware vSphere Architecture


+----------------------------------------------------------+
| vCenter Server |
| (Central management of all hosts and VMs) |
+------------------+------------------+-------------------+
| ESXi Host 1 | ESXi Host 2 | ESXi Host 3 |
| (Bare-metal | (Bare-metal | (Bare-metal |
| Hypervisor) | Hypervisor) | Hypervisor) |
| VM1 VM2 VM3 | VM4 VM5 VM6 | VM7 VM8 VM9 |
+------------------+------------------+-------------------+
| Shared Storage (SAN/NAS) Network Fabric |
+----------------------------------------------------------+

Key VMware Features


● Live migration — move a running VM from one physical host to another with
ZERO downtime. Useful for [Link]:
● If a host fails, VMs are automatically restarted on other hosts within [Link]
Availability (HA):
● Automatically balances VM workloads across hosts based on resource
[Link] Resource Scheduler (DRS):
● Creates a live shadow copy of a VM on another host — if primary fails, shadow
takes over instantly with no [Link] Tolerance (FT):

Feature XEN VMware ESXi

Type Open Source Commercial (Free ESXi, paid


vSphere)
Hypervisor Type Type 1 (Bare-metal) Type 1 (Bare-metal)
Feature XEN VMware ESXi

Management Command line / XenCenter vCenter Server (GUI)


Live Migration Yes (XenMotion) Yes (vMotion)
Primary Use Cloud providers, Linux Enterprise data centers
AWS Usage Used historically by AWS Used in VMware Cloud on
AWS
5. Building Blocks of Containers

Containers are a lightweight alternative to virtual machines. While VMs virtualize hardware,
containers virtualize the operating system. Multiple containers share the same OS kernel but
are isolated from each other.

💡 VM vs Container Analogy
Virtual Machines are like separate houses — each has its own foundation, walls, plumbing,
electricity (full OS). Containers are like apartments in one building — they share the
building's infrastructure (OS kernel) but each has its own space (isolated environment).

5.1 VM vs Container: Architecture Comparison

Virtual Machines vs Containers


VIRTUAL MACHINES CONTAINERS
┌─────────────────┐ ┌─────────────────┐
│ App A │ │App A │ App B │
├─────────────────┤ ├──────┴──────────┤
│ Guest OS │ │ Container │
├─────────────────┤ │ Runtime │
│ App B │ │ (Docker, etc.) │
├─────────────────┤ ├──────────────────┤
│ Guest OS │ │ Host OS Kernel │
├─────────────────┤ │ (Shared!) │
│ Hypervisor │ ├──────────────────┤
├─────────────────┤ │ Physical Server │
│ Physical Server│ └──────────────────┘
└─────────────────┘
Heavier (GBs per VM) Lighter (MBs per container)
Slower startup (minutes) Fast startup (seconds)

5.2 Core Building Blocks of Containers

1. Linux Namespaces
Namespaces provide isolation. Each container gets its own view of system resources. The
container thinks it has its own OS, but it's actually sharing the kernel.
● Processes in a container get their own process IDs. Container can't see processes
outside [Link] Namespace:
● Each container gets its own network interface, IP address, and routing
[Link] Namespace:
● Each container has its own filesystem [Link] Namespace:
● Containers can have their own user [Link] Namespace:
● Each container can have its own [Link] Namespace:

2. Control Groups (cgroups)


cgroups limit and monitor the resources a container can use. Without cgroups, one container
could consume all CPU/RAM and starve others.
● CPU limits: How many CPU cycles a container can use
● Memory limits: Maximum RAM a container can consume
● Disk I/O limits: How fast a container can read/write disk
● Network limits: Bandwidth limits for containers

3. Union File System (UnionFS)


Container images are made of layers stacked on top of each other. UnionFS makes these
layers appear as one unified filesystem. Each layer only stores the changes from the previous
layer.
Container Image Layers
Layer 4: Your App Code (Read-Write layer) ← Container Layer
─────────────────────────────────────────
Layer 3: npm packages installed ← Image Layer
Layer 2: [Link] installed ← Image Layer
Layer 1: Ubuntu Base OS ← Base Image

Shared base layers are reused across containers!


If 5 containers use Ubuntu base, it's stored only ONCE.

4. Container Runtime
The container runtime is the software responsible for running containers. It uses namespaces,
cgroups, and UnionFS to create and manage containers.
● Low-level runtimes: runc (OCI standard runtime), containerd
● High-level runtimes: Docker (uses containerd under the hood)

5. Container Image
A container image is a read-only template used to create containers. It includes everything the
application needs: code, runtime, libraries, environment variables, and config files.
● Images are stored in registries: Docker Hub, Amazon ECR, Google Container Registry
● Image = Base Image + Layers of changes (defined in Dockerfile)
6. Container Platforms: LXC and Docker

6.1 LXC (Linux Containers)

LXC is one of the earliest Linux container technologies. It provides OS-level virtualization using
Linux namespaces and cgroups. LXC containers behave more like lightweight VMs — they run
a full Linux system inside the container.

💡 LXC vs Docker
LXC is designed to run a full Linux OS in a container (like a lightweight VM). Docker is
designed to run a single application in a container. Docker is more popular for application
deployment.

LXC Architecture
LXC Architecture
+---------------------------------------------------+
| Physical / Virtual Server |
+---------------------------------------------------+
| Linux Kernel |
| (Namespaces + cgroups) |
+---------------+------------------+---------------+
| LXC Container| LXC Container | LXC Container|
| Full Linux | Full Linux | Full Linux |
| System (mini)| System (mini) | System (mini)|
| Multiple Apps| Multiple Apps | Multiple Apps|
+---------------+------------------+---------------+

LXC Key Features


● Runs a full Linux OS inside a container
● Uses Linux namespaces for isolation
● Uses cgroups for resource limits
● Can be managed via LXD (a daemon that adds extra features to LXC)
● More like a VM, but much lighter

6.2 Docker

Docker is the most popular containerization platform today. Released in 2013, it made
containers easy to use with simple commands and a vast ecosystem. Docker is designed for
running single applications in containers.
Docker Architecture
Docker Architecture
+-----------+ CLI Commands +------------------+
| Developer |-------------------->| Docker Client |
| (You) | docker build/run | (docker CLI) |
+-----------+ +------------------+
|
Docker API (REST)
|
v
+--------------------+
| Docker Daemon |
| (dockerd) |
| Manages images, |
| containers, |
| networks, volumes|
+--------------------+
| |
+------+ +-----+------+
| |
+-------------+ +-----------+------+
| containerd | | Docker Hub |
| (Runtime) | | (Image Registry) |
+------+------+ +------------------+
|
+------+------+
| runc |
| (OCI runtime|
| Creates |
| Containers) |
+-------------+

Key Docker Concepts


● A text file with instructions to build a Docker image. Like a [Link]:
● Read-only template built from a Dockerfile. Stored in [Link] Image:
● A running instance of an image. Ephemeral (temporary) by [Link]
Container:
● Public registry with thousands of pre-built images (official Ubuntu, [Link],
MySQL images, etc.)Docker Hub:
● Persistent storage for containers. Data survives even if container is
[Link] Volume:
● Virtual networks connecting containers. Containers can communicate with each
[Link] Network:

Docker Workflow (How it works step by step)


● Write a Dockerfile (define your app and its dependencies)
● Run 'docker build' → Creates a Docker image from Dockerfile
● Run 'docker push' → Upload image to Docker Hub or private registry
● Run 'docker pull' → Download image on any server
● Run 'docker run' → Start a container from the image

Feature LXC Docker

Purpose Full OS container Single application container


Size Larger (full Linux) Smaller (app + minimal deps)
Startup Speed Seconds Milliseconds
Use Case Server replacement Microservices, app deployment
Popularity Less common Industry standard
Management Tool LXD Docker CLI / Docker Compose
7. Container Orchestration

When running containers in production, you may have HUNDREDS or THOUSANDS of


containers. Managing them manually is impossible. Container orchestration automates
deployment, scaling, networking, and management of containers.

💡 Why Orchestration?
Imagine 500 containers running your app. One crashes — who restarts it? Traffic spikes —
who adds more containers? A server fails — who moves containers to another server?
Orchestration tools do all this automatically.

7.1 Docker Swarm

Docker Swarm is Docker's built-in orchestration tool. It turns a group of Docker hosts (servers)
into a single, virtual Docker host — called a Swarm.

Docker Swarm Architecture


+--------------------------------------------------+
| DOCKER SWARM |
+--------------------------------------------------+
| MANAGER NODES (Control Plane) |
| +-----------+ +-----------+ +-----------+ |
| | Manager 1 | | Manager 2 | | Manager 3 | |
| | (Leader) | | (Follower)| | (Follower)| |
| +-----------+ +-----------+ +-----------+ |
| Raft Consensus Algorithm (Leader Election) |
+--------------------------------------------------+
| WORKER NODES (Run containers) |
| +----------+ +----------+ +----------+ |
| | Worker 1 | | Worker 2 | | Worker 3 | |
| |[C1][C2] | |[C3][C4] | |[C5][C6] | |
| +----------+ +----------+ +----------+ |
+--------------------------------------------------+
C = Container

Key Docker Swarm Concepts


● A server (physical or virtual) participating in the Swarm. Can be a Manager or
[Link]:
● Controls the Swarm. Accepts commands and schedules tasks. Uses Raft
consensus to elect a [Link] Node:
● Runs containers as instructed by [Link] Node:
● A definition of how to run a container — which image, how many replicas, which
[Link]:
● A running container on a specific worker node. Manager assigns tasks to
[Link]:
● Virtual network that spans across all nodes in the Swarm. Containers on different
nodes can [Link] Network:
● Swarm automatically load-balances incoming traffic across all containers in a
[Link] Load Balancer:

Docker Swarm: Key Features


● Simple setup: Just 'docker swarm init' on manager, 'docker swarm join' on workers
● Built-in load balancing: Traffic is automatically distributed
● Self-healing: If a container crashes, Swarm restarts it automatically
● Rolling updates: Update containers without downtime
● Secrets management: Securely pass passwords/keys to containers

7.2 Kubernetes (K8s)

Kubernetes (often abbreviated as K8s) is an open-source container orchestration platform


originally designed by Google, now maintained by the Cloud Native Computing Foundation
(CNCF). It is the most powerful and widely used container orchestration system.

Kubernetes Architecture
+------------------------------------------------------------------+
| KUBERNETES CLUSTER |
+------------------------------------------------------------------+
| CONTROL PLANE (Master Node) |
| +------------+ +----------+ +------------------+ +-----------+ |
| | API Server | |Scheduler | |Controller Manager| | etcd | |
| |(Entry point)| |(Places | |(Maintains desired| |(Key-value | |
| | | | Pods on | | state) | | store for | |
| | | | nodes) | | | | cluster | |
| | | | | | | | data) | |
| +------------+ +----------+ +------------------+ +-----------+ |
+------------------------------------------------------------------+
| WORKER NODES |
| +----------------------+ +----------------------+ |
| | Worker Node 1 | | Worker Node 2 | |
| | +---------+ | | +---------+ | |
| | | kubelet| | | | kubelet| | |
| | +---------+ | | +---------+ | |
| | | kube- | | | | kube- | | |
| | | proxy | | | | proxy | | |
| | +---------+ | | +---------+ | |
| | +--+ +--+ +--+ | | +--+ +--+ +--+ | |
| | |P1| |P2| |P3| | | |P4| |P5| |P6| | |
| | +--+ +--+ +--+ | | +--+ +--+ +--+ | |
| | Pods (containers) | | Pods (containers) | |
| +----------------------+ +----------------------+ |
+------------------------------------------------------------------+
Key Kubernetes Concepts
● The smallest deployable unit in Kubernetes. A Pod contains one or more tightly-
coupled containers that share network and storage. Usually 1 container per
[Link]:
● A server (physical or VM) that runs Pods. Has kubelet (agent), kube-proxy
(networking), and container [Link]:
● A set of nodes managed by [Link]:
● The front-end of the Kubernetes control plane. All commands and communication
go through [Link] Server:
● A distributed key-value store that holds all cluster configuration and state
[Link]:
● Decides which node to run a new Pod on, based on resource
[Link]:
● Continuously checks that the current state matches the desired state. If a Pod
dies, it creates a new [Link] Manager:
● Agent running on each worker node. Talks to API server and manages Pods on
that [Link]:
● Handles networking rules on each node. Routes traffic to the right [Link]-
proxy:

Kubernetes Higher-Level Objects


● Manages a set of identical Pods. Define desired state (e.g., 'run 5 replicas of my
app'). K8s maintains [Link]:
● Provides a stable IP address/DNS name for a set of Pods. Load-balances traffic
across [Link]:
● Virtual clusters within a cluster. Used to separate environments (dev, staging,
production).Namespace:
● Store configuration data separately from container [Link]:
● Store sensitive data (passwords, API keys) [Link]:
● Storage resource in the cluster that lives independently of [Link] Volume
(PV):
● Manages external access to services, typically HTTP/HTTPS. Acts like a reverse
[Link]:

Feature Docker Swarm Kubernetes

Complexity Simple, easy to learn Complex, steep learning curve


Setup Very easy Complex (multiple components)
Scalability Good (hundreds of nodes) Excellent (thousands of nodes)
Auto-scaling Manual Automatic (HPA)
Load Balancing Built-in Built-in (more options)
Rolling Updates Yes Yes (more control)
Feature Docker Swarm Kubernetes

Monitoring Basic Rich ecosystem (Prometheus,


Grafana)
Use Case Small-medium deployments Large enterprise production
systems
Backed by Docker Google / CNCF
8. Public Cloud Offerings: AWS EC2 and ECS

Amazon Web Services (AWS) is the world's largest cloud provider. It offers both Virtual Machine
(EC2) and Container (ECS) services.

8.1 Amazon EC2 (Elastic Compute Cloud)

Amazon EC2 is AWS's virtual machine service. It provides resizable virtual servers (called
instances) in the cloud. You can launch a virtual server in minutes and pay only for what you
use.

Amazon EC2 Overview


AWS CLOUD
+------------------------------------------------------+
| REGION (e.g., US-East-1) |
| +---------------------------+ |
| | Availability Zone A | |
| | +----------+ +--------+ | |
| | | EC2 | | EC2 | | |
| | | Instance | |Instance| | |
| | | (VM) | | (VM) | | |
| | +----------+ +--------+ | |
| +---------------------------+ |
| +---------------------------+ |
| | Availability Zone B | |
| | +----------+ +--------+ | |
| | | EC2 | | EC2 | | |
| | | Instance | |Instance| | |
| | +----------+ +--------+ | |
| +---------------------------+ |
+------------------------------------------------------+

Key EC2 Concepts


● A virtual server. Comes in many types (sizes) like [Link], [Link],
[Link]:
● A template for your instance. Contains OS, software, configuration. Like a VM
[Link] (Amazon Machine Image):
● Different CPU/RAM/storage combinations for different [Link] Types:
● Virtual firewall that controls inbound/outbound traffic to your [Link]
Groups:
● SSH key used to securely log into Linux [Link] Pairs:
● A static public IP address that stays with your account even if you stop/start
[Link] IP:
● Persistent storage for EC2 instances. Like a virtual hard [Link] (Elastic Block
Store):
● Your own private network inside AWS. EC2 instances run inside a [Link]
(Virtual Private Cloud):

EC2 Instance Types (by use case)


Family Optimized For Example Types Use Case

General Purpose Balanced CPU/RAM t3, m5 Web servers, dev


environments
Compute Optimized High CPU c5, c6g Batch processing,
gaming servers
Memory Optimized High RAM r5, x1 Databases, in-memory
caches
Storage Optimized High disk throughput i3, d2 NoSQL databases,
data warehouses
GPU Instances Graphics/ML p3, g4 Machine learning,
computing video encoding

EC2 Pricing Models


● Pay by the hour/second. No commitment. Best for short-term or unpredictable
[Link]-Demand:
● Commit to 1-3 years. Up to 75% cheaper than On-Demand. Good for steady-state
[Link] Instances:
● Bid for unused AWS capacity. Up to 90% cheaper. Can be interrupted. Good for
batch [Link] Instances:
● Flexible pricing in exchange for usage [Link] Plans:

EC2 Auto Scaling


Auto Scaling automatically adds or removes EC2 instances based on demand:
● Scale OUT: Add more instances when traffic increases
● Scale IN: Remove instances when traffic decreases
● Minimum/Maximum capacity: Set limits so you're never over or under provisioned
● Combined with Elastic Load Balancer (ELB) to distribute traffic

8.2 Amazon ECS (Elastic Container Service)

Amazon ECS is AWS's managed container orchestration service. It allows you to run Docker
containers at scale without managing servers. Think of ECS as a managed Kubernetes/Docker
Swarm, but simpler and deeply integrated with AWS services.
Amazon ECS Architecture
+-----------------------------------------------------------+
| AWS CLOUD |
| +--------------------+ +----------------------------+ |
| | ECS CONTROL | | Docker Image Registry | |
| | PLANE | | Amazon ECR | |
| | (Managed by AWS) | | (Elastic Container | |
| | | | Registry) | |
| +--------------------+ +----------------------------+ |
| | | |
| v v |
| +----------------------------+ Pulls Images |
| | ECS CLUSTER | |
| | | |
| | LAUNCH TYPE 1: EC2 | LAUNCH TYPE 2: Fargate |
| | +---------+ +---------+ | +---------+ +---------+ ||
| | |EC2 Node | |EC2 Node | | |Container| |Container| ||
| | |[C1][C2] | |[C3][C4] | | |(No serv-| |(No serv-| ||
| | +---------+ +---------+ | | er mgmt)| | er mgmt)| ||
| | You manage EC2 instances | +---------+ +---------+ ||
| +----------------------------+ AWS manages everything |
+-----------------------------------------------------------+

Key ECS Concepts


● A logical group of tasks or services and the infrastructure they run [Link]:
● Blueprint for your application. Specifies which Docker images to use,
CPU/memory, ports, environment variables. Like a Dockerfile but for running
[Link] Definition:
● A running instance of a Task Definition. Equivalent to a Pod in [Link]:
● Ensures a specified number of Tasks are always running. If a task fails, ECS
restarts [Link]:
● Within a Task Definition, specifies individual container [Link]
Definition:

ECS Launch Types


● You manage EC2 instances in the cluster. Containers run on your EC2 instances.
You have full control but must manage servers.EC2 Launch Type:
● AWS manages the underlying servers. You only specify CPU and memory for
containers. Truly serverless containers — no server management!Fargate Launch
Type:

Feature Amazon EC2 Amazon ECS

What it provides Virtual Machines Container orchestration


Unit of compute EC2 Instance (VM) Task/Container
Managed by You manage OS, software AWS manages orchestration
Scaling Auto Scaling Groups Service auto-scaling
Feature Amazon EC2 Amazon ECS

Pricing Per instance-hour Per task resources (Fargate) or


EC2 cost
Use case Full control over servers Run containerized applications
Equivalent to Any VM/hypervisor Kubernetes/Docker Swarm

ECS vs EKS (Amazon's Managed Kubernetes)


Feature Amazon ECS Amazon EKS

Full name Elastic Container Service Elastic Kubernetes Service


Orchestrator AWS proprietary Kubernetes (open-source)
Complexity Simpler, AWS-native More complex, K8s knowledge
needed
Portability AWS-only Portable across cloud providers
Ecosystem AWS services integration Full Kubernetes ecosystem
Best for AWS-only deployments Multi-cloud or K8s teams
9. Summary & Quick Revision

Key Takeaways

Topic Key Point

Virtualization Creates multiple VMs from one physical server using a hypervisor
VM Characteristics Partitioning, Isolation, Encapsulation, Hardware Independence
Virtualization Types Full, Para, HW-Assisted, OS-Level (Containers), Network, Storage
Cloud + Virtualization Virtualization enables multi-tenancy, elasticity, and pay-as-you-go
cloud
Pros of Virtualization Cost savings, consolidation, easy backup, fast deployment,
scalability
Cons of Virtualization Performance overhead, complexity, security risks, VM sprawl
XEN Open-source Type 1 hypervisor. Dom0 controls DomU guests. Used
by AWS historically
VMware Commercial Type 1 hypervisor. Features: vMotion, HA, DRS.
Industry leader
Container Basics Uses namespaces, cgroups, UnionFS. Lighter than VMs. Shares
OS kernel
LXC Full OS in a container. More like lightweight VM. Predecessor to
Docker
Docker Single app per container. Image → Container workflow. Docker Hub
for images
Docker Swarm Docker's orchestration. Simple setup. Managers + Workers. Good
for small scale
Kubernetes Powerful orchestration. Pods, Deployments, Services. Control Plane
+ Workers
Amazon EC2 AWS virtual machines. Pay-per-hour. Auto Scaling. Multiple
instance types
Amazon ECS AWS container service. Task Definitions + Services. EC2 or Fargate
mode

Good Luck with your exams!


Cloud Computing — Virtualization and Containers

You might also like