What is an EC2

EC2 is nothing but a virtual server. In layman terms its a machine provided by AWS, the difference is we don't get to hold it like our PC but it does have its own physical existence which is taken care by AWS, all we have to do is set that machine based on our requirements and ssh into it to do the rest.
There are several virtual servers across different regions based on demand. When we say/here it is on the cloud doesn't mean literally 😛 That's bottoms-up thinking ;D There are HUGE data centers set up in isolated areas in various regions and further divided to nearby zones. So that users across the globe can have easy access to it based on geographic location without worrying about the distance, latency, packet loss yada yada....

This is possible because of Virtualization. Fortunately, Virtualization can be done on the hardware level and also on OS level. But what is virtualization and why we need it?
Let's say I want to run Apache 2.0 which is an older version for my application - A, which is running on default port 8080. Due to some reason now I want Apache 2.4 for my other application - B, but even this application will run on Apache's default port - 8080. Ahaa! there is conflict. You see both applications are running on the same underlying physical hardware of the host system, using dependencies and its networking things. There is no isolation. Obviously, there will be conflicts. I cannot run my application on the same port, it just cants. No doubt I can change ports..clever but how long I need to maintain it? Also, underlying physical hardware that is used, I have to make sure my application doesn't get confused and end up using/sharing each other's information, which is bad. I have to be aware of which application is running on which port and what versions of software I am using so that I don't mess up. This is one of a kind problem. Take time and will dive deep later.

So AWS provides many independent virtual servers by virtualization on underlying physical hardware and host server OS by using its own Hypervisor - Nitro. Hypervisor takes underlying physical hardware and OS divides it into small independent chunks of server making it possible for us to install our own OS and run our desired requirements without creating any chaos...

Features of EC2

When clicked on Launch EC2 bunch of options and respective windows are seen, they are nothing but list options displayed to choose before setting it up. Think of EC2 as a Laptop now we need to define its specifications and the following are the options.

1. Resizable compute capacity (nano, micro, small, medium, macro):
These are different RAM size
2. AMI:
Base image/Executable image to boot the system up from:... disk for the system.
Think of it is a new system which has nothing installed in it.
Now to run our application/ our trying to set our environment successfully we need to make our system function for it, which means certain software are needed to be installed and configured. I can't just start running my python from nowhere.

Also, This is just one part of it. Suppose 20 such systems have to be pre-installed or configure, it is going to be hectic. Going to console each time, choosing options and etc...is going to consumes lots of time and patience, instead I copy the current setup make it an executable image, and by using this image I will spawn 20 such instances and that image is called Amazon Machine Image (AMI).

In short, one can say, AWS provides such predefined images one could use it or one can create their own and use it as AMI while launching an instance.

AMI comes in - packaged/custom/community images**
packaged: provided by AWS
custom: created by us
community: community people working together and provide it as open-source, but be alert. You never know what is been installed, we dont know who has written it..could be nasty hackers too.
Snapshot: Copy of the data on hard-drive

3.x86 and ARM Architecture: snap dragon|intel|
Doing a particular task in a particular way. Use this to speed up
ARM architecture: tighter|certain way it gets work done
x86: Lots of instruction set| generic model for everything.
AWS has its own processor known as Graviton |CPU based on ARM architecture

4. 180+ different types of instances:
Differentiation is done on characteristics such as - providing a lot of memory & no CPU, more graphics & no RAM, bare metal model...etc. because not all requirements are the same for everybody working their sweat off!
Consider, two applications are running it is using a negligible amount of memory whereas it needs extremely high processing, to process the data.
Running such an application on the server which is not utilized completely to its potential ain't benefiting and paying for the unused parts of server is a loss too.
Thus AWS can provide different types of instances:
a. General purpose : A1 || M5, M4.
balance of CPU and Memory
b. Storage(High I/O): I3, I3en
High-speed storage
c. Burstable: T3, T3a, T2
d. Dense Storage: D2 || H1
High storage
e. Compute Intensive: C5, C5n, C4
More CPU for better price. 32cpu-32gb
f. GPUCompute: P3, P2
g. Memory Intensive: R5, R5a, R4 || X1, X1e || Z1d
More ram 8/164gb
h. Graphics Intensive: G3
i. FPGA: F1
further to add...may be for the same/better price will get better instances regarding our needs.

5. Scale instances with auto-scaling

6. EC2 Naming Conventions
EX: M5d
M: Instance family
5: Generation of instance family ( greater the number newer generation)
d: some instances come with special abilities. d is one such thing. It stands for Disk. Which means it comes with additional disk along with CPU and memory. Similarly if there n- network bandwidth, a- AMD processors
large: size of an instance...generally speaking, it tells this instance comes with how many CPUs and memory

**7. VPC: Will come to it our later post. But by default, it sets up in Default-VPC which is already present one in each Availability zone

Recommend: Understand Billing and Tenancy model of EC2

Happy learning :)