Save Up to 10% on Your AWS Costs by Automatically Managing Instances Using AWS Lambda [Includes Demo]
To help you maximise the cost-effectiveness of AWS, I would like to give you some real-life tips related to EC2 Instances and purchase options as well as a demo of how to shut down and start up instances automatically using AWS Lambda.
At Contino, we always like to put some skin in the game so, if, after going through all the tips below, you still can’t save at least 10% on your monthly AWS bill, I’ll eat my hat.
Use the right workloads!
In 2016, AWS reduced their prices about fifty times. Do you realise they now offer storage at 15 dollar cents per GB per month, and compute at 10 dollar cents per hour?
The public cloud is highly cost-effective if the correct instances are used for the correct workloads!
Let’s start with the EC2 Basics
You have four options when purchasing AWS EC2 Instances:
With On-Demand instances, you pay for compute capacity by the hour with no long-term commitments or upfront payments. You can increase or decrease your compute capacity depending on the demands of your application and only pay the specified hourly rate for the instances you use.
2. Spot Instances
Amazon EC2 Spot instances allow you to bid on spare Amazon EC2 computing capacity for up to 90% off the On-Demand price.
3. Reserved Instances
Reserved Instances provide you with a significant discount (up to 75%) compared to On-Demand instance pricing.
For applications that have steady state or predictable usage, Reserved Instances can provide significant savings compared to using On-Demand instances.
4. Dedicated Hosts
A Dedicated Host is a physical EC2 server dedicated for your use. Dedicated Hosts can help you reduce costs by allowing you to use your existing server-bound software licenses, including Windows Server, SQL Server, and SUSE Linux Enterprise Server (subject to your license terms), and can also help you meet compliance requirements.
Tips When Using Multiple Accounts
- Try whenever possible to use consolidated billing. If you’re unsure about what it is, please watch this video created by AWS Support about how to enable consolidated billing and if you need more information about it, read it here.
- For 24/7 running environments, check what the best instance type is. Remember you have memory-, cpu-, storage- and gpu-optimised instances. After a few days of usage, you will be able to analyse Cloudwatch metrics pattern usage, and pick the right instance on that basis.
- Reserve instances, but in the right way. Remember you can ‘downsize’, but you can’t ‘upsize’. This means that, if you have a large instance, you can transform it into two smaller ones, but not the other way around. You can read more about it here.
- Evaluate what’s the best for your infrastructure in terms of instance size and type. You can use this website to make comparisons. Remember to pick the right region. You can also use it for RDS Reservations.
Reservations vs Instances
I want to explain the difference between reservations and EC2 Instances in more detail as I’ve had this chat with some colleagues in the past.
A reservation is a billing action. As soon as you reserve an instance, the clock starts ticking. This means that you will pay for it, whether you use it or not. If you reserve an instance but you don’t launch it, you’re wasting money. So, before purchasing a reservation, make sure you will use 720 hours/month for the period specified (could be one or three years) of that instance type and size. This doesn’t mean in one single instance, there could be 10 instances running for 72hrs each in this example.
What do I do next?
Put a reminder in your calendar and go through the following tips and tricks at least once a month.
Resize and shave your infrastructure:
AWS offers a tool called Trusted Advisor that can help you understand how well or badly you are using your compute capacity. Make sure you review it regularly.
Shutdown instances that aren’t being used:
We all have instances that are “dormant” over the weekend, so you’d better shutdown them as they are generating cost with no reason.
You can use this simple Lambda script to manage that. If you want to know how to enable it, have a look at the demo below: