What the Cloud are Virtual Machines and Amazon EC2?
Tags: aws, ec2, tutorial, beginners
Published: 2020-09-06 22:57:22

---
title: What the Cloud are Virtual Machines and Amazon EC2?
published: true
description: What the Cloud is a virtual machine, and what does AWS EC2 have to do with it? 
tags: AWS, EC2, tutorial, beginners
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/edj4uv6qq1gq5ez383e7.png
---

¡Holaaa! 😁

Welcome to the transcript of [our latest **"What the Cloud?”** episode](https://youtu.be/A71Nmn74n28)! And lucky for you, this post has **WAY MORE DOODLES** than the video itself. 😁 

{% youtube A71Nmn74n28 %}

If you happened to watch [the previous episode](https://www.youtube.com/watch?v=3sG2ECvHl0U), we talked about Cloud storage and the [Amazon S3 service](https://aws.amazon.com/free/storage/s3/). You may even remember that I mentioned we were going to learn about [**Virtual Machines** in Episode 5](https://youtu.be/A71Nmn74n28). So let’s do that today! 

We’ve explained what servers are before, but at this point, you’re probably wondering.. *what the cloud* is a Virtual Machine? 

A Virtual Machine (VM) is an emulation of a computer system. In other words, creating a computer within a computer. It uses software instead of a physical computer to run programs and deploy apps. One or more virtual “guest” machines run on a physical “host” machine. 

Before VMs existed, what you had was physical hardware. Servers. Do you remember how in [Episode 1](https://www.youtube.com/watch?v=5MO_TSLyZU4) we explained that a server is a physical piece of hardware? So let’s pretend to time travel back in time about 15 or 20 years ago... and these servers, this physical hardware, they had maybe 1 xCPU. Maybe 1 Gig of ram. What you were able to do back then was install 1 application on it. Perhaps something like a web server to host a website. This is not a lot of space, is it?

Now servers get stored in racks, in **Data Centers**. Each rack holds more servers. And then these racks of servers are what is being stored inside those Data Centers (DCs). 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/eufaijdng39w6iw3pdun.png)

If we count the amount of servers I may have in my drawing, it really isn’t that many. Let’s count! 1, 2, 3, 4, 5... times 4 racks... that’s 20 servers. Which means, if we calculate each of these pretend servers to have only the aforementioned 1xCPU and 1 Gig of ram... it will mean 20 web servers. Or 20 applications. Again, it doesn’t sound like a lot to us today, but back then, that was enough. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7kx40sw4xk96ee4nxbyy.png)

So what started happening? What changed? As companies and business requirements changed, 20 servers... 20 web applications was no longer enough! So what do you do? Well now inside of your server, instead of storing 1 application, now you start storing 2 applications. 1 web server and 1 mail server. Now we have more than 1 application per server.  

But again, this is not that much. Now let’s fast-forward to only 10 years ago. Heeeyyyy, now these servers are getting better, fancier. They don’t come with only 1xCPU of storage, now they have 64xCPU and 128 Gigs of Ram!  

Now, earlier we said you had that 1 web server... If you try to put that 1 web server into your server, and you use that entire hardware server for only 1 OS (Operating System) for that application that only needed 1xCPU and 1 Gig of Ram... then you are effectively wasting space! Your current hardware server still has over 125xCPUs left of space! Think of the amount of waste that you are creating. Your servers are being wasted.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/b9nlfevhz72s90000elp.png)

Let’s go back to look at our 4 racks of servers in our DC. Now someone comes to you and says, *“Hey, we have a new requirement now. We need to run more than 20 apps now. From now on, we want to be able to run 100 apps minimum, but we don’t want to increase our numbers of servers. We still want to stick to 20 hardware servers because we only have enough physical space in our DCs for that amount.”* 

What would do you do? Well, you can try to convince them to buy more DC space, or you can start to think of how to fit 100 apps in only 20 servers. If we do this last option, then we have to figure out how to fit more than 1 app per server. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nvv1cleoirxzjnl6cpcj.png)

But now *software segregation* comes in and it could cause a problem.  

Wait, I bet you’re wondering *“what the cloud”* **segregation** means here. It is a separation, a splitting of a larger network into smaller network segments via something such as firewalls. One of the major advantages of such splitting is improved security.

Let’s get back to our drawing example though. If you have a web server and a mail server — 2 applications — on the same server, what prevents them from talking between each other? What happens if someone hacks our mail server and then reads all our emails? That would be pretty bad! 

So currently, we have 2 problems: **(1)** Too many apps for the amount of physical servers we have; and **(2)** We are wasting our servers, because we don’t need as much capacity as these modern day servers come with for just 1 individual app. 

#### 🙌🏽 Enter the Era of Virtualization!

Virtualization takes that physical server and splits it up. And then each one can have it’s own OS. Here’s one OS, and here’s another OS, and here’s another OS.. and now I can have all kinds of apps in a single hardware server. Look, here’s my web server, here’s my mail server, and here’s my game server.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/13g51lpdjttgjurnfjx2.png)

Ah, now this is segregation! And now you also get to have better utilization of each individual server, because now you have more than 1 app that runs per server. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jcm3xgz6a8t00mw550ok.png)

So this *Era of Virtualization* that introduced VMs was two-fold. _ONE_, it allowed us to finally add segregation between our applications, so that they can’t talk between each other. Again, this is good to help prevent hackers!

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ptk6gygg1v2zq6olmp90.png)

_TWO_, it allowed better utilization of the resources of our servers.  So even though we only have 20 servers, if we do the proper separation and have say... 3 VMs per server, we now have 60 VMs. And if we can have 60 VMs, then that means we can have 60 apps, because 1 app x OS. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/aa9npf47y9rvf88rv0vc.png)

Ok, but now we have a different kind of problem! Do you notice all the duplication that is happening here? OS, OS, OS...

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gjr4crxpzxlkilh9kvbp.png)

We have 3 different OS here and this is a waste of memory too! The problem began because we were trying to fit more than 1 app per physical server, so we created VMs and separated the OS. But now we accidentally ended up with a lot of duplicate OS. So we are *still* being wasteful! We definitely have better utilization now, but it’s not exactly great just yet. 

This is when **containers** joined this era. 

I know, I know... you’re wondering, *“what the cloud”* is a *container*? Well, we will actually go into a lot more detail in Episode 6 on this, but for today, all you need to know is that a container is a form of operating system virtualization. It packages up code and all its dependencies so that your application can run quickly and reliably from one computing environment to another.

Ok. Let’s get back to explaining what containers have to do with VMs. What containers finally allowed us to do was to only have 1 OS and then on top of that OS, you have all of your apps that run as containers. So containers now solved the next level of the utilization problem that VMs originally helped improve in the past. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/j8el7p5tmcra1pmkdi5b.png)

Now what I want to do is briefly head over to the AWS Management Console and go to the EC2 console. 

Amazon Elastic Compute Cloud (*EC2*) is the Amazon Web Service you use to create and run *virtual machines* in the cloud (we call these *virtual machines* 'instances'). 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6ss4tm7zf6pbvis2ik4c.png)

Let’s click the *Launch* button. All you need to do is follow these 7 steps to launch your 1st EC2 instance. 

**Step #1 is to Choose an Amazon Machine Image (AMI).** Think of this as our OS. Look at all our options, all our flavors. We can pick from Amazon, Ubuntu, Windows, Red Hat and more! These OS all have Pros and Cons. 

We are going to launch a Linux **virtual machine** on Amazon *EC2* that falls within the Free Usage Tier. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/4plhtiti5269u7h7k4te.png)

**For Step #2, we need to choose the size of our _Instance_.** Remember... Instances are virtual servers that can run applications.

We are keeping it simple, so 1xCPU and 1 Gib of Ram should be more than enough for what we want to do.  The size you decide to pick for your Instance Type will depend on your workloads. Let’s click Next.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8yw2h5bg5oevf9es93fr.png)

For today, **we won’t go into extreme detail on Step #3 Configure Instance Details.** We can configure items such as adding an IAM role.. determine shut down behavior.. enable CloudWatch detailed monitoring..  But again, for today let’s leave the default configs. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ll4paggcd0m45dnk8ves.png)

We move on to **Step 4: Add Storage**. Again, we have many options to pick from. Today we are keeping it simple so 8 GiB is more than enough. We could also add New Volume Types of storage. Do we want to Delete on termination? 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/pa5udgk4w47z324k4giu.png)

**Now we can move on to Step #5: Tags**. Ah yes, tags. Metadata. 

I can put in ‘Name’ and ‘Web Server 1.’ I can add another tag. A Cost-Center and the Cost-Center number. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/pivdbrp6tyi1topp1arx.png)

**Now it’s on to Step# 6: Configure Security Group**. A security group helps you add rules to allow specific traffic to reach your instance. 

I’m going to pick *HTTP* type and pick a beautiful name for my security group.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1bra3x298e066r1l8tdq.png)

**Finally, the last step! Step 7: Review Instance Launch**. We review our instance launch details and click the* Launch *button. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qn7ti61q41qoveyq358b.png)

A pop modal asks us to “Select an existing key pair or create a new one.” AWS is basically saying, *“Heyyy... I am not going to give you a username and password for this.”* 

This _key pair_ is comprised of a **public key** and a **private key file**. I ‘create a new key pair’ and pick a name for it. Now I click the button, *Download Key Pair*. What I have downloaded here is my private key, in a file format called _pem_ format. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nb610ph8wgpouyzmpik8.png)

This _key pair_ is what will allow us later to connect to this EC2 instance.  

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tu7tuz4onyl49j2ynyv5.png)

Ok. Time to finally Launch our instance! 

Success! 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ydbmw52ycti2wps0ce89.png)

If we go back to all of our Instances, we can find this one we just created!

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/sjn9vq26uv2upecgbmv2.png)

Wow, that was a lot to cover but I hope that *Servers* and their relationship to VMs make a lot more sense now!🎉

All right everybody, thank you for joining us in today’s episode of *What the Cloud?* !  In the next episode, we will talk about Containers.  I can’t wait to see you there! 

{% youtube A71Nmn74n28 %}


~Alejandra💁🏻‍♀️ y Canela🐾