• Home
  • AWS
  • EC2 Tenancy Model and Cost considerations

EC2 Tenancy Model and Cost considerations

Tenancy indicates how the physical machine hosts the EC2 instances.  The default tenancy is a shared tenancy model.

Courtesy:find out that

This would mean that 0-n virtual machines ( EC2 instances) share the resources of a physical host. The true number of virtual machines on a physical host is not published.  From a cost perspective, this is the most cost-effective model ( when there are no licensing requirements based on socket or cores) as the resources are better used and the cost per vCPU/GB would be much smaller.

A note about Noisy Neighbours and VM escape Bugs:

In the shared tenancy model, since the EC2 instances on a particular host are not configurable, it is possible to share the host with EC2 instances which are very busy – a.k.a  ‘ Noisy Neighbours’.  This may result in non-uniform performance from an EC2 instance.  Unfortunately, there are no metrics to detect the noisy neighbor problem easily. A few anecdotal techniques that seem to ease the problem are

  1. Stopping and Starting instances – This operation may move the instance to a different physical host
  2. Use larger instances which may mean that the physical host doesn’t have enough capacity to host other instances. However, if there isn’t enough utilization of larger instances, then you will end up paying a higher cost.
  3. With the recent advances in Hardware and virtualization models, using EBS Optimized and Enhanced Networking (with SR-IOV) can help guarantee a certain amount of bandwidth from hard disk and network.
  4. Build elasticity into the application. While it won’t end a noisy neighbor problem, application will be insulated from the effects of a noisy neighbor

VM escape Bugs:

There were a few vulnerabilities found until 2016  especially in the PV virtualization model. There haven’t been much-publicized security vulnerabilities in the HVM and KVM virtualization models in the past year. If there are strict performance SLAs ( especially over an extended time horizon ) for your application and the simple remedial measures are not feasible or if there are licensing requirements that are per Core, then look at other tenancy models.

Dedicated Instances:

Dedicated instances offer some benefits over shared instances in terms of virtual machine neighbors.  Dedicated instances can have dedicated physical hosts. However, other shared EC2 instances from the same account can share the same physical host. There isn’t control on which shared EC2 instances can share the host. These type of instances are useful if there are compliance requirements about VM sharing with the third-party. Since the other instances on the physical host are also from the same account, the issue of (potential ) VM escape bugs from un-trusted third parties does not arise.  The noisy neighbor issue is not addressed using dedicated instances.

Look at the chart below which shows how many instances of a particular instance type can be hosted on a physical host.

Dedicated Host Attributes

Instance Type

Sockets

Physical Cores

medium

large

xlarge

2xlarge

4xlarge

8xlarge

9xlarge

10xlarge

12xlarge

16xlarge

18xlarge

24xlarge

32xlarge

c3

2

20

16

8

4

2

1

c4

2

20

16

8

4

2

1

c5

2

36

36

18

8

4

2

1

p2

2

36

16

2

1

g2

2

16

4

1

g3

2

36

4

2

1

m3

2

20

32

16

8

4

m5

2

48

48

24

12

6

2

1

m4

2

24

22

11

5

2

1

d2

2

24

8

4

2

1

r4

2

36

32

16

8

4

2

1

r3

2

20

16

8

4

2

1

h1

2

36

8

4

2

1

i2

2

20

8

4

2

1

1

i3

2

36

32

16

8

4

2

1

x1

4

72

2

1

x1e

4

72

32

16

8

4

2

1

Possible EC2 instances per physical host

Notice that there are fewer instances possible for larger instance types.  So potentially, if you move to higher instances types, the issues with untrusted VMs will go away as there is only instance possible to hosted on the physical host (  e.g. m4.10xlarge, r4.8xlarge).

Consider m4.10xlarge. The OnDemand pricing is

m4.10xlarge 40 124.5 160 EBS Only $2 per Hour

For the same instance type, the dedicate instance price is

m4.10xlarge 40 124.5 160 EBS Only $2 per Hour

+ $2 per hour/region  = US$730 more than On-Demand instance.

However, looking at the above chart, it is possible to launch only one m4.10xlarge  for a physical host. That also reflects in the per hourly pricing of shared tenancy OnDemand and Dedicated Instances.  So if you keep a shared instance instead of the dedicated instance, you will have about 100% cost saving without any side effects currently*.

However, consider the same for m4.large.  The OnDemand Price for m4.large is $0.1 per hour and the dedicated instance is $0.11 /hr

m4.large 2 6.5 8 EBS Only $0.11 per Hour $0.1 per Hour

For a dedicated instance

m4.large 2 6.5 8 EBS Only $0.1 per Hour

= US $818 pa more than m4.large on-demand instance.

But notice, you can launch up to 22 m4.large instances on a host.  Here there is much more to gain by choosing dedicated instances if there are licensing / compliance/performance requirements.

A Note about Compliance requirements:

For a large enterprise with stricter regulatory requirements, where the price of non-compliance can be much more expensive, dedicated instances offer a viable route to meet Cloud adoption with minimal disruption in hosting models compared to on-premise and still get the benefits of elasticity and pay as go pricing.

As of May 2017, it is no longer required to use dedicated hosts/instances for HIPAA compliance.

This could potentially mean non-trivial savings using shared tenancy model with Spot Instances instead of dedicated instance/hosts and still be HIPAA compliant for a variety of workloads. However, you need to protect the compliant resources via VPC and other mechanisms.

More details here

Dedicated Hosts:

Dedicated hosts can offer significant advantages for applications with licensing requirements tied to sockets or cores.  These are also quite useful if you want fine-grained control on which instances are placed on which physical hosts, keep affinity to a certain host etc.  This can give potential benefits in terms of consistent performance as the instances can be controlled and the shared resources pose less of a risk.

Dedicated hosts are the most expensive in terms of per hour charges compared to the other two types of tenancy.

*Pl. do note that instances per physical host are subject to change without prior notice. They are not guaranteed to be constant. Applications should not make any assumption on how many EC2 instances are hosted on a physical host.

Using a cost management solution like insisive cloud that enforces policy-based rules, you can check if you follow the best practices in using the right tenancy for your application.

Sign up for a risk-free 14 day trial at www.insisiv.com.