EC2: Billing & Tenancy Model

Pay for what is used.

We are billed for pre-selected configuration.

1. On-demand

The time when the instance was up and running, only that period is charged. Here is a little tricky thing. When we say Time it is categorized in two aspects.

1. Per hour:

For example, an instance is started at 9:30 am and is stopped at 10:30 am. It will be charged for two hours. Because 9:30 am to 10:29 am is exactly one hour. From the very point at 10:30 am the second hour is started. No doubt complete 1 hour is not used but AWS considers it as one hour.

Suppose if the instance was started at 10 am and was stopped at 10:30 am, It is still considering 1 complete hour. So in 1 hour, irrespective of minutes an instance was running, AWS charges it as one complete hour.

2. Per seconds

Minimum 60 seconds is charged in the beginning.

EX: Instance ran from 9:10:10 am to 9:10:45 am. Here 35 seconds is been used, but it will charge 1 complete minute in the beginning.

Suppose 9:10:10 am to 9:11:45 am an Instance ran.

It charges for 1 min 35 seconds only.

The first minute is always charged completely.

Per second is applicable for only Linux system.

2. Reserved Instance

Pre-paid, to use it for a certain period. Maybe a year/ 6 months

3. Spot Instance

Based on bidding. Just like an auction except for that you have to keep looking if anybody is bidding higher than you even after you have won the EC2 instance in the first bid.

It's ideally useful for batch processing/additional capacity..basically additional worker system.

Instance Tenancy Model

Shared host system

Physical hardware is shared with others to run multiple instances

meaning: Host is shared on which multiple instances can be run.

It is abstracted at the hardware level. It keeps the cost down.

But there are certain concerned issues:

  1. If someone breaks into host machines they have access to all the EC2 machines on the host system.
  2. If an EC2 has a breakage for some reason it has access to all the EC2 machines on the host. i.e it breaks into the hypervisor layer and effects all. Not recommended if an application needs a high level of security.
  3. An instance is not bound to a physical host. What it means:let's say EC2 was started in shared host machine..some work was done and EC2 was stopped/terminated. when again it was startedthere is no guarantee it will be on the same physical hardware "then what happens to the data"?Well, these things which you do arent stored on physical hardwar...it is stored separately somewhere on EBS.

Dedicated host system

Only you can start the EC2 on host machine none other

managed by AWS.Even when there are no EC2 it is still dedicated to you. None can start EC2 on it.

Why we need this?

  1. Licenses applied to CPU for windows can be used.Here CPU core doesn't change whenever EC2 is spawned up whereas in shared host it keeps changing thus license applied isn't fixed on it violating the compliance if anyone needs to be followed as per the standards.
  2. Security aspect based on application-level
  3. Costlier than shared system regardless of EC2 is running or not we will get billed for the host itself

Dedicated instance

The balance between the above two

Ex: Running 2 EC2 on a dedicated host machine. As long as my EC2 instances are running on this dedicated host machine, the host is mine.

To be more precise:

Let's say I go ahead and shut down one EC2 instance and I have still 2nd instance running. Now some days later I start all new three EC2 instances, this will also run on the same dedicated host machine. When my work is done I will shut down all the ec2 (3+1) then later I come back and start the instances, these instances will run on new dedicated host machines no longer the previous one!

as long as my ec2 instances are up and running the dedicated host is mine

Why we need this?

  1. Visibility in CPU for licensing.
  2. We will get billed on what is used of the host(host+ec2) once the ec2 is dropped host will too. Need not to pay compliance.