What is AWS Elastic Compute Cloud (EC2)
AWS Elastic Compute Cloud (EC2) is used to create an instance of a virtual machine; it is a web service that provides secure and resizable compute capacity in the cloud. We can also choose the virtual machine (VU) type which server will be best for the website and future, and I can also choose storage hardware, tags, Protocols, Security group for inbound outbound traffic, etc.
AWS EC2 service provides the fastest processors and all other specifications. We have powerful GPU instances for machine learning (AI) training and future work. We can create new instances through AWS EC2 Autoscaling if required for more instances in the future. Autoscaling automatically creates new instances if your website traffic increases to your selected limits and terminates extra instances through your given minimum limit.
We can only create 20 instances in EC2 under one region; this is by the default AWS setting. If we require 20+ instances, then we will request AWS Support to increase this limit.
AWS EC2 Instances types:
Seven types of EC2 instances are:
- General Purpose (Balanced memory and CPU)
- Compute Optimized (more CPU than Ram)
- Memory Optimized (more Ram)
- Storage Optimized(Low Latency mean SSD)
- Accelerated Optimized (Graphic Optimized)
- High Memory (High Ram, Nitro system)
- Previous Generation
General-purpose
Instances provide balance to how to compute memory. 3-series are available in the general purpose
- A1 series (Medium-Large)
- M-series (M4, M5, M5a, M5ad, M5d)(Large)
- T-series (t1, t2, t3)
In the EC2, 4-instances sizes are available, nano, small, medium, and large.
A1-series is used for an AI type.
The M-4 series is the most reliable and best. Still, we can use only EBC storage in this series because this series memory is available only (8 to 160GB), and in the remaining, all series provide a high memory (8 to 384GB). And also, this provides another storage type NVMe (Nitro virtualized) SSD type.
T-series are used only for demo and testing purposes because of much less memory and storage.
Compute Optimized Instance
In this type, if we require many outputs simultaneously, we will use compute-optimized instances.
3-types of compute-optimized instances are available in the EC2.
- C4
- C5
- C5n
C4 and C5 provide high performance. C4 is a cost-effective server in comparison with C5. Therefore, C5 uses more vCPU than C4.
C5n runs on a nitro system (for game development, web server, and any other high-performance system).
Memory-optimized Instance
We use this instance when we work on high-level work, applications, and databases.
3-types of memory-optimized instances are available.
- R-series (R4, R5, R5ad, AND r5d)
- X-series (X1 and X1e)
- Z-series (Z1d)
R-series provide 16 to 768GB memory and EBS storage.
X-series provide 122 to 3904GB memory and SSD storage.
Z-series provide 16 to 384GB memory and also provide SSD storage.
Storage Optimized Instances
3-types are available in this instance.
- I-series
- D-series
- H-series
If any instance will start with I, D, or H, then it means this is the optimized Storage instance. Another name of storage is sequential read and write access.
I 3 & I 3en Instances VCPU: 2 to 96, RAM: 16 to 768GB, and Storage is NVMe SSD.
D2 instance vCPU: 4 to 36, RAM: 30.5 to 244GB and Storage is SSD
H1 Instance vCPU: 8 to 64, RAM: 32 to 256GB, and Storage is HHD
Accelerated Computing Instances
It is also called GPU because it is used for graphic processing like card gaming, 3D gaming. This example is also used in the languages AI (Artificial Intelligence), ML (Machine Learning), and DL (Deep Learning). Also, have three series in this;
- F1Instance
- P2 & P3 Instances
- G2 & G3 Instances
F1Instance In this Instance, FPGA is used & this is used in digital cameras.
vCPU: 8 to 64;
FPGA: 1 to 8; (One FPGA is enough for everything because this is very high)
RAM: 122 to 976; Storage: NVMe SSD
We use this instance in Genomics Resources (like AI, Machine learning), Video resources (like YouTube and Facebook).
P2 & P3 Instances In this series used the NVIDIA Tesla GPU card. Up to 32GB of memory is available in one GPU.
P2 Instances
VCPU: 4 to 64 GPU: 1 to 16 RAM: 61 to 732GB Network bandwidth: 25Gbps Storage: NVMe SSD |
P3 Instances VCPU: 8 to 96 GPU: 1 to 8 RAM: 61 to 768GB Nitro bandwidth: 10GB ps Storage: SSD & EBS |
G2 & G3 Instances In this series, the NVIDIA Tesla M60 card is used.
vCPU: 4 to 64
RAM: 30.5 to 488GB
GPU: 1 to 4 GPU
Network performance: 25Gbps
High Memory Instance
It is used for dedicated hosts. We can purchase this for a minimum of at least 3year, not one year. You can install it directly on the hardware. We can’t virtualize in this instance. Only one instance runs in the hardware.
Purchasing Options
We have 6-options to purchase these instances.
- On-demand
- Dedicated Instance
- Dedicated Host
- Spot Instances
- Schedule Instance
- Reserved Instances
On-demand for testing purposes like t-series, and we can also set scalability.
Dedicated instance, if we purchase this for one year, then the price will be low. In this Instance, VPC also will never change.
Dedicated Host in this instance purchase license for the Host and then also many instances will be created in this instance but depend on the Dedicated-host
Spot Instances nobody doesn’t use these instances in real-time. Suppose the price of this instance bid goes up after buying this instance. Then AWS gives a notification to the user to save your data anywhere; only two minutes after this time, this virtual machine will terminate and will remove this virtual machine from your account. That’s why many chances are available to lose your data. So, this instance is best for testing or demo at a low price.
Schedule Instance in this Instance, if our office is working the only 8hrs in one day and two days off in the week. Then you purchase these types of instances for one month or one year. And any other specific work.
Reserved Instances are the best from the on-demand instance because if one instance is required for our office, you can use this instance. And this instance price is also less than the on-demand instance, almost 70%, but in this instance, we have to pay one year’s price advance before buying it.
How to Access EC2 Instances
In this service, we have required key and key pair names. Without the key, we can’t install this instance. This key is a private, not a public key. Because the key is crucial for getting the password and running the Instance through SSH & PUTTY, we can create only 20 instances in one region.
How to Check EC2 Status
At this point, we can check our instance status like AWS running instance, pending, initializing, 2/2 checks, stopped, start and terminated, etc. We can’t change this status because this is a back-end process. If we stop our instance, then the instance bill will not generate.
How to Check EC2 Metadata
Instances information is called metadata, such as Instances Public IP, Private IP, Instance versions, Instance type, local hostname, security group, inbound outbound protocols, etc. If you want to see the metadata of your instance through the SSH & PUTTY, then write this command.
get http://PUBLIC IP/latest/Metadata
Bare Metal Instances
Bare metal instances are not virtualized. It connects to the hardware. These instances are bare metal instances i3, i5, r5-metal, etc.
AWS EC2 Instance Storage
It is faster than EBS. 2nd if we see Instance storage Backed as written, EC2 Instance means our root volume available in instance storage. Only is used for a short time, not for a long time. Also is used in hardware.
Elastic Block Storage
Root volume (Operating system/OS) can store in 2 ways. If we see EBS backers have written, EC2 Instance means our root volume (mean OS) is available in EBS. We can easily replicate/copy/snapshot this volume and transfer it from one region to another and also create a new instance through this snapshot.
Also Read: How to Encrypt and Decrypt data using AWS KMS & CloudHSM