AWS EC2 pricing is influenced by a large number of factors. Some of these may be well-known, e.g. your choice of region. Others may come as more of a surprise or just not be properly understood.
The factors that influence AWS EC2 pricing
The key factors that influence AWS EC2 pricing are as follows:
- Purchasing options
- Usage duration
- Instance size
- AWS Instance type and generation
- Processor, processor optimization and use of bursts
- Use of elastic graphics and elastic inference
- Software stack
- Tenancy type
The choice of region is a huge factor in Amazon’s pricing structure. It may not be the only factor in your choice of region. In fact, these days, your choice of region may be dictated by the law rather than by your budget preferences. If possible, however, it should certainly be factored into your decision-making process.
Basically, you want to do everything you can to use reserved instances and spot instances rather than on-demand pricing. Be aware that on-demand capacity reservations have nothing to do with reserved instances. They are just a way to ensure that specific functions have guaranteed access to resources as, when and if they need it. These are charged at on-demand prices and, as such, are best avoided.
In itself, this is self-explanatory. What may not be so obvious, however, is that the granularity with which usage duration is calculated can vary widely. For example, if you use a Linux EC2 instance, it is per second, whereas with Windows EC2 instances, it is per hour. This means that if you use a Linux instance for one hour and one second, you are billed for one hour and one second. If you use a Windows instance for one hour and one second, you are billed for two hours.
This really is pretty self-explanatory. The larger the instance, the more resources you get (e.g. vCPU, memory and storage) and the more you pay. If you actually look at a table showing AWS pricing, the correlation is fairly obvious.
Instance type and generation
The fact that different instance types have different prices is probably both obvious and logical. What may be less obvious is the fact that it can be very useful to compare more expensive instance types with enhanced versions of more affordable instance types. For example, comparing graphics-optimized instances with general-purpose instances boosted with elastic graphics.
Pricing for different generations of the same instance type may be the exact opposite of what you expect. In many industries, companies cut the prices of the older generations of a product or service to encourage people to use it up so it maximizes its return on investment before it moves on.
AWS EC2, however, does the exact opposite. It wants to encourage people to move onto the newer, more efficient generations of instances, so it makes the older ones more expensive.
Processor, processor optimization and use of bursts
While it may seem tedious, it really can pay to make an effort to analyze the value for money offered by the different processors available both across instances and within instance types. As before, you also want to compare more expensive processors with more affordable processors and the use of processor optimization and/or bursts.
Use of elastic graphics and elastic inference
Elastic graphics is a way to boost the graphics performance of non-graphics-optimized instances and elastic inference can be used to boost the floating-point-calculation performance of non-compute-optimized instances. As previously mentioned, it’s very much recommended to compare the value offered by using optimized instance types with the value offered by using more affordable instance types.
Software stack basically means operating system and database (if relevant). Basically, Linux-based operating systems are priced more affordably than Windows. That’s in addition to the fact using a Linux-based operating system means that your usage is calculated per second rather than per hour.
At present, the only database available in AWS EC2 is Microsoft SQL (Web, Standard or Enterprise) but you can put this on top of a Linux distro and pay less than you would if you had put it on top of Windows.
AWS has an interesting system in which it essentially works as a public cloud and a private cloud. Not only that, but you can choose between a private cloud with virtualization software to divide the physical server between different EC2 dedicated instances and a private cloud without virtualization software, just “pure” cloud infrastructure.
As you would expect, the shared resources of the public cloud infrastructure are priced more affordably than either the EC2 dedicated host infrastructure (virtualized) or the EC2 “bare metal” infrastructure (non-virtualized).
For practical purposes, however, this is probably going to be irrelevant since most people will only use either of these options because they have to either for legal reasons or for practical ones.