AWS EC2 ( Elastic Compute Cloud )
Short introduction to server's type:
PHYSICAL SERVER:
- A real physical machine with dedicated hardware and resources.
- Requires manual setup and maintenance.
- Average server utilization ~ 5/10 %
VIRTUAL SERVER:
- Runs on a physical server using virtualization software like Hypervisor (VMware / Hyper-V / Oracle VM)
- Shares resources with other VMs but operates independently.
- Average server utilization ~ 70/80 %
CONATINERS:
- A lightweight, isolated environment that shares the host OS kernel.
- Faster and more efficient than VMs.
- Ideal for running applications consistently across different environments.
AWS has their own customized server system called Nitro System.
- Is a set of hardware and software components that power modern EC2 instances.
- It improves performance, security, and efficiency by offloading tasks (like networking and storage) from the main CPU to dedicated hardware.
Key Components of the AWS Nitro System:
- Nitro Cards — Custom hardware that manages networking, storage, and security to free up CPU for applications.
- Nitro Security Chip — Ensures the security of the instance by preventing unauthorized access and eliminating the risk of host-level attacks.
- Nitro Hypervisor — A lightweight hypervisor that provides virtualization with minimal overhead, improving performance.
Benefits of the Nitro System:
✅ Better Performance — More CPU power is available for applications.
✅ Enhanced Security — Reduces attack surfaces by isolating management functions.
✅ Flexibility — Enables AWS to build and deploy different instance types more efficiently.
Most modern EC2 instances (e.g., M5, C5, R5, etc.) run on the Nitro System, making them more powerful and cost-effective.
To provision an Amazon EC2 Instance, you need the following components:
1. Amazon Machine Image (AMI)
- A pre-configured template that includes the operating system, software, and configurations.
Example: Amazon Linux, Ubuntu, Windows Server.
2. Instance Type
- Defines the hardware specifications such as CPU, RAM, and network performance.
- Optimized for different workload
- Elastic- Can be changed later
- Region Specific.
Example: t2.micro (small), m5.large (medium), c5.2xlarge (compute-optimized).
3. Key Pair
- A public-private key pair for secure SSH or RDP access to the instance.
4. Networking Configuration
- VPC (Virtual Private Cloud) — Defines the network for the instance.
- Subnet — Specifies the availability zone where the instance runs.
- Security Groups — Firewall rules that control inbound/outbound traffic.
- Elastic IP (Optional) — A static IP address for public-facing instances.
5. Storage ( EBS Volume )
- Root Volume — Primary storage for the instance (e.g., SSD or HDD).
- Additional Volumes (Optional) — Extra storage as needed.
6. IAM Role ( Optional )
- Assign permissions to the instance to access AWS services securely.
7. User Data ( Optional )
- A script that runs at startup for automated configurations (e.g., installing software).
Once these components are configured, the EC2 instance can be launched and used for various workloads.
EC2 Storage
Instance Store:
- Local Storage.
- Limited in Size.
- Ephemeral (Temp) Storage. If the Physical system is crash the data will be lost.
- Can be used to create SWAP / Temp Data
Elastic Block Storage (EBS):
- They are specific to a AZ.
- Permanent in nature. EBS volume persists even after the instance stops or is terminated
- Can be expanded (Can’t Shrink).
- Supports snapshot. Snapshots can be copied to another Region.
- Attached to Single EC2 instance.
- Supports encryption
EC2 Purchase Options:
AWS provides multiple EC2 purchase options to balance cost, flexibility, and performance based on your workload needs. Below are the key options:
1. On-Demand Instances (Pay-as-you-go)
✅ Best for: Short-term, unpredictable workloads.
✅ Pricing: Pay per second or per hour, no upfront payment.
✅ Use case: Development, testing, bursty workloads.
Example: Running a web application that needs to scale dynamically.
2. Reserved Instances (RI) (Commitment-based )
✅ Best for: Long-term, steady-state workloads.
✅ Pricing: Up to 72% discount compared to On-Demand.
✅ Options:
- Standard RI — Fixed-term (1–3 years), highest discount.
- Convertible RI — Flexible instance types, lower discount.
Example: Running a production database for 3 years with predictable usage.
3. Savings Plans (Flexible commitment)
✅ Best for: Workloads with consistent compute usage.
✅ Pricing: Similar to Reserved Instances but more flexible.
✅ Options:
- Compute Savings Plan — Any instance family or region.
- EC2 Instance Savings Plan — Specific instance family & region.
Example: A SaaS company with steady but evolving compute needs.
4. Spot Instances
✅ Best for: Fault-tolerant, flexible workloads.
✅ Pricing: Up to 70% cheaper than On-Demand.
✅ Risk: AWS can reclaim instances with a 2-minute warning if capacity is needed.
Example: Running batch jobs, big data processing, CI/CD pipelines.