marrakeshh - Fotolia
The cost of moving applications from on-premises infrastructure to cloud services such as AWS can be compared to...
going from a fixed-price, all-you-can-eat buffet to an à la carte cafeteria. Gone is the incentive to consume as much as possible to maximize return on investment. Instead, companies use exactly what they need -- and no more than that.
Pay as you go is a defining feature of the AWS public cloud, but it's just one of the basic principles in the Amazon pricing philosophy. Three other principles include:
- Pay less per unit by using more,
- Pay less when you reserve,
- Pay less when AWS itself grows.
Although users have no direct control over the last tenet, effectively exploiting the first three elements is key to getting the most value from AWS. In this tip, we look at AWS cost management for enterprises, according to these principles.
Start with the basics
The obvious method to spend less with AWS is to use less. Unfortunately, that advice is about as useful as saying the way to investment riches is to buy low and sell high. The devil is in the details.
Indeed, the tendency is to over consume because the abstract, ephemeral nature of AWS -- with resources that can be instantly and programmatically instantiated -- gives rise to resource sprawl. With AWS, there's a tendency for machine instances and storage buckets to proliferate and persist long after they are needed. However, unlike internal systems -- where zombie VMs waste system resources -- the meter with AWS is always running. So those unused or dormant instances rack up the bill.
The key to reducing AWS usage is to diligently monitor and audit use by looking for orphaned, underutilized or overspecced resources. Although monitoring and inventory of virtual infrastructure is a niche targeted by a number of third-party products, AWS customers should start with Trusted Advisor, a native AWS cost management tool that automatically checks the user's AWS portfolio and provides advice in four areas -- cost optimization, security, fault tolerance and performance.
Trusted Advisor can find Elastic Compute Cloud (EC2) instances with low CPU utilization, idle load balancers and Relational Database Service (RDS) databases, underutilized Elastic Block Store volumes and orphaned IP addresses. It also checks historical EC2 usage to identify candidates with steady workloads appropriate for Reserved Instances (RIs), which is key to exploiting another one of AWS' pricing strategies -- lower rates for precommitted, contracted use.
Pay now, save later
Like any contractual subscription with tiered pricing, RIs require understanding one's use and buying enough to cover the need -- without overspending or hitting a usage cap. On AWS, this means a hybrid deployment strategy can often save money -- using RIs for baseline, steady-state workloads and using On-Demand or Spot Instances to cover usage spikes.
Spot instances, which often cost 10% to 15% the cost of On-Demand instance equivalents, are particularly appropriate for batch jobs or time-insensitive workloads. RIs aren't limited to EC2; they're also available for databases (e.g., RDS, DynamoDB, ElastiCache) and CloudFront.
Enterprises can purchase RIs in three ways:
- Monthly installments
- Partial payments
- Full payment upfront
The price difference between partial and full payment upfront isn't that great, so a hybrid up-front/ monthly payment schedule typically provides the best balance between capital commitment and price discount. For example, recent pricing for m4.large EC2 instances showed just a 1% difference between the partial and all up-front discount for a one-year term.
Although RIs do lock buyers into a contractual one- or three-year commitment, they still have some flexibility. RIs can be redeployed to other applications, moved to another zone within the same region and -- for Linux and Unix instances -- resized without charge. Buyers finding that they no longer need RIs can also resell them in the AWS Marketplace.
Infrastructure design can control costs
Designing cloud-savvy infrastructure is the most effective way to minimize AWS costs over the long haul. Given the variety of AWS products, there is more than one way to achieve the same result; the most obvious solution of deploying another EC2 instance or Amazon Simple Storage Service (S3) bucket, isn't always the right answer. Other cost optimization methods include:
- Using S3 and CloudFront for content caching to offload the handling of static content in applications like WordPress from EC2.
- Using ELB and Auto Scaling to reduce the average number of EC2 instances by only bursting capacity when needed.
- Using AWS managed services instead of self-managed equivalents on generic EC2 instances. Examples include replacing services like Rabbit MQ with a messaging queue such as Simple Queue Service, Exchange or Sendmail with Simple Email Service, a NoSQL cluster with DynamoDB, Memcached with ElastiCache and a media encoder like HandBrake with the Elastic Transcoder service.
- Properly sizing EC2 instances by selecting the right mix of CPU power and memory from the dozens of EC2 instance types.
- Using S3 Reduced Redundancy Storage and Amazon Glacier for derived copies (nonoriginals) of data, log files, archives and anything that doesn't require 100% uptime. NOTE: Because recovery takes hours, not minutes, Glacier should only be used for truly archival data.
- Scaling out databases with read-only replicas on ElastiCache instead of new RDS instances.
- Using the AWS free tier for small, short-term test-and-development projects and only moving a paid tier if and when the application goes to production and demonstrates significant customer demand.
No one wants to waste money, so AWS cost management and wise use are imperative. However, it's also important to remember that running resources in the cloud isn't always a cost minimization exercise for all organizations. It's about increasing IT and developer agility and innovation. Still, by designing infrastructure for AWS, using a mix of RIs, On-Demand and Spot Instances of the proper size, and carefully pruning orphaned or underutilized resources, organizations can invariably keep their AWS bills down.
Use these tools to forecast financial storms