Cloud Computing Power
VIRTUAL MACHINES & AMAZON EC2
Virtual Machines (VMs)
The digital emulation of a physical computer.
- Hardware Abstraction: Multiple "guest" operating systems run on a single physical "host" machine.
- Isolation: Each VM has its own virtual CPU, RAM, and Storage—independent of other VMs on the same host.
- Portability: VMs are essentially files. They can be snapshotted, copied, and moved across regions instantly.
What is Amazon EC2?
Elastic Compute Cloud
EC2 provides resizable compute capacity in the cloud. It reduces the time required to obtain and boot new server instances to minutes.
- Provisioning: Boot servers with your choice of OS (Linux, Windows, macOS).
- Elasticity: Increase or decrease capacity within minutes, not weeks.
- Control: You have full 'Root' or 'Administrator' access to the virtual hardware.
99.99%
Available Service Level Agreement (SLA) per Region.
Understanding Instance Families
General Purpose
Balanced CPU, Memory, and Networking. Ideal for standard web servers, small databases, and development workspaces.
t3.micro, m5.large
Compute Optimized
High-performance processors. Ideal for batch processing, media transcoding, scientific modeling, and dedicated gaming backends.
c6g.xlarge, c5.2xlarge
Memory Optimized
Fast performance for workloads that process large data sets in memory. Ideal for high-performance databases (Redis, SAP HANA).
r6i.large, r5.4xlarge
// INSTANCE TYPING PARSING
t3.micro
[t] ➔ Instance Family
(Burstable)
[3] ➔ Generation Model
[micro] ➔ Operational Size
(vCPU/RAM)
EC2 Sizing & Resources
How Instance Sizing Proportions Scale:
-
Linear Resource Scaling: Every step up in
size (e.g., from
largetoxlarge) typically doubles the allocated vCPU and RAM. - Networking Bandwidth: Larger instances get assigned higher gigabit networking lanes and EBS bandwidth allocations natively.
- Cost Allocation: Costs double linearly alongside resource sizes, allowing highly predictable budgeting.
| Size | vCPUs | Memory (GiB) | Network Speed |
|---|---|---|---|
| t3.nano | 2 | 0.5 | Up to 5 Gbps |
| t3.micro | 2 | 1.0 | Up to 5 Gbps |
| t3.small | 2 | 2.0 | Up to 5 Gbps |
| t3.medium | 2 | 4.0 | Up to 5 Gbps |
EC2 Purchasing Model Matrix
| Type | Discount | Best Use Case |
|---|---|---|
| On-Demand | 0% | Short Term / Spikes |
| Reserved | Up to 72% | Steady-State Prod |
| Spot | Up to 90% | Fault-Tolerant Jobs |
Amazon Machine Image (AMI)
AMIs are the "Golden Templates" for your servers.
- The Blueprint: Contains the OS, pre-configured application runtimes, and boot volume specifications.
- Standardization: Spin up 100 identical server instances instantly from a single custom AMI.
- Community & Marketplace: Choose from official AWS images, verified vendor stacks, or open-source software.
AMI PACKAGING
[ Root Volume Config ]
[ Operating System Kernel ]
[ Embedded Software Stack ]
[ Launch Permission Matrix ]
Key Pairs & Secure Access
Public-Key Cryptography for Login.
-
Private Key (.pem): Stored securely on your
local computer. Set strict permissions:
chmod 400 key.pem. -
Public Key: Injected automatically into the
server's
~/.ssh/authorized_keyspath at boot. - Asymmetric Handshake: SSH protocol verifies your identity without ever transmitting passwords.
⚠️ CRITICAL SECURITY RULE
"AWS does not save your private key. If you lose your downloaded .pem keypair file, you will be permanently locked out of your virtual server."
Elastic Block Store (EBS)
The "Hard Drive" of your Cloud Server.
- Data Persistence: Storage volumes persist even when your EC2 instance is stopped or restarted.
- Network Attached: EBS is connected via high-speed, sub-millisecond private networking lanes (independent of CPU lifecycle).
- Point-in-Time Snapshots: Incremental block-level backups stored directly in S3 for high durability.
🔥 Volume Categories
gp3: General Purpose SSD (Balances price
& speed; default boot storage)
io2: Provisioned IOPS (Extreme I/O
performance for core databases)
EC2 Security Groups
The Virtual Firewall for your Instance.
- Default Rule: All INBOUND traffic is blocked. All OUTBOUND traffic is allowed.
- Whitelisting: You specify the Protocol (TCP), Port (22/80/443), and Source (IP/CIDR).
- Dynamic: Changes to SG rules take effect immediately for all running instances.
★ SSH ACCESS RULE
Protocol: TCP
Source: MyIP/32
Note: Opening Port 22 to 0.0.0.0/0 (the world) is a security risk.
Instance Bootstrapping (User Data)
Automate server setup at launch.
- Run Once: Scripts only execute during the very first boot cycle.
- Automation: Install software, download code, or update configurations without manually SSHing in.
- Root Context: Scripts run with full administrative privileges.
# EXAMPLE USER DATA (BASH)
#!/bin/bashapt update -y
apt install -y nginx
systemctl start nginx
systemctl enable nginx
echo "Hello from AWS!" > /var/www/html/index.html
Instance Metadata (IMDS)
Data about your instance that you can access from INSIDE.
Access the "Magic IP" to retrieve details about the machine's identity.
http://169.254.169.254/latest/meta-data/
- Retrieve Public/Private IP addresses.
- Check Instance ID and Hostname.
- Verify IAM Role credentials assigned to the box.
V1 vs V2
IMDSv2 is the modern, token-based secure version. Always prefer V2 in production.