Although deploying applications in the cloud requires a certain skillset, those skills are presenting less of a hurdle these days. The evolution of technology and the availability of advanced tools are making the job of the cloud architect easier and easier. The skills needed to understand the underlying components for a cloud deployment can be easily acquired. Certainly, the successful deployment of a multi-region, stable solution still requires a substantial amount of experience, knowledge, and perspective. At the same time, there is an additional aspect of cloud architecture that is often overlooked—the cost factor.
Designing a Cloud Environment with Cost in Mind
There is a fundamental difference between deploying your application on-premises and in the cloud. It not only means that you need to understand the technologies available to you in both locations, it also means you have to understand the difference in the cost models and potential pitfalls that come with deployment in the cloud.
Here is checklist to help you prepare for the complexity of cost management with AWS.
On-Demand vs. Reserved vs. Spot
Let’s delve into each of these items to see how they each impact your costs deploying on AWS.
AWS has a vast number of instances, which are typically divided into family types based on the profile or usage pattern of your application. These include General Purpose, Compute-Optimized, Memory-Optimized, Accelerated Computing Instances, Storage-Optimized, and Dense Storage instances. Each type targets a different use case, with a specific balance between CPU, RAM, and Disk/Network I/O intended to match most of your application needs. This is quite different from a traditional on-premises application, where you would order the exact amount of RAM or the number of CPUs as needed. With AWS, there is a set number of options: custom flavors are not an option.
On-Demand vs. Reserved vs. Spot
An additional aspect that will be crucial in the management of the EC2 costs for your applications is the kind of instances you deploy (Spot, Reserved, or On-Demand). The actual CPU, RAM, and Network throughput resources are the same across all three types; however, there is a significant cost difference between the three.
This is the basic and default option. Think of it as a “list-price” for EC2 resources. Most organizations start out with On-Demand Instances. This is because the mechanism involved in using Spot Instances is not straightforward, especially when you are not really familiar with all the possibilities and options in AWS. And the cost and term commitment involved in purchasing Reserved Instances is not something that you are likely to take on when you are just starting out.
With Reserved Instances (RIs), you commit to purchase or pre-pay for AWS resources in order to save yourself money in the long term. The cost savings for RIs can save you a significant amount of money—anywhere from 30-70%. Your actual savings will depend on the period you are willing to commit to AWS, and how much money you are willing to pay upfront. There are a lot of details you need to pay attention to when going down this path, therefore it is highly recommended to conduct the proper research beforehand.
This is the marketplace or stock exchange of AWS compute resources. Cost savings are even greater than what you can achieve with RIs, but there is a significant caveat that you need to take into account: the instance you purchase is only yours for as long as the price is right. If someone else places a higher bid on the compute resource you have purchased, then you will be notified that the instance is going to be taken away from you. Spot Instances are not suitable for every kind of workload and application. To fully benefit from this cost saving option, your application architecture must be able to tolerate the possibility that your instance might disappear with very little notice. A substantial amount of orchestration and planning is required in order for this to work properly.
Network Traffic Costs
Almost anything and everything you do in AWS will have a price tag attached to it—and network traffic is no exception. Charges are per GB of data traffic per month.
AWS traffic is measured over four distinct paths: inside the Availability Zone, inside the Region (between Availability Zones), between Regions, and out to the Internet. This should be taken into account during the design phase of your application, so that you can minimize the costs of traffic between the different parts of your application.
As a rule of thumb, you should try and keep as much of your data traffic inside your Availability Zones and definitely within your Region. There are a number of ways to ensure that the data stays local, in your Availability Zone—it just requires more planning and forward-looking strategy, understanding how data should be made available to the applications that consume it, and optimizing the shortest (and, of course, the cheapest) path between them. Provisioning additional read replicas of your database in each Availability Zone to place it in close proximity to your application is one such example.
Rightsizing your workloads is probably the biggest cost savings measure you can implement, but in order to do that you need to have the right set of tools. These tools will fall into two categories: AWS Trusted Advisor and third-party tools.
AWS Trusted Advisor
AWS Trusted Advisor is a tool provided by AWS, with Premium support. AWS offers insight into the metrics and usage of each of the instances you have in AWS, and will provide a number of recommendations to help you save money.
This will usually be about right sizing the resources you have today. Here is an example:
Of course, the recommendations should be evaluated on a case-per-case basis. The recommendations given in these native tools are not always feasible. Take, for example, the recommendation to change the instance size from c4.large to a smaller instance. The obvious option here would be to move to a T family instance; however, there are a number of different issues regarding CPU throughput and CPU credits that need to be considered. Simply changing the instance size might reduce your costs, but it might also significantly impact your application performance.
As a cloud solutions architect, there is always a delicate balance that needs to be preserved between cost and service level availability, and the cheapest option is not always the best one in the long run.
In another example, Trusted Advisor might recommend that you reduce the amount of EBS storage attached to each instance because it is not really being used. What is not taken into account here is the fact that EBS storage and the respective size of the volumes provisioned have more than one purpose. The first purpose is actual data stored in your instances (which is not necessarily consumed). The second is the throughput needed for each instance and the I/O needed by each application. For each GB of EBS storage provisioned, a consistent baseline performance of 3 IOPS/GB is allocated to the volume (up to a maximum of 10,000 IOPS). Even though you could shave off some of your monthly AWS bill by reducing the size of your EBS volumes, by doing so you might inadvertently weaken the performance of your application due to an I/O bottleneck.
Third-Party Cloud Management Tools
Although native tools can help you reduce your costs, there are a number of tools in the market today (such as CloudCheckr) that have capabilities and added value as specialized products. These products are dedicated to delivering a comprehensive cost analysis and actionable insights on top of the defaults provided to you by AWS. Features such as automated remediation, adherence to industry best practices, and the capability to maintain a single platform for cost optimization across multiple cloud platforms combine to create an invaluable tool that is becoming a necessity in today’s cloud market.
The Advantage of Financially Strategic Cloud Infrastructure
There are many ways that you can save on your cloud bill and make your CFO a happy camper. In most cases, cloud providers are interested in helping you to help yourself in cutting costs. After all, they have a vested interest in preserving your loyalty and keeping your business as an investment for the long run. At the same time, the use of available third-party tools such as CloudCheckr can take you a step further in the process of automating and optimizing your deployment.
Understanding how to best use the different technologies that each vendor has to offer can significantly reduce your costs in the short and immediate term. It will also allow you to invest those funds in new initiatives that could provide you with the technical advantage you need to stay ahead of your competitors.