Pay As You Go (PAYG) cloud services from AWS give the ability to consume infrastructure as a utility. So how do you get the best out of this new OPEX approach?
In our previous blog we looked at six tips to optimise your costs in AWS. In this blog we look at the next consideration – how to deploy applications cost effectively.
The ultimate aim of any deployment should be to optimise the performance of the application and produce a clear business benefit.
Infrastructure as Code
Automating the build of individual components, or an entire infrastructure, using Infrastructure as Code means services can be quickly reinstated in the event of failure. This also provides the ability to recover from failed updates or to roll back changes to the environment if required. AWS has a number of tools to help developers and systems administrators deploy and manage a collection of resources through automation such as CloudFormation and OpsWorks. A number of other third-party tools can also be used.
In the past, solutions would be scaled for the worst case scenario, or ‘peak load.’ This tended to incur significant cost. With AWS this is no longer necessary as most EC2 instance types can be re-sized with a re-start of the instance. AWS provides all of the tools necessary to monitor instances and see the resources an application is consuming. The instances that the application is running on can then be sized appropriately, saving money.
On CPU intensive tasks it might also be that running a larger instance size for a shorter time turns out to be more cost effective than a cheaper instance running for twice as long.
Elasticity is one of the biggest benefits of hosting infrastructure in the cloud. Writing applications to take advantage of scaling can lead to considerable cost savings. Using architectural principals such as decoupling application components and storing session state information away from the instances, can free applications to take advantage. If some environments are not in use or are not required 24hrs a day, shut them down or better still tear them down to be re-built on demand.
AWS offers the ability to pre-purchase or reserve EC2 compute capacity in the form of Reserved Instances. Using Reserved Instances can save up to 45% against the on-demand pricing.
Convertible Reserved Instances allows the size of the instance to be changed but this provides less of a saving. There is also an option to purchase Reserved Instances based on a schedule. Reserved Instances can be bought or sold on the AWS marketplace.
Spot Instances are the ability to bid on AWS’ spare EC2 capacity. Choose the price you are willing to pay for an EC2 instance size and if the price drops below that threshold you can use that instance at a considerable saving (up to 90% below PAYG pricing). However the downside is that once the price rises again, your instance will be terminated without notice. Therefore Spot Instances are best used for batch processing tasks where it will not matter if the process is stopped suddenly.
It is important to know what information the application needs to store and when it will need to retrieve it. AWS provides a number of different storage options from EBS (Block Storage), S3 (Object Storage), EFS (Network File Storage) to Glacier (File Archiving). There are a number of different performance and durability options which are priced accordingly.
Archiving data using Glacier for instance can reduce the storage bill. Where the same data needs to be available to a number of instances, centralise the data rather than duplicating it using EFS or S3. Data compression can also be used to reduce the data footprint further.
Data Transfer and Networking
AWS charges for data that crosses regions, availability zones and where it is transferred out of the AWS cloud. There are ways to reduce traffic flow across availability zones in a given region but these can have an impact on elasticity and resiliency.
For data flow out of AWS to the Internet, CloudFront can be used to serve static content from applications at a reduced rate compared to serving it from a public IP associated with Load Balancing or instances in a Virtual Private Cloud. Bear in mind though that there are costs for running CloudFront which would need to be factored into any savings.
Finally, if you are running a hybrid environment or transferring large volumes of information between an on-premise or colocation environment and AWS, you might want to consider Direct Connect as this does not count as data being transferred out of the AWS environment. The costs are included in the fixed line costs for the connection. Your data charges would need to be significant to account for the cost of using Direct Connect however, in a hybrid environment, infrastructure costs across the year would add up and go some way towards justifying its use.
By Jamie Gibbs, Cloud Solutions Architect, SystemsUp
Find out how SystemsUp can help you keep your AWS costs under control by downloading our Free Managed AWS Billing datasheet.
SystemsUp is an AWS Advanced Consulting Partner.