Preventing Empty-Wallet Syndrome: Cost-Optimization in the Cloud

We’ve all been there: you’re sitting at your desk, looking at the latest bill, trying to figure out how you went over budget again this month. You take out your trusty TI-82 and crunch some numbers, hoping for a mistake (like an added zero), but the numbers all add up. Panic sets in. Your face gets flushed. Maybe you stress-eat the last of the holiday chocolates. And then you walk into the CFO’s office to deliver the update.

Budgeting and Cost allocation is a big part of every IT infrastructure. You can be an unsung hero when you found ways to save the company money, or fall victim to the office evil-eyes when you’ve gone over budget. Cost optimization is also crucial when migrating to the cloud, so much so, that AWS made it one of the five pillars of the Well-Architected Framework.

This post will look at what can be done to help reduce the cost of your bill (and save your hide).

Let’s say you run Echidna Electronics, a retail store chain that decides it’s time to update “Bilby,” its mobile application, which is hosted in the cloud. Originally, Echidna was managing all EC2 and RDS instances. Servers were running day and night, resources had no owners, and very little monitoring.  After reviewing the Cost Optimization design principles, the company decides to improve the architecture through AWS Amplify, S3, Amazon Cognito, API Gateway, Lambda, and DynamoDB in an attempt to reduce costs and management overhead while improving availability. So now, let’s take a look at what the Cost Optimization design principles are (and make that CFO happy again).

Cloud Cost Optimization Design Principles

1. Adopt a consumption model

You pay for what you use. While some companies might deploy straight to Production, Echidna isn’t one of them. They can easily automate the process of starting and stopping resources when the development environments are not actively used.

2. Measure overall efficiency

Having that 128 CPU/4TiB memory server (x1e.32xlarge) sounds great to give you “optimal” performance—until you realize it’s only running at 10% utilization. Know what the business needs and develop services around that; match that supply and demand. Review the CloudWatch Metrics to see if you have your instances right-sized.

3. Stop spending money on data center operations

The cloud provides instance capacity, flexibility, and simplified deployments. The limitation (or requirement) of using or repurposing existing hardware no longer applies. With this in mind, the need for ownership and accountability becomes more visible within an organization.

4. Analyze and attribute expenditures

Tag, tag, and tag. Devising a tagging strategy improves monitoring of resources within a project, provides accurate chargeback, and can show spend by application or team. Echidna can now use Cost Explorer and Reports to analyze usage, then set Budget alerts when a project or environment exceeds forecasted budgets.

5. Use managed services to reduce cost of ownership

Echidna had a manual-patching policy to be performed Saturdays at 3AM. As much as Jimmy, the developer, liked this policy he knew there had to be a better way. After all, plenty of SaaS options, like RDS, EMR, or DynamoDB can help reduce management overhead. Moving to a managed service gave Jimmy the free time to study for that AWS certification.

With these design principles in mind, AWS provides four additional areas to focus on (since there are always trade-offs when designing an application).

Other Areas to Focus on to Optimize Costs in the Cloud

1. Cost-Effective Resources

The key resources in this area are CloudWatch and Trusted Advisor. Ensure you have the proper metrics configured, then review them frequently to verify a properly provisioned resource(s). If you have an EC2 or RDS instance that’s always on, take advantage of Reserved Instances for reduced pricing. When possible, use auto-scaling groups to handle the increase or decrease in load. Trusted advisor can help alert on over-provisioned and under-utilized resources.

2. Matching Supply with Demand

One of the last things Echidna wants is for customers to open the application on Black Friday and not get a response. The provisioning of resources needs to be balanced between just-in-time and recovery-on-failure. Make use of autoscaling groups (ASG), load balancers, and CloudWatch metrics to reduce the management of your environment.

The following three supply and demand approaches can fit within your environment:

  • Demand-based: This is primarily the use of autoscaling groups. A CloudWatch alarm is triggered which will add/remove an instance from an ASG. Keep in mind, there is a delay from when the instance is online until it’s ready for traffic.
  • Buffer-based: This uses a queue to maintain communication between each part of an application, which further decouples the application, improving reliability and resiliency.
  • Time-based: This assumes you have an idea when traffic will increase and lets you schedule resources based on that timing.

3. Expenditure Awareness

Tagging comes around again. Having the ability to breakdown costs by team or application should make any finance department happy. Furthermore, you can even forecast cost for the coming month.  Utilizing tools like Cost Explorer, Budgets, and Reporting allows more granular detail on spending. After analyzing these reports, configure the appropriate CloudWatch Budget Alarms to get a notification when approaching or exceeding the budget amount.

4. Optimizing Over Time

Measure, monitor, and improve. As you gather data and metrics into CloudWatch, you might conduct an analysis to see how the system is performing and compare against expectations. Clearly define the goals and metrics to meet business need. While analyzing these reports, keep in mind any new service that might help reduce costs or improve performance. Schedule these analyses at least once a year to ensure the application remains cost effective and properly optimized.

These are just a few examples of how you can reduce the cost of your application within AWS. To learn more about the Cost Optimization pillar of the AWS Well-Architected Framework, check out their official whitepaper. And if you’d like to see how your own application stacks up, go ahead and schedule a FREE Well-Architected Review with a Certified AWS Solutions Architect from Anexinet.

Become Well-Architected. Contact Us to Schedule Your FREE Review!

Share on

linkedin sharing button twitter sharing button