Amazon Web Services

What is an Amazon EC2 Instance

Reading Time: 4 minutes

Amazon Web Services (AWS) provides all of if it’s computing power (think servers) on something called an EC2 instance. EC2 stands for Elastic Compute Cloud (an E and 2-C’s = EC2). Now before I get a bunch of hate mail, let me point out that I said – “think servers” – not that it was its own dedicated server.

To understand an EC2 instance, a little deeper, let’s look under the hood. 
All EC2 instances are Virtual Private Servers (VPS), sometimes referred to as “Virtual Dedicated Servers” or “Virtual Machines.”  

EC2 instances run on an EC2 Host machine with a base set of hardware (the Host box), which runs multiple, isolated operating system instances — also described as a multi-tenant platform.  This is accomplished using something called a Hypervisor, which I’ll cover more detail a little later in this post.

The Hypervisor allocates each instance with its configuration of CPU(s), Memory, local storage, network capacity, etc. defined in their initial configuration or setup via the AWS admin console (or other options such as the AWS CLI or AWS SDK, etc), which you can select from predefined templates. 

Each instance can be a different operating system as long as the Hypervisor and Host hardware support it. Each instance can also be of different sizes (CPU & Memory Configuration) assuming the Host configuration supports it as well.

Think of an EC2 “Host” like an Apartment Complex

You can think of it like this:

Imagine a large apartment complex, where the “complex” is the “Host Server.” Each apartment in the complex is the “guest” or “tenant”, and each apartment may come with a different configuration (i.e. number of rooms). 

For example:

Let’s say an apartment complex has the following configurations available for you to choose from:

  • 2 bedrooms
  • 3 bedrooms
  • 4 bedrooms.

In this scenario, the bedrooms are your CPU and memory configurations. Sometimes they have a predefined capacity per block (the number of rooms per apartment). Other times they could be dynamic.

In other words, instead of sticking to the 3 basic layouts above, it could allocate a total of 9 bedrooms any way it sees fit:

  • nine singles
  • 2 four bedrooms and a single
  • 3 two bedrooms and 3 singles
  • etc. 

Having a host with multiple “guest” operating systems along with templated, yet dynamic allocation is the magic behind AWS’s ability to launch a new instance in just a few minutes.

Now AWS wasn’t the first to do this (the tech has been around since the 1960s and became more mainstream circa 2001), but AWS was the first to market on such a grand scale in 2006.

If that wasn’t enough, EC2’s on-demand billing was enough to blow the competition away!

AWS also brought on the idea of the on-demand allocation and pricing. This means that you could start an EC2 instance, use it, then shut it down and only pay for the hour(s) in which it was used… this was huge.

Then in 2017 the offered per-second billing (available after the first minute). If you launched an EC2 instance for 1 minute and 40 secs, you were only billed for 1 minute and 40 seconds. Talk about a game-changer!

Now that we have the basics let’s look at how all of this works?

AWS uses the Xen Hypervisor on bare-metal.

The physical underlying AWS EC2 host box runs a software package called Xen Hypervisor, which is an open-source hypervisor. A hypervisor is a piece of software that creates, runs, and manages virtual machines. Xen Hypervisor is said to run “on bare-metal”, which means that it doesn’t require a base operating system to work. Instead, it has everything it needs to run and allocate resources to the “guest” operating systems. This type of hypervisor is a type-1 hypervisor.

So you may be wondering if there is a type-2, and you would be correct in assuming that there was. The type-2 hypervisor requires a base operating system and does the lighter lifting. Thinks of products like VMWare for your desktop, which allows you to run additional operating systems at the same time. This type requires a base operating system to load it’s software first. BTW – VMWare also has a type-1 hypervisor too.

AWS uses type-1

So now that we know how this works let look at what this means. 

Consequently, if we have a “host” machine that allocates multiple “guests”, does that mean that anyone could be sharing the same host machine with your “guest” OS. And the answer would be yes. But have little fear, there is a lot of security and isolation that keeps one “guest” from walking in on another.

In addition to the security added at the hypervisor level, you have tools like Security Groups, which are firewalls at the OS level and NACLs, which are firewalls at the subnet (networking) level to help keep everyone out of your living room (I’m still using the apartment metaphor here).  

Yes, AWS does offer dedidcate hosts -> but at a premium

If you’re still not happy with sharing space or perhaps your business or your client doesn’t allow the use of multi-tenant architectures, AWS does offer a Dedicated Host. A Dedicated Host is an EC2 host but dedicated to you. This Depending on the size you choose, you can allocate “N” number of instances. However be forewarned, a Dedicated Host is pretty expensive. 

How expensive do you ask? The cheapest is $0.449 / hour for an a1 General Purpose up to $29.357 for a x1e Memory Optimized. 

Current pricing can be found here: 

The good news is no matter the quantity or size of the instances that you choose to launch on your Dedicated Host, you only pay for the Host itself (on a per hour charge) and only while it’s active. You aren’t billed for each individual instance. So, if your industry requires it, AWS had dedicate hosts available for you.

So now you know what an EC2 Instance is. 

Come back soon to take an even deeper dive into setting up and configuring an EC2.