I remember a few years back, lots companies were struggling with the VM sprawl problem. With the popularity of Cloud, the in house VM sprawl issues might be improved as most companies are moving to Cloud nowadays. I like the flexibility (on demand) and capability (a broad range of technologies) of Cloud. But I have to say Cloud is not necessarily cheap. And you may run into same issue (or worse, as there are more things that Cloud can do) again very soon if you don’t manage it properly!!
We are running most infrastructures in AWS, here are some quick tips that I can think of to manage AWS resources and decrease the cost:
- Do housekeeping periodically – review and get rid of the unneeded resources. e.g terminate no need instances, consolidate instance if you can, remove the ELB which has not instances are associated, unattached EBS…
- Choose right size for your EC2 instance – AWS provides different instances family, and within each family there are different type. Based on your system requirements and test result, choose the best reasonable one. e.g T supports burstable CPU, M balances CPU and memory, C focus on more powerful CPU, R is optimized for memory…
- Replace the deprecated instance type with new generation – You might not noticed, the equivalent new generation instance actually offers same or more power but with lower price. e.g m1.small can be replaced by t2.small.
- Use spot instance for non critical service – Spot instance provides same power but much lower price, the only thing that you need to be aware of is that it can be terminated anytime. So better use it for some non critical service, like back end workers. Another good practise is to use both spot instance ASG and on demand instance ASG behind the same ELB, and set the policy to always to start spot instance first when scale up, and shutdown on demand instance first when scale down.
- Purchase reserved instance for long term and high utilization instance – Decide the right size of your instance, then purchase the reserved instance for those ones with high utilization. Based on the payment type and contract term, it can save you a lot.
- Auto shutdown and manual start the dev/uat instances – For most dev and uat environments, they can be shutdown over night. Create a automated process that can shutdown all dev and uat instances every day just in case the user forgot to stop them. For dev/uat environment, let the user to manually start them whenever they need them, as not every dev/uat boxes need to be running all the time even during the business hours.
- Free lunch 🙂 – Set up a realistic cost saving goal for the team each month. If they can make it, take them out for free lunch. Trust me this is small money comparing to what can be saved.