ra2 studio - Fotolia


How the right EC2 instance types can save you time and money

Cost reduction and workload optimization are key components for IT in application development. Pick the right EC2 instance for your workload to maximize efficiency.

AWS continues to evolve its core compute service, Elastic Compute Cloud, to improve performance and meet growing...

workload demands.

AWS provides EC2 instance types optimized for various workload types, including general purpose, memory, compute, storage and accelerated computing. The F1 instance with field-programmable gate arrays (FPGAs) for hardware acceleration is the newest addition. Customers use FPGAs to develop, simulate, debug and compile hardware-accelerated code; AWS also offers instances for lighter workloads.

This wide range of EC2 capabilities helps IT teams suit VMs to their varying workloads, while reducing costs with different purchasing options. But it's imperative to make applications cloud-ready to take full advantage of AWS' cloud services. The following is a rundown of the most recent instance types and uses.

General-purpose instances consist of:

  • The T2 family, which provides burstable performance and is suitable for lightweight web servers, developer environments or small databases; and
  • M4 and M3 families of instances to balance compute and memory suitable for enterprise application servers and small to midsize databases.

Memory-optimized instances consist of:

  • R4 and R3 families, which feature larger memory composition compared to compute and are suitable for business intelligence workloads and data mining; and
  • The X1 family, which supports memory-intensive workloads, such as SAP HANA.

Compute-optimized instances consist of:

  • The C4 and C3 families, which offer more compute power at the expense of memory capacity and are suitable for ad serving, scientific modeling and cluster computing.

Storage-optimized instances consist of:

  • The D2 family with dense storage and high disk throughput, suitable for massively parallel processing, MapReduce jobs and Hadoop implementation; and
  • And the I3 and I2 families, which optimize storage, provide very high random I/O performance and are suitable for transactional processing systems and relational or NoSQL databases.

Accelerated computing instances consist of:

  • The F1 family, which relies on FPGAs to create hardware acceleration and are suitable for genomics research and financial analysis;
  • The P2 family -- general-purpose GPU compute applications -- which are suitable for machine learning and high-performance databases;
  • G3 and G2 families, which provide advanced GPUs that fit graphics-intensive workloads, such as 3D visualizations and rendering; and
  • The newest releases -- M4, R4, C4, I3 and G3 families -- which feature optimized performance and networking, improved throughput and reduced pricing compared to their previous generation counterparts. These families rely on Intel Xeon processors. AWS will decommission the older M3, R3, C3, I2 and G2 generations eventually.

In addition to offering different instance family types, AWS allows multiple-instance subscription methods. On-Demand Instances come with a pay-as-you-go model and require no commitment. Reserved Instances, however, have a commitment period of one to three years in exchange for significant discounts over the On-Demand model. Customers can also spin up Scheduled Instances, which are available for a specified recurring schedule. And Spot Instances provide another opportunity to save money on unused compute capacity at significant discounts.

IT teams that need extra levels of control have several options for dedicated capacity. EC2 Dedicated Hosts designate a physical host for a customer, providing complete control over server configuration. Customers can opt for on-demand billing or reserve Dedicated Hosts for periods of one to three years to ensure capacity and decrease costs. EC2 Dedicated Instances reside in an Amazon Virtual Private Cloud on isolated hardware, so while customers don't have control over the underlying host or the placement of instances, AWS physically isolates those on dedicated hardware.

Mix and match instances to your VM needs

It's important to use the proper services and concepts to build cost-effective cloud architecture. IT teams can mix EC2 instance types with different payment options for different AWS workloads.

For example, suppose that a custom social networking application requires a web tier with Nginx servers acting as reverse proxy, an application tier composed of a custom Java application and a database tier consisting of MongoDB and MySQL databases. Additionally, there is a worker tier for data manipulation written in Java.

The web tier requires at least four EC2 instances to function, but the load fluctuates throughout the day. An application tier requires five EC2 instances and can accommodate daily fluctuations, but it requires additional compute during the holiday season when more users connect to the application. The worker tier processes images and a large chunk of data on user habits to get statistics on customer application usage. An SQL database with per-core license terms requires a Dedicated Host based on the licensing contract. MongoDB consumes resources at a fairly predictable level, so you can purchase Reserved Instances for it. In order to architect the application, IT teams need a combination of EC2 instances with different payment types.

Because On-Demand Instances suit unpredictable workloads, use them to accommodate spikes in traffic, such as holiday activity or unwarranted fluctuations. Reserved Instances target predictable workloads. In this scenario, spin up Reserved Instances to meet minimum EC2 instance requirements to run the web and application tiers -- optimizing cost in the process. Reserved Instances could also host MongoDB. Use Scheduled Instances to accommodate daily fluctuations, and use Spot Instances to process analytical data and save money. And, as mentioned, Dedicated Hosts keep the application in line with the database license.

Matching AWS products to enterprise needs

Spin up an instance, process data in real time and manage the security of the cloud with these Amazon services. But which service performs which function? Take this quiz to test your knowledge about the latest AWS products.

EC2 hacks to reduce costs

Optimizing an application for performance is one way to ensure your cloud workloads run as expected. But enterprises must also optimize it for cost to ensure there are no surprises to the bottom line. IT teams must prevent cloud sprawl and run a cost-efficient cloud to keep executives happy. Using these EC2 tricks can keep costs low:

  • Use On-Demand Instances for an AWS migration. Once a benchmark is set for use, opt for Reserved Instances.
  • Always use a combination of On-Demand and Reserved Instances to accommodate typical traffic demands, as well as fluctuations.
  • Use On-Demand Instances with Scheduled Instances for development environments. Nonproduction workloads don't run all the time. Schedule EC2 instances -- using a custom script or tool -- to start and stop at a certain time of the day. For example, start the servers at 9 a.m., and stop the instances at 7 p.m. local time.
  • Use Spot Instances to process large amounts of data, such as batch processing of call records.
  • Monitor system parameters for the On-Demand Instances, and determine the appropriate EC2 instance types. If the maximum utilization of an m4.xlarge instance -- four virtual CPU and 16 GB memory -- is 30% CPU utilization and 24% memory utilization, scale down the instance type to an m4.large -- two vCPU, 8 GB memory.
  • Decouple an application, and optimize it for cloud features, such as Auto Scaling. The Auto Scaling feature helps maintain an exact number of instances to handle traffic to the application by scaling EC2 instances up and down.
  • Use AWS Lambda for scheduling scripts and handling Cron jobs within a microservices architecture, which reduces the total number of EC2 instances.

Next Steps

Learn how to manage AWS workloads on premises

Will bigger EC2 instance types meet enterprise demands?

Make the right EC2 instance type choice

Dig Deeper on Amazon EC2 (Elastic Compute Cloud) management