DEV Community

Shahriyar Al Mustakim Mitul
Shahriyar Al Mustakim Mitul

Posted on

Amazon EC2 Basics

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.

Image description

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)
5== generation
2xlarge== size within the instance class

Image description

Image description

Image description

Image description
Check out instances: https://instances.vantage.sh/

Security Group

Image description

Classic Ports to know

Image description

EC2 Purchases

Image description

On demand

Image description

Reserved Instance

Image description

Spot Instance

Image description

dedicated host

Image description

dedicated instance

Image description

Shared Responsibility

Image description

EBS Storage Instance

  1. 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.

Image description

  • 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)

Image description

Know more about EBS multi attachment: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volumes-multi.html

EBS Snapshots
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.

Image description

AMI
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.

Image description
After creating an instance, we need to make it an image and we are good to go. It is an AMI now. Go to AMIs and select it and choose launch instance from the image.

Image description
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.

Image description

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

Image description

Local Ec2 instance storage has very high I/o rate

Image description
EFS== Elastic File System
Very costly but available in multiple region.

Image description

EFS vs EBS

Image description

EFS Infrequent Access( EFS-IA)

Image description

Shared Responsibility

Image description

Amazon FSx

Image description

Amazon FSx for Windows

Image description

Amazon FSx for Lustre

Image description

Summary

Image description

Top comments (0)