Posted May 22, 2018 by & filed under News, Web Development.

In our latest blog video, Flaunt Digital CTO, Jamie, shares his top 3 tips on optimising your Amazon Web Services (AWS) account for cost-efficiency. Why not subscribe to our YouTube channel for more videos like this?

See below for a full video transcription.

VIDEO TRANSCRIPTION:

Today we’re just doing a short video on Amazon Web Services. Here are three ways to optimise your AWS account for cost-efficiency…

  1. Make liberal usage of reserved instances

So we’re gonna get straight in with the first one. It’s the most blindingly obvious tip for saving money on Amazon Web Services, and that’s to make liberal usage of reserved instances. Now, this has been an option in AWS for years now. It’s been there for probably over five years, but it’s always evolving and it’s changing a lot. Just recently, they introduced convertible reserved instances, and this makes an already complicated system and a complicated interface even more complicated, because reserved instances is quite daunting as a concept. So essentially what you’re doing is you’re paying up-front for resource usage. You can do this over one year or three years. You can also do nothing up-front, partial up-front, or all of it up-front. So if you were to go for quite a beefy server and you were gonna do all of it up-front for three years, you’re gonna be paying a lot of money up-front. So you got to have a lot of trust that you’re gonna need that resource in the years to come. So it’s quite hard to forecast that way forward, depending on how your business works, but generally, you’re always better off using reserved instances if you’ve been running any sort of server in Amazon, whether it’s EC2 or RDS, the two services that use reserved instances. You should pretty much be looking straight into getting a reserved instances on your account, because it can save you over 50%. So it’s almost, you can get half-price stuff, basically. So it’s a no-brainer. It’s a really, really, really broad topic. One of a couple of things I just wanted to cover off is just how daunting it is. 

So just going back to what I said a minute ago, the interface is awful, and in my opinion it should probably tell you about reserved instances when you are just starting an instance, whether that’s in EC2 or RDS. Because you’ve got a sort of an instance picker built in to the reserved instance interface, and it’s not the same as the picker structure that you get when you’re just launching an instance. And there’s more parameters in there and now you’ve got convertible instances too, so there’s even more things to consider, and it’s not immediately obvious what’s going on. So I do encourage everyone to take the plunge with this and just try it out, spend a little bit of money and just make sure it’s working as you think. Check your billing options as well, check your billing console and make sure that you’re getting the price that you think you’re getting, and try and reverse-engineer the calculations. But it is worth learning, it is worth taking the plunge because you’ll save a lot of money. 

  1. Auto-scaling set-ups in EC2

Okay, our next point for cost-saving in AWS is to do with auto-scaling set-ups in EC2. So we all know how auto-scaling works, or hopefully you do, and there’s tons of ways you can scale up and down, but one of the metrics that’s quite apparent in the interface is CPU. And now, if you’re running a website, CPU’s not really a bottleneck usually, depending on what you’re doing in the background. It’s usually something more in line with RAM usage or could be a number of other things. But regardless of that, it’s really good to have your bottom line, or your minimum design capacity on your auto-scaling web server fleet to be more than one. So depending on how business-critical the servers are, it might be two or three or four, but in our experience, we have quite a lot with two as the minimum, and essentially, if you get anything strange that happens or if one of the servers just locks up or crashes or whatever, you’re always gonna have that one server remaining. So it’s good to have two as a bottom line. Now, the way that you can optimize this for cost is if you are running a site that’s primarily serving UK users, you’re obviously gonna have downtime during the night, and sometimes on the weekends too, depending on if it’s a B2B website or B2C. So typically we’ll see a drop-off which can sometimes be up to sort of 80% of regular hour-on-hour traffic through the night time period, so… I mean, key hours, as you can imagine, when everyone’s asleep in the UK. So you’re talking, like, between two and five AM in the morning Monday to Friday. So what you can do is you can scale your baseline back down from two to one. 

So obviously it’s a little bit of a risky strategy because if something did go catastrophically wrong in those hours, you’re not going to have a failover server, or a server to pick up the traffic if one of them dies. So it’s a risk that obviously you have to work out for yourself, and it depends on your business case, but we find it’s really useful to scale down servers, regardless of your auto-scaling policy, just based on the time. And the way you do this in EC2 is in the auto-scaling interface you’ve got a tab there called “Scheduled Actions,” and it’s essentially like a Cron Job setup. So if you’ve ever used Linux, you’ll be familiar with Cron Job. It’s a way to schedule anything to run on the operating system. And essentially, you stub that out in the “Scheduled Actions” interface, very much like you stub out a Cron Job. So you can give it an hour or a weekday, or a day of the month, whatever, but in our example we’re using here it’s an hour of the night. So we’ll have it scaling down a little bit at, say, 2:00 in the morning, and back up at 5:00 in the morning. So you’re only reducing it by one server for a few hours per day, but over the course of the year, if you’re running quite resource-intensive servers, it’s gonna add up to quite a bit of money, so it’s something worth looking into. It’s a quick win, really, providing your business case allows for something like that. It’s obviously a risk-reward weigh up that you’ve gotta do, but it can be effective to save money.

  1. Reserved instance usage reporting

So my last point for today is also gonna hook into reserved instances. As I mentioned at the start, reserved instances are an absolutely huge topic in regards to saving money. So it’s likely that when you’re covering these points you’re going to get quite a bit of crossover. So the last point is the new reserved instance usage reporting you can get out Amazon Web Services. This has quite recently launched. It’s in the “Cost Explorer” section of your account. So if you go into your account and billing options, and then on the left-hand side you’ve got “Cost Explorer,” I believe it’s called, and from there you can launch this interface. And again, it’s not a great user interface. It’s quite hard to navigate, and you’ll find these recommendations under the hamburger menu if you’re on a desktop, on the left-hand side, which is a weird concept, hamburger menu on the desktop side, hiding menu options that you can’t see. Bit weird, but once you know they’re there, great. So you’ve got one for EC2, one for RDS, and what they’ll both show you is they’ll show you, essentially, tips on how to optimize your account as a whole based on your current usage. 

So you can look at, I think it’s seven days, or three months, or six months previous, and then Amazon will give you exact recommendations on what you should go and purchase and how much that will save you in a year. So historically, that calculation has been really hard to do, especially if you go back to my earlier point about how convoluted the “Reserved Instance” interface is. And once you’ve got quite a complex account like we have at Flaunt Digital, what you find is it’s a really useful setup and organization structure whereby you’ve got a master account or a parent account, and you buy all your reserved instances at that level, and then you can apply those discounts to any accounts underneath. So as soon as it starts getting messy like that, and they’re all expiring at different times, they’re all different sizes, it becomes a bit of a nightmare to manage, and that calculation that you used to have to do on paper or in Excel or whatever, is now sort of done for you. Obviously you’ve got to take it with a pinch of salt in terms of Amazon’s recommendations, because they don’t know your business case, and they don’t know how stable your resource usage is gonna be. Obviously if you’re gonna get rid of loads of it in six months, you don’t want to pay for a year’s worth, so you’ve got to take a bit of context and use your own initiative a little bit. 

But in general, it’s an absolute life saver, and it’s really specific, which is great when you come into the interface to actually make the purchases, because there’s loads of options, and it’s quite daunting when you first go into it, because there’s, you have to decide on a lot more things than you think you have to decide upon. So that interface is great, and that’s brand new, that’s in the last few months that’s come about. And like I said, it’s not very easy to find, so if you didn’t recognize the email that advertised that new offering, then, like I said, you go into “Cost Explorer,” go in the hamburger on the top left, and then it’s at the bottom there’s two little menu items, “EC2” and “RDS,” and it’ll give you the recommendations there. And it’s really accurate, and in our experience it’s really, really useful. So if you go back into your main “Cost Explorer” interface, you’ve got coverage and utilization reports, and they’ve been there a while, but they’re, again, a little bit hard to comprehend as a newbie. So these other recommendations, basically if you follow them, and your resource usage is only gonna go up, rather than down, then it’s pretty much what you need to be doing. So it’s almost a no-brainer, and it just takes a lot of the complication out of it, and so it’s a great new service that Amazon have added to their interface. 

That’s it. Hopefully you found that useful. There’s loads of stuff you can do to optimize costs in your AWS account, as I mentioned at the start, and a lot of them are to do with reserved instances. So if you’re gonna take anything from this video, just start poking around the reserved instances areas of EC2 and RDS, and just make sure you’ve got some provisions in there if you’re gonna have a long-term commitment to using Amazon Web Services, because you don’t want to be paying on-demand by the hour, or by the second, or minute, or whatever it’s changed to now. You want to be paying up-front, whether that’s just partially, or nothing, or all of it. If you can afford all of it, then good on you, go for it, but I would get your feet wet, you know, spend a little bit less money first to just get your confidence in it and make sure that you’re using it as you think it’s used, because, like I said, the interface is not great. Essentially, reserved instances, they’re the way to go to save money on Amazon. 

Hope you found that useful. See you next time.

Similar posts

Quick Wins For Schema Mark-Up

March 21, 2019

Why Creating Valuable Blog Content Is Vital To Long Term Success

August 11, 2017