EC2= Elastic compute cloud (Infrastructure as a service)
It consists of :
Renting virtual machines (EC2)
Storing data on virtual drives (EBS)
Distributing load across machines (ELB)
Scaling the services using an auto-scaling group (ASG)
EC2 sizing & configuration options:
Operating system (OS): Windows, Mac, Linux
Compute power & cores (CPU)
Radnom-access memory (RAM)
Storage space: Network attached (EBS & EFS), hardware ( EC2 Instance store)
Network card: speed of card, public IP Address
Firewall rules: security group
Bootstrap script( This means launching commands when a machine starts): EC2 user data
examples: t2.micro (Part of AWS free tier), t2.xlarge, c5d.4xlarge, etc.
EC2 Instance Types
Checkout this website for instance types: https://aws.amazon.com/ec2/instance-types/
For example, m5.2xlarge has:
m== instance class (General purpose)
2xlarge== size within the instance class
Check out instances: https://instances.vantage.sh/
Classic Ports to know
EBS Storage Instance
- EBS (Elastic Block Store):
It is a network drive which can be attached to an instance. It can be detached from one EC2 instance and attach to another one quickly.
It allows your instances to persist data even after termination.
Bound to a specific availability zone
In Free tier: 30 GB of free EBS storage of type General Purpose (SSD)
It is locked to an availability zone. For example, an EBS volume in us-east-I a cannot be attached to us-east-Ib. To move a volume across, one needs to snapshot it.
- You can control EBS behavior when an instance terminates. By default, the root EBS volume is deleted (attribute enabled) and other attached EBS volume is not deleted (attribute disabled)
Know more about EBS multi attachment: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volumes-multi.html
You can back up your EBS Volume at any point in time by EBS Snapshot. You don't need to detach the volume to snapshot it. But it would be better if you do it. You can copy the snapshot in Availability zones.
Amazon Machine Image is basically a pre-package that runs behind the scene. We can create an AMI from the instance and copy it to create an instance later on.
Note: To create an instance , we need an AMI. Basically when we are beginner we use free AMI from market place but later we can create an instance and customize it and make it an AMI. After that we can create an instance using our customized AMI. There are lots of organizations who have there AMIs in marketplace so that we use them and they can earn money.
EC2 Image Builder
It is used to automate the creation of virtual machine and container images. (To automate the creation, maintain, validate and test EC2). It can be run on a schedule basis and it is a free service and you need to pay for the underlying resources only.
EC2 Instance store
It is a high-performance hardware disk.
Better I/O performance.
EC2 Instance store lose their storage if they are stopped. Not good for long-term use.
Good use case: Buffer/scratch/temporary content
For long term usage, EBS storage is a good one
Risk of data loss if hardware fails
Local Ec2 instance storage has very high I/o rate
EFS vs EBS
EFS Infrequent Access( EFS-IA)
Amazon FSx for Windows
Amazon FSx for Lustre