What Is AWS EC2?
What Is AWS EC2?
Amazon Elastic Compute Cloud (EC2) is a cornerstone service within the AWS platform.
Here's an introduction to its key aspects:
• EC2 is a web service that provides secure, resizable compute capacity in the cloud.
• It essentially offers virtual servers – called EC2 instances – that you can launch and
configure on-demand.
• These instances behave like physical servers, allowing you to install operating
systems, applications, and software just like you would on a traditional server.
• Instance Types: A vast selection of instance types optimized for different workloads,
from general-purpose to compute-intensive tasks.
• Amazon Machine Images (AMIs): Pre-configured templates with operating systems
and software, simplifying instance setup.
• Storage Options: Choose between ephemeral (instance store) or persistent (EBS)
storage for your instances.
• Networking: Configure security groups and network settings to control access to
your instances.
• Auto Scaling: Automatically scale your EC2 fleet based on predefined rules and
metrics.
EC2 Types
AWS EC2 offers a wide range of instance types, each optimized for different workloads and
resource needs. Here's a breakdown of the main categories:
• High CPU performance ideal for compute-intensive tasks like scientific computing,
video encoding, and batch processing.
• Examples: C5, C6, C7g
• High storage capacity and throughput for applications that require frequent disk
access, like data warehousing and log processing.
• Examples: H1, D3, D4dn
The best EC2 type depends on your specific needs. Here are some factors to consider:
• Workload Requirements: Identify the primary function of the instance (web server,
database, machine learning).
• CPU Cores: Determine the number of CPU cores needed for your workload.
• Memory: Calculate the amount of memory required for your application to run
smoothly.
• Storage: Assess the storage capacity and throughput needed for your data.
• Cost: Consider the pricing of different instance types and choose the most cost-
effective option that meets your needs.
EC2 – Pricing Model:
AWS EC2 offers several pricing models to cater to different needs and usage patterns. Here's
a breakdown of the key options:
1. On-Demand Instances:
• Pay per hour or per second (for Linux instances) for the compute capacity you use.
• No upfront commitments or long-term contracts required.
• Ideal for:
o Short-term, unpredictable workloads.
o Applications with spiky traffic patterns.
o Development and testing environments.
2. Reserved Instances:
• Purchase reserved instances for a one or three-year term and receive significant
discounts (up to 75%) compared to On-Demand pricing.
• Ensures capacity reservation in a specific Availability Zone, providing greater control
and predictability.
• Ideal for:
o Predictable workloads with consistent resource requirements.
o Applications that require guaranteed availability.
o Cost optimization for long-running workloads.
3. Spot Instances:
• Bid on unused EC2 capacity and potentially get instances at a much lower price than
On-Demand instances (up to 90% discount).
• Availability is not guaranteed, as instances can be interrupted by AWS when needed
for other purposes.
• Ideal for:
o Highly flexible workloads that can tolerate interruptions.
o Batch processing tasks that can be restarted.
o Cost-sensitive applications that can handle potential downtime.
4. Savings Plans:
Instance Launch
2. Launching an Instance:
• An AMI is a template that defines the operating system, software, and configurations
for your instance.
• Select an AMI based on your needs. For this demo, let's choose "Amazon Linux 2".
• Ensure the chosen AMI is free tier eligible.
• Instance types offer varying CPU, memory, storage, and network capabilities.
• For this demo, let's choose a T2 Micro instance, which is also free tier eligible.
• A security group defines the inbound and outbound network traffic rules for your
instance.
• For this demo, you can create a new security group with basic rules to allow SSH
access from your IP address.
• You can monitor the instance launch progress in the EC2 console.
• Once the instance is running, you'll see its public IP address.
• To connect to the instance, you'll need a key pair (generated during launch) or utilize
AWS EC2 Instance Connect (a browser-based connection tool).
Important Notes: