It’s been noted that the number of enterprises big or small that are shifting their existing applications from their traditional infrastructure to AWS cloud has multiplied in the past few years. While the pricing model of AWS Services (pay-as-you-use) is what attracts enterprises if careless you would get unnecessary cost spikes. In order to reduce cost, you must keep AWS services optimized or in other words design your AWS architecture for the cost. In this blog, we shall see some points on the fundamentals of cost optimization
AWS (Amazon Web Services) Cost Reduction – Best Practices
Unused and Underused Resources
Find the unused and underused AWS resources on your AWS infrastructure and either stop these resources when not in use or downgrade it to a much optimum type in a cost management point of view. A simple example would be that the EC2 or RDS instances developers make use of to test their applications can be stopped on weekends when they are no longer working with them. Since AWS does not price you for the resources you are not using in other words resources that are stopped you save your valuable money following this advice. It is a widely understood fact that AWS core services such as EC2 , EBS and RDS are the main contributors to the monthly bills in enterprises. So downgrade or choose the correct instance type if you are not fully utilizing the resources and continuously try to optimize the AWS service types by monitoring their usage. AWS Cloudwatch service can be used to monitor the metrics for CPU utilization , data transfer , disk usage , Memory usage etc that gives a clear idea of instance resource under usage and you can design your AWS services accordingly.
Also look for old snapshots or AMI’s and delete them and automating scripts to delete old ones regularly are best practices.
Make use of the AWS Elasticity Property
Using AWS autoscaling feature to scale up and scale down your AWS computational resources according to the business needs is advisable. Consider for example an online e-commerce website that would have unpredictable spikes of traffic. Rather than using a high end architecture that is capable of handling any number of traffic it’s better to scale the resources and computational power up and down according to the traffic to the website which helps to optimize the billing cost effectively. The above example setup can be achieved via the AWS autoscaling feature, and for triggering the scaling process a cloudwatch metric alarm , SQS or other notification services.
This way you never overpay for our services creating a cost-effective yet intelligent architecture that is upto your computational demand. In other words AWS urges you to think parallel.
Understanding AWS Pricing Model
There are different types of EC2 instances available and it can be used effectively to build or develop infrastructures keeping the notion minimization of cost. They are:
On-Demand Instances: It is the pay as you go classic EC2 instances, can be kept stopped when not using and there are different types of On-Demand instances available which are server resource specific. They are mostly used for running short term applications and which can be stopped unpredictably and restarted again.
Spot Instances: Instances which are unused Amazon EC2 computer capacity which is made available for users at a highly reduced rate. In order to buy an instance, customers are required to bid a price that they are willing to pay per hour. And they get this instance when an EC2 instance becomes available at or below that price they bid for. The instance will be cut off when the Spot price increases and exceeds the customer’s bid.As long as the customer doesn’t cancel his bid, the instance will be reactivated when the price falls again. Companies use these type of instances for their testing purposes.
Reserved Instances: Instance types (EC2, RDS, Redshift) which can be reserved and paid up-front for 1 or 3 years due to predictable computational usage. They are given out by AWS at a much-discounted price than the on-demand instances. So for infrastructures with predictable usage reserved instances can be used instead of On-demand ones as they reduce the total computational cost.
For the AWS storage services such as S3 and Glacier, the monthly cost decreases as more data are stored in them. So choose your static files like images, logs, HTML files, reports etc on S3 or Glacier (for infrequent access) rather than your EBS volumes as it costs less. You can still reduce the storage cost in S3 by choosing the Reduced Redundancy option at the cost of reduced level of redundancy than the standard model, so storeless critical or easily reproducible data here. And the best feature is that the data transfer in is free in S3.
AWS Tools and Services for Cost Analyzing
There are some services made available by AWS in order to analyze an existing architecture or to understand the costing structure of the architecture you are about to build that can provide a layout of how you can reduce the bills. Some of them are:
Consolidated Billing: For a large organization having multiple AWS accounts probably in different regions for different departments AWS allows to consolidate all the bills under one account. The major advantage of this is that AWS combines usage from all the accounts to qualify the company for volume pricing discounts ie, the AWS policy of pay less for how much you store more comes into action.
AWS Trusted Adviser: With business level support the tool trusted adviser is available that helps you in analyzing an organization’s existing architecture and constantly notifies users with unused or wasted resources, old snapshots , space issues, security loopholes etc. In turn Trusted Adviser helps you reduce your monthly billing effectively.
Cloudwatch Billing Metric: AWS has introduced a billing metric in AWS Cloudwatch where it notifies you with an alarm if the billing estimate configured is exceeded. This way you can be notified early of any unexpected spike in usage probably due to any misused resource or because of a security mishap.
AWS Cost Calculator: AWS cost calculator helps you to calculate monthly bills when provided with AWS components you use into the calculator template. Click below to calculate bills.
To sum up the topic one must always keep in mind the fundamental principles of AWS pricing principles and recursively analyze reports from tools such as Trusted Adviser for a cost optimized AWS environment.