Introduction
Virutal machine in the cloud
Resizable compute capacity in cloud
Reduced time required to obtain and boot new server instances to minutes
Pricing
Pay as go, pay for what you use, pay less as you use more and pay even less when you reserve capacity.
On Demand
- Pay fixed rate by the hour
- Short term, spiky and unpredicatable workloads8
Reserved
- Steady use and predictable usage
- Provides capacity reservation, and significant discount on hourly charge. Contract terms are 1 year to 3 year terms
- Standard Reserved instances
- Convertible Reserved instances provides ability to convert between different instances
- Scheduled Reserved instance provides reserving for certain times
Spot
- Flexible stat and end times
- Bid whatever price you want for instance capacity.
- Fesible at very low compute instances
Dedicated Hosts
- Used in Server-bound licenses
- Regulatory requirements
- Can be purchased On-demand
- Can be purchased as reservation
EC2 Instance Types
The numbers are Generation of the family
Mnemonic → FIGHT-DR-MCPXZ-AU
Security Group
Inbound & outbound rules are stateful. Inbound rules get copied over to outbound rule
Security group takes effect immediately
Can’t block individual IP with security group
All ports are blocked by default
Network Access control list is stateless whereas security groups are stateful
Can’t block individual port with security group
Multiple security group can be attached to a EC2 instance
Multiple EC2 instances in a security group.
EBS Volumes
Elastic Block storage volumes replicated within availability zone to protect from component failure
5 different EBS Storage
General Purpose (SSD) → gp2
Provisioned IOPS SSD → io1
Throughput Optimized HDD → st1
Cold HDD → sc1
EBS Magnetic → Standard
EBS Volumes will be same Availability zone as EC2
EBS root Volume Killed when EC2 instance get killed because of delete on termination is enabled by default.
EBS Volumes can be modified on the Fly even when EC2 is running
EBS volumes can be moved to another availability zone by taking snapshot
that will create a image and it is used to create a volume in another availability zone
Para Virtual Virtualization vs Hardware virtualization.
Snapshot AMI can be copied to a different Region.
Addditonal Volumes that are not deleted when EC2 instance is killed.
Snapshot exist on S3
Snapshots are incremental
Its best practice to stop Ec2 instance before taking snapshot but its not required.
AMI Types
Instance Store (EPHEMERAL STORAGE)
→ cannot be stopped. Can only be terminated or rebooted
→ When stopped , the underlying host fails, you will lose data
→ No option to keep root device upon termination
EBS Backed
→ Can be stopped
→ Can tell EBS to keep the root device volume
ENI vs ENA vs EFA
ENI → Elastic Network Interface
Simple virtual network card
Basic networking
EN → Enhanced Networking
Single root I/O virtualization
Speed between 10 GBPs and 100 GBPS
EFA → Elastic Fabric Adapter
Accelrate High performance Computinng(HPC)
Can use OS-bypass , enable HPC
Encrypted Root Device Volumes
Create a AMI Create a copy of the snapshot
Create a image from the snapshot that is encrypted
Launch a new ec2 instance with the encrypted image.
Spot Instances &Spot Fleets
Take adavantage of unused EC2 capacity in the AWS cloud. Its good for stateless applications.
Hourly spot prices
Spot block can be setup form stop instance being terminated in 2minutes
Good for Big data and analytics, containerized workloads, CI/CD and testing,[
web services, Image and media. High-performance computing
Not good for Persistent workloads Critical jobs and databases
Spot Fleets are collection of Spot instances, optionally on-demand instances
EC2 Hibbernate
Hibernation save the contents from the instance memory to EBS volume
Stoppinng an EC2 instance ram is cleared.
Instance boots much faster,
Useful for long running process
Root device volume have to be encrypted to enable hibernation.
EC2 Placement group
Cluster Placement group
Low Network Latency/ High Network Throughput
Can’t span multiple zones
Spread Placement group
Individual Critical EC2 Instances
Can span multiple zones
Partition Placement group
Multuple EC2 instances HDFS
Homogenous instance with cluster placement group highly recommended