7 Ways to Cost-Optimize Your AWS Cloud in 2023
December 7, 2022
In this article I won’t be looking at the more obvious AWS cost savers like using EC2 spot instances, reserved instances, saving plans or deleting unused EBS volumes. Instead, I would like to take things a step further. Let’s talk about how you can improve your cloud infrastructure to make it more “financially elastic”.
A serverless future…
One major advantage of AWS is their ability to save you time and money through “serverless services”. Serverless means precisely what it says; services that don't need any manual server management like upgrading, patching or scaling. This frees up valuable time of cloud engineers (and developers). Moreover it prevents mistakes and can lower fixed cloud infrastructure costs.
At the moment AWS is offering a growing list of 15+ serverless services ready for you to deploy. Examples include compute services like Lambda. Database services like DynamoDb. And message services like SNS and SQS. Here are a few ideas how to use some of these to lower your cloud spending.
Use Aurora Serverless when possible
If you are running applications that use a database tier, it’s worth investigating whether you can migrate to Aurora Serverless. Aurora Serverless automatically scales capacity up or down depending on your application's needs. This means your database cost will become variable instead of fixed. To make life easier, you can use Amazon Database Migration Service (DMS) to move your database to Aurora Serverless.
Use DynamoDb when possible
If your app uses Redis or Memcached for session storage, consider using AWS DynamoDb instead. DynamoDb is a fully managed NoSQL database that is serverless, which like Aurora means it automatically scales capacity. While DynamoDb uses SSD storage instead of memory, DynamoDb DAX could still make it suitable for use cases that need ultra low latency.
Use Lambda for your API’s compute layer
If you are providing a public or private API, chances are the workload is variable. However, most legacy APIs are using an “always-on” compute infrastructure like EC2 servers or ECS clusters. This means you’ll have a baseline cost which is higher than necessary.
By using Lambda functions instead, you will only pay for compute when the API is actually being called. Plus, if you host the database on Aurora Serverless instead of any other database service, you can further minimize cost when API usage is low. Another advantage of using Lambda over EC2 is that you won’t have to manage an operating system. This removes important fleet management costs. Saving plans also apply to Lambda functions.
Additional strategies
Next to utilizing serverless, here are a couple of other ideas to help you save money on your AWS cloud in 2023.
Migrate static data to S3 Intelligent-Tiering
AWS offers 7 different storage classes for your data, each with their own application and pricing. In general the rule is that the faster and more often you need access to your data, the more you will pay. In some situtions it’s hard to decide upfront which tier is the best for you. Luckily AWS offers “Intelligent tiering” that uses artificial intelligence to make that decision for you. It works by analyzing the actual usage of the data. Consult this article on how to migrate your current S3 to intelligent tiering.
Spin dev environments up and down with Cloudformation
Chances are you are using multiple AWS accounts that each host a different environment – like development, pre-production and production. In most cases, you will only need the development environment when your dev-team is actually deploying and testing code there. By describing your infrastructure in code you can automatically provision the entire stack. This is not only great for consistency between environments, it also means you can easily remove resources when you don’t need them, and stop paying for them.
Utilize Artificial Intelligence for security
Once your infrastructure is running (and cost-optimized), there's still more work to do. An important component of managing cloud infrastructure involves monitoring for security breaches. In many cases, this means having manual or automated checks in place that constantly look for security issues - which can quickly become a full time job of a security engineer.
Managed services like GuardDuty and DevOps Guru use AI to automatically scan your infrastructure, pinpointing vulnerabilities before you even knew they existed. They also suggest how to fix them - all at the fraction of the cost of manual work.
Let me help you
No, I wasn't trying to trick you, but #7 is asking me to assist you with optimizing your cloud infrastructure! Bringing someone in from the outside allows you to focus on your product and customers. Plus, you will benefit from solutions learned in similar situations and industries. I'm offering free consultations during which I can review your setup and make recommendations. Contact me to book yours!
About the author
Join my mailing list
Stay up to date with everything Skripted.
Sign up for periodic updates on #IaC techniques, interesting AWS services and serverless.