Amazon EC2 (Elastic Compute Cloud)
Here’s a detailed breakdown of EC2 features and components
EDUCATIONAL
1. EC2 Instances
EC2 instances are virtual servers that you can use to run applications on the AWS cloud. These instances come with a variety of sizes, types, and configurations to suit different use cases.
Instance Types: EC2 instances come in various types, each optimized for specific tasks. These include:
General Purpose: Balanced compute, memory, and networking (e.g., t3, m5).
Compute Optimized: High-performance processors for compute-heavy applications (e.g., c5, c6g).
Memory Optimized: High memory-to-CPU ratios for in-memory applications (e.g., r5, x1e).
Storage Optimized: High disk throughput for large-scale data workloads (e.g., i3, d2).
GPU Instances: Instances with GPUs for graphics processing and machine learning (e.g., p4, g4dn).
High Performance Computing (HPC): Instances optimized for high-performance scientific or engineering applications (e.g., hpc6a).
2. Key Components of EC2
Amazon Machine Images (AMIs): Pre-configured virtual machine templates that include the operating system and any software needed to launch an instance. You can either use pre-built AMIs or create your own custom ones.
EBS (Elastic Block Store): Persistent block storage that can be attached to EC2 instances. EBS volumes are used to store data that needs to persist even after the instance is stopped or terminated.
Security Groups: Virtual firewalls that control the inbound and outbound traffic to EC2 instances. You define rules for traffic allowed to and from instances.
Key Pairs: A pair of SSH keys used for securely accessing EC2 instances. You need the private key to connect to the instance over SSH.
Elastic IP: A static IP address designed for dynamic cloud computing. Elastic IPs allow you to associate a static IP with a running instance.
3. EC2 Pricing
EC2 pricing is based on several factors:
On-Demand Instances: Pay per hour or second for computing capacity with no long-term commitment. Ideal for short-term, unpredictable workloads.
Reserved Instances: Pay for a specific instance type over a term of 1 or 3 years in exchange for a lower hourly rate. These are suitable for steady-state workloads.
Spot Instances: Take advantage of unused EC2 capacity at a lower price. Spot instances can be interrupted by AWS with little notice, so they are best for fault-tolerant workloads.
Savings Plans: Flexible pricing model that allows you to commit to using specific EC2 instance types and receive a discount for longer-term commitments.
4. Auto Scaling
Auto Scaling enables EC2 instances to automatically scale in or out based on predefined conditions, such as CPU usage or network traffic. This ensures that your application has the right amount of compute capacity to handle traffic fluctuations.
Auto Scaling Groups: A collection of EC2 instances managed by Auto Scaling. The group is configured with scaling policies that define when and how to scale.
5. Elastic Load Balancing (ELB)
ELB automatically distributes incoming traffic across multiple EC2 instances to ensure high availability and fault tolerance. There are different types of load balancers:
Application Load Balancer (ALB): Best for HTTP/HTTPS traffic and provides advanced routing features.
Network Load Balancer (NLB): Best for TCP/UDP traffic with very high performance.
Classic Load Balancer (CLB): Legacy load balancer offering basic load balancing.
6. Networking Features
Virtual Private Cloud (VPC): A virtual network that isolates your EC2 instances and resources. VPC enables you to define subnets, route tables, and network access control lists (ACLs).
Elastic Network Interface (ENI): A virtual network card that you can attach to an EC2 instance for additional networking features, such as multiple IP addresses.
Private IPs: IP addresses that are not reachable from the public internet and are used for internal communication between EC2 instances in a VPC.
7. EC2 Instance Lifecycle
EC2 instances go through various states during their lifecycle:
Pending: The instance is being initialized.
Running: The instance is actively running.
Stopping: The instance is being shut down.
Stopped: The instance has been stopped but can be restarted.
Terminated: The instance has been permanently deleted.
8. Storage Options
Instance Store: Temporary storage that is physically attached to the host machine. Data on instance store is lost when the instance is stopped or terminated.
Amazon Elastic File System (EFS): Scalable file storage for use with EC2 instances. EFS provides a simple, scalable, and fully managed file storage solution.
S3 (Simple Storage Service): Object storage service that can be used for storing large amounts of data. While not directly attached to EC2 instances, EC2 can access data stored in S3.
9. EC2 Monitoring and Management
CloudWatch: Provides monitoring and logging of EC2 instances. You can collect metrics (e.g., CPU usage, memory, disk I/O) and set alarms to notify you when thresholds are breached.
EC2 Systems Manager: A service for managing and automating operational tasks across EC2 instances, such as software patching, configuration management, and compliance.
AWS CloudTrail: Tracks and logs API requests made to EC2, providing security auditing and operational troubleshooting capabilities.
10. EC2 Use Cases
Web Hosting: Host web applications, websites, and APIs in a scalable and cost-effective way.
Big Data Processing: Run data analysis workloads or data processing tasks using EC2 instances tailored for such operations.
Machine Learning: Leverage GPU instances for deep learning training and inference.
Game Servers: Use EC2 instances to run multiplayer game servers with low latency and scalable performance.
Dev and Test Environments: Quickly provision development and testing environments for applications.
11. Security Features
IAM (Identity and Access Management): You can manage who can access EC2 instances and what actions they can perform on those instances by defining IAM roles and policies.
EC2 Instance Metadata: Stores data about the instance, such as instance type, AMI ID, and availability zone, which can be used by applications running on the instance.
Encryption: You can enable encryption for EBS volumes and S3 buckets to protect sensitive data. EC2 also integrates with AWS Key Management Service (KMS) for managing encryption keys.
12. Integration with Other AWS Services
EC2 integrates with many other AWS services to provide a complete cloud ecosystem:
AWS Lambda: For serverless computing, where code can run without provisioning or managing servers.
Amazon RDS: For managed relational database services.
Amazon S3: For object storage that can be used in conjunction with EC2 instances.
Amazon Elastic Beanstalk: For simplifying the deployment and scaling of web applications and services.
13. Advanced Features
Elastic GPU: Attach GPU resources to EC2 instances to accelerate graphics rendering or computation-heavy tasks.
Dedicated Hosts: Physical servers dedicated to your use, which can help you meet compliance or licensing requirements.
Bare Metal Instances: Run workloads directly on physical hardware without a hypervisor layer.
Spot Fleet: A collection of spot instances that can automatically scale and be managed as a fleet, offering cost savings with reduced risk of interruptions.