The cost optimization pillar focuses on avoiding unnecessary costs. The idea is to get the most out of your AWS environment while paying the least for the services that you are using.
Below are some design principles and tools that you can use for cost-effectiveness on AWS.
APPROPRIATE PROVISIONING AND RIGHT SIZING
Provision minimal resources and monitor the usage – Measure your system needs then calculate the requirements they have and then provision only the minimal resources to meet these requirements. Then monitor the usage to determine if you need to scale up or down.
To provision the resources, you can use the AWS management console, AWS CLI or AWS SDKs. To monitor all the different metrics that come into your system you can use Amazon CloudWatch. This will help you to determine whether or not your resources are being used to the capacity that you expect. You can create alarms that will be triggered when your resources are being underutilized or over-utilized then you can adjust the sizing accordingly.
You can also use the AWS Trusted Advisor which is a service that will go through your existing resources and determine if there are things you can do to optimize them
There are a number of purchasing options that you have access to in AWS:
- On demand – Ideal for short term and unpredictable workloads. Should be used for dev and test environments due to the short lived requirement nature of these environments.
- Spot Instances – These are unused EC2 instances that are available for less than the on-demand instances price. They are perfect for interruptible tasks such as testing, data and video processing.
- Reserved Capacity – Committing to a certain level of usage and then reducing your costs because of that commitment.
When you are working with geographical locations and optimizing costs with it, it is important to understand the concept of regions and availability zones and how they can be used to optimize costs.
You can optimize for latency by deploying your applications in regions closest to the end users.
There could also be regional price differences for AWS services. If you have to do a lot of computing but it doesn’t matter where it happens then you can pick a region where the compute capacity is cheapest.
AWS edge location services like Amazon CloudFront and Amazon Route 53 can also be used by using CloudFront caching Route53 latency-based routing. This not only improves user experience but also optimizes costs because the distance and the amount of data we have to transfer is reduced.
These are services that take on some of the responsibility for specific processes and functions. They take care of your different infrastructure needs saving you the operational overhead of having to do it all thus saving you money.
Examples of AWS managed services include AWS lambda for compute, Amazon S3 for object storage, Amazon RDS/Aurora serverless for SQL databases, Amazon DynamoDB for NoSQL databases, Simple Queue Service (SQS) for message queuing, and Simple Notification Service (SNS) for push-based notifications.
SUPPLY AND DESIGN PATTERN – ELASTICITY
You can use demand-based patterns to avoid over-provisioning your resources.
Elasticity is the ability to increase or decrease infrastructure resources automatically to meet technical requirements and maximize the use of those resources. This ensures that you only pay for what you need in order to support your application requirements.
AWS elasticity tools include:
Auto-Scaling Groups – You are able to group your EC2 instances together and scale them accordingly in order to meet your capacity requirements.
Elastic Load Balancers – You use ELBs to load-balance traffic between different EC2 instances inside of an auto-scaling group.
ANALYZING AND TRACKING YOUR CLOUD SPEND
Below are some of the ways you can track and visualize your cloud spending:
Estimate and forecast cost usage – Create alerts for budget thresholds. Configure email alerts based on forecasted or actual spending limits.
Analyze and visualize current/forecasted spend by AWS service, resource tags or period and determine potential areas for optimization based on current spend.
OPTIMIZING COSTS OVER TIME
To keep optimizing AWS costs over time, you first need someone to focus or “own” cost optimization. Then use goals and metrics to measure progress. These can be things like increasing reserved instance coverage for instances that you are going to be using for a long period of time. You can also ensure that a good percentage of your on-demand instances are turned off each day
Also take advantage of the latest AWS trends to optimize your costs. AWS are constantly coming up with new features and services which more often than not are usually cheaper.