AWS Startups Blog

Optimizing your costs for AWS services: Part 1

Since its inception in 2006, AWS has been committed to providing small businesses and developers the same world-class infrastructure and set of tools and services that amazon.com itself uses to handle its massive-scale retail operations. In part one of this series on costs, we highlight how you can optimize your budget by using AWS in highly cost-effective ways.

Over the years, we’ve seen plenty of new businesses start and succeed on AWS. For example, Airbnb, Pinterest, and Lyft started as small, innovative businesses, and scaled over time by using AWS resources on demand. AWS strives to provide as many services and tools as possible to help our customers succeed. Customer feedback drives 90-95% of our roadmap.

Stakes for startups are high, so to extend the runway startups must develop their products with minimal spending. At AWS, our economies of scale allow us to pass on the savings to our customers. As a result, we’ve had 59 price reductions since 2006. We now offer more than 90 services, and we work continually with our customers to better understand their workloads so we can recommend best practices and services.

Best practices in the selection and usage of computing services

Consider the following recommendations when assessing the computing services best suited to your needs.

AWS Lambda

AWS Lambda has proven to be a highly useful service for startups because it provides continuous scalability and requires zero administration. There is no requirement to provision or manage servers. Customers are charged based only on the number of requests, the amount of time the code runs, and the memory allocated. With AWS Lambda, customers can run virtually any type of application or backend service.

For some early-stage startups, the AWS Free Tier often is sufficient enough to launch their initial minimum viable product (MVP).

We recommend AWS Lambda for the following:

Workload example
The free tier includes 1M free requests and 400,000 GB-seconds of compute time per month. Thereafter, AWS Lambda is billed at $0.20 per 1 million requests and $0.00001667 for every GB-second used.

For example, if you allocate 128 MB of memory to a Lambda function, execute it 20 million times in one month, and run it for 200ms each time, it would cost you $5.46 per month. For more information, see the detailed calculations on the AWS Lambda Pricing page.

Startups in early stages will not incur any charges if their requests and compute times don’t exceed free-tier usage.

AWS Case Study: Bustle Deck_Lightbulb
Check out how Bustle.com – a news, entertainment, lifestyle, and fashion website catering to women has experienced approximately 84% cost savings by using serverless services like AWS Lambda.

Amazon Elastic Compute Cloud (Amazon EC2)

Amazon EC2 provides resizable computing capacity in the cloud. You have complete control over your computing resources and can spin up resources within minutes, allowing you to scale quickly. You can just as quickly scale down your resources when you don’t need them.

Because AWS has over one million active customers, ranging from solo developers to the largest companies in the world, we offer several different ways to acquire compute capacity that fit different use cases. Some of the common ways our customers are acquiring the compute capacity include:

  • Reserved Instances – Where you reserve instances for a term of one or three year and get a significant discount.
  • Spot Instances – Where you bid for unused EC2 capacity and can run as long as it’s available and your bid is above the Spot market price.
  • On-Demand Instances – Where you pay by the hour for the instances you launch.

Reserved Instances Standard Reserved Instances provide a discount of up to 75% compared to On-Demand Instances. Reserved Instances could be a good choice for you if you have stable and predictable traffic, or if you know you will need your instances for at least a year. As another benefit, you can apply Reserved Instances to a specific Availability Zone, enabling you to launch the instances when you need them.

You can choose from the following payment options depending on the term and instance type:

  • All Upfront
  • Partial Upfront
  • No Upfront – popular among startups because it doesn’t require upfront capital

You also can list Reserved Instances that you don’t need any more for sale at the Reserved Instance Marketplace if more than a month’s term usage is left. Buying Reserved Instances from the Marketplace often results in shorter terms and lower prices.

You also can get Convertible Reserved Instances, which are available for a three-year term. They provide a discount of approximately 45% compared to On-Demand Instances and offer flexibility in changing instance attributes. The conversion requires new instances to be of the same or greater value.

We recommend Reserved Instances for the following:

  • Instances that must be online all the time and have steady or predictable traffic
  • Any baseline usage, while using On-Demand or Spot Instances for bursts
  • Applications that might require reserved capacity
  • Customers who can commit to using EC2 over a one-year or 3-year term

As an example, the following table shows approximate pricing for an m4.large Reserved Instance in the US East (N. Virginia) Region as of January 9, 2017. The pricing example assumes that the instance is online for one year.

Standard One-Year Term

Payment Option

Upfront

Monthly

Effective Hourly

Savings over
On-Demand

On-Demand

No Upfront

$0

$53.81

$0.074

31%

$0.108 per Hour

Partial Upfront

$276

$23.00

$0.063

42%

All Upfront

$541

$0

$0.062

43%

  • On-Demand – $946/yr.
  • No Upfront Standard one-year term – $648/yr.
  • Partial Upfront Standard one-year term – $551/yr.
  • All Upfront Standard one-year term – $541/yr.

The following table shows approximate costs if the same instance is online continuously for three years.

Standard Three-Year Term

Payment Option

Upfront

Monthly

Effective Hourly

Savings over
On-Demand

On-Demand

Partial Upfront

$565

$15.70

$0.043

60%

$0.108 per Hour

All Upfront

$1062

$0

$0.040

63%

  • On Demand – $946/yr.
  • Partial Upfront Standard three-year term – $376/yr.
  • All Upfront Standard three-year term – $354/yr.

The following table shows approximate costs if the instance is online continuously for three years, and you want the flexibility to change instance attributes.

Convertible Three-Year Term

Payment Option

Upfront

Monthly

Effective Hourly

Savings over
On-Demand

On-Demand

No Upfront

$0

$48.91

$0.067

38%

$0.108 per Hour

Partial Upfront

$745

$21.17

$0.057

47%

All Upfront

$1461

$0

$0.056

48%

  • On-Demand – $946/yr.
  • No Upfront Convertible three-year term – $586/yr.
  • Partial Upfront Convertible three-year term – $502/yr.
  • All Upfront Convertible three-year term – = $487/yr.

AWS Case Study: DropcamDeck_Lightbulb
Check out how Dropcam is saving around 67% on costs by using Reserved Instances.

Spot Instances – If you run a workload that isn’t time sensitive, then Spot Instances could be beneficial for you. These instances allow customers to bid on unused EC2 computing capacity for up to a 90% discount compared to On-Demand Instance pricing. Spot
Instances
can be used until the bid expires or the Spot Market Price is above the bid. The Spot Market Price is set by Amazon EC2 and fluctuates periodically depending on the supply and demand of Spot Instance capacity.

We recommend Spot Instances for the following:

  • Workloads that aren’t time sensitive and could be interrupted
  • Hadoop/MapReduce type jobs with flexible start and end times
  • Testing software or websites: load, integration,canary, and security testing
  • Transforming videos in different formats
  • Log scanning or simulations, typically performed as batch jobs
  • Simulations ranging from drug discovery to genomics research

AWS Case Study: GettDeck_Lightbulb
Check out how Gett, an Israeli-based startup that connects people with taxi drivers, is saving $800,000 annually by taking advantage of Amazon EC2 Spot Instances.

AWS Case Study: Fugro RoamesDeck_Lightbulb
Check out how Fugro Roames’ use of AWS and Spot Instances have enabled Ergon Energy to reduce the annual cost of vegetation management by A$40 million.

Bidding strategies

  • Refer to historical bidding prices on Spot Bid Advisor while bidding. This could reduce the chances of interruption in case the demand for Spot Instances increases.
  • Use older generation Instances for bidding because their prices are more stable, reducing the chances of interruption, whereas popular Spot Instances tend to have volatile Spot pricing.
  • Use On-Demand pricing as a baseline price, where bidding around that could reduce the chances of interruption. Customers are charged the current Spot price and not the bid price that they set.
  • Bid using Spot Blocks which enable Spot Instances to run continuously for up to six hours at a flat rate, saving up to 50% compared to On-Demand prices.
  • Test applications on different instance types when possible. Because prices fluctuate independently for each instance type in an Availability Zone, it’s possible to get more compute capacity for the same price when you have instance type flexibility.
  • Bid on a variety of instance types to further reduce costs and improve application performance.
  • Use Spot Fleets to bid on multiple instance types simultaneously.

On-Demand Instances – These instances are billed hourly with no long-term or upfront payment. You can add or remove instances from the fleet, so you pay only for the specified hourly rate for the instance type that you choose.

We recommend On-Demand Instances for the following:

  • Testing applications on EC2 instances and terminating them when not in use
  • Any baseline usage, while using additional On-Demand or Spot Instances for bursts
  • Applications with short-term, unpredictable, or spiky traffic that cannot be interrupted
  • Customers who want flexibility to switch between instance types, without upfront payment or commitment

AWS Case Study: AdRollDeck_Lightbulb
Check out how AdRoll is using AWS global infrastructure and services and a combination of On-Demand, Reserved, and Spot Instances to reduce fixed costs by 75% and annual operational costs by 83%.

Overall recommendations:

  • Start with On-Demand Instances and assess utilization for Reserved Instances.
  • For steady state usage pattern, pay All Upfront for 100% utilization.
  • For predictable usage pattern, pay All Upfront or Partial Upfront with a low hourly rate for baseline traffic.
  • For peak times, supplement your capacity with On-Demand Instances.
  • For uncertain and unpredictable usage pattern, start small with On-Demand Instances. If your usage pattern grows and becomes more consistent, switch partially to Reserved Instances or walk away, thereby spending very little for On-Demand Instances for a short period.
  • Use a mix of Reserved Instances, On-Demand Instances, and Spot Instances. This allows you to find the right balance of saving money while keeping your resources online all the time.
  • Use Reserved Instances for baseline usage, and beyond the baseline usage scale using Auto Scaling by launching Spot Instances or On-Demand Instances.

 

Auto Scaling

Auto Scaling lets you scale EC2 capacity up or down either when you experience spiky or unpredictable traffic, or for predictable or scheduled traffic, ensuring you only add the resources you require, as per the conditions or policies defined. This is essential for new businesses that are unsure of the traffic their application might experience.

We recommend that you start small and let an Auto Scaling Group add more instances automatically if required. Auto Scaling is well suited to applications that have stable demand patterns, and to applications that experience hourly, daily, or weekly variability in usage. Auto Scaling is enabled by Amazon CloudWatch, a resource monitoring tool, and carries no additional fees beyond the resource costs incurred by services provisioned by Auto Scaling.

You can set Auto Scaling in conjunction with Cloudwatch to choose from many metrics, including average CPU utilization, network traffic, or disk reads and writes by percentage or by constant readjustment. Example policies include the following:

  • If CPU utilization is greater than 60% for 300 seconds, add 30% of the group.
  • If CPU utilization is 80-100% for 300 seconds, add two instances.
  • If CPU utilization is 60-80%, add one instance.
  • If CPU utilization is 0-20%, remove two instances.The minimum number of instances is five.

You can use a combination of Reserved, On-Demand, and Spot Instances in an Auto Scaling group to expand or shrink. You can use Reserved Instances for baseline utilization and configure an Auto Scaling Group to add capacity by launching Spot Instances or On-Demand Instances.

We recommend Auto Scaling for the following:

  • On and off traffic patterns, such as testing or periodic analysis
  • Unexpected growth such as events or applications getting heavy traffic
  • Variable traffic such as seasonal sales or news and media
  • Consistent traffic such as high use of resources at a particular time range each day (for example, during business hours)

AWS Case Study: LyftDeck_Lightbulb
Check out how Lyft is using Auto Scaling to manage up to eight times more passengers during peak times and scale down at other times to stop paying for those resources.

AWS Case Study: Gruppo EditorialeDeck_Lightbulb
Check out how Gruppo Editoriale L’Espresso, an Italian multimedia firm, is using Auto Scaling for unpredictable traffic that sometimes grows as much as 300% if a story breaks.

Conclusion

AWS is constantly working towards reducing prices and, with the economies of scale, passing on the advantages to our customers. With the variety of purchasing options available through AWS, customers are designing their own pricing model plans as per their requirements. At AWS, we are committed to listening and responding to customers. Our commitment is to provide them with an infrastructure that is highly secure, reliable, and scalable, allowing them to focus on the products and features that differentiate them.

What’s Next?

Upcoming in this series will be part 2, discussing the ways to optimize cost for storage and other AWS services. If you’re in NYC and want to learn more about Cost Optimization on AWS then join us at the AWS Loft for Running Lean Architectures on AWS + Office Hours. Register now!