AWS EC2 is one of the most used service of the AWS ecosystem. It also a backbone of many other services.
Let us understand what is EC2. In simple words EC2 is a computer that you get to use over the internet which you don't need to turn on and off AWS manage that for you just request them when you want your computer.
In technical terms a server that you launch in AWS. It is used to compute, run virtual machines, save data, run cron jobs, etc. We mainly do the following on EC2
Running virtual machines(A virtual machine, commonly shortened to just VM, is no different than any other physical computer like a laptop, smart phone, or server. It has a CPU, memory, disks to store your files, and can connect to the internet if needed. While the parts that make up your computer (called hardware) are physical and tangible, VMs are often thought of as virtual computers or software-defined computers within physical servers, existing only as code.
Storing data or running computation
Running cron jobs
Running Machine learning models
The main advantages of EC2 are it's on demand computation, memory, RAM and network increase. Let us think of it in this way when you buy a computer it has some specification what if you want to change these specifications you have to buy a new RAM, an external hard disk or a new processor but when you are running a website the seasonal changes, unknown traffic, running a machine learning model with unknown amount of data(Live data, bug data) it makes it very hard to predict these things. EC2 provides a solution to this problem here you can change the specification on demand it just takes a few minutes.
You can distribute load across multiple machines which provides resistance to machine failure. You can also deploy your application across multiple regions or continents which makes your services immune even to disasters across continents.
We got a virtual machine but we need a operating system to run something on it. There are three kind of OS available on AWS Linux(various distribution), windows, MacOS you can use them as needed
You can configure your EC2 instances in whatever way you want in terms of RAM, memory, compute power, Network speed but there are additional configuration available on EC2
Bootstrap scripts: After we have installed a OS if we need to run some startup scripts for example on starting our Linux or windows machine some programmes start running in the background(Cortana, Task Manager). We can run them via our bootstrap scripts(scripts that run when we start our EC2 instance). This are really useful for cases when our EC2 instance fails because our resources allocated to our instance are not enough or there is a power outage. Whenever we start our instance our bootstrap script runs and install software or setup the things we need for starting our server like setting up a ngnix config on start or starting an Apace server.
Firewall rules: We have to setup who has access to our EC2 instance this is where firewall rules comes. AWS already has some built in functionality to set up some kind of firewalls like security groups. You can also setup your own firewalls for additional security or compliance to laws in various regions.
EC2 is a great solution to a problem that we all faced and still face in our personsonal computers of buying physical memory, processor, RAM for our computers. In this series we will learn more about it have a few hands on exercises which will all be in AWS free tier if you follow along. Next we will do a small exercise on how to setup your AWS EC2 instaces.