The AWS cost optimisation pillar is concerned with effectively architecting systems at a minimal cost.
By following best practice you can effectively control your AWS costs by:
- Right-sizing services to meet capacity needs at the lowest cost
- Saving money when you reserve instances
- Using the spot market to save further
- Monitoring and tracking service usage
- Using Cost Explorer to optimise savings further
Tags and Cost Explorer
- To make sure you know which projects or teams are using resources, use the Tag Manager.
- Once this is set up you can use the Cost Explorer to check in on daily, monthly, and forecasted spend using filters for tags, service type and accounts.
- Periodically review what you are running and if you need it.
- Trusted Advisor gives suggestions on cost optimisation, performance, fault tolerance, service limits and security optimisations. Run it quarterly to see what can be improved.
S3 and Lifecycle Management
- Each storage option comes with its trade-offs of availability v cost.
- Use the Lifecycle Management to move data between storage classes as it becomes ‘warm’ and eventually ‘cold’ when it can be archived with Glacier or deleted entirely.
- S3 Intelligent Tiering does this automatically when access patterns change, and is ideal for data with unknown or changing access patterns.
There are four ways to pay for EC2 instances:
- Dedicated hosts – physical servers dedicated for your use.
Use cases: Bring existing licenses with you or meet regulatory requirements to be on a physical server that is dedicated for your use.
- On-Demand – capacity per hour or per second.
Use cases: Applications with short-term or unpredictable workloads that cannot be interrupted.
Cost: Low cost and flexible.
- Reserved Instances – provide a reservation to launch instances when you need them.
Use cases: Applications with steady state usage
Cost: 75% off the On-Demand price, prepay to lock in the lowest possible price.
- Spot Instances – request spare capacity for
Use cases: Applications that have flexible start and end times.
Cost: Up to 90% off the On-Demand price.
- Use the ‘standard’ configuration when setting up to make sure you aren’t overpaying by changing what is in the default settings.
- Check to see if you have ‘Provisioned IOPs’ enabled when setting up as this comes with an additional cost. You may simply need General Purpose.
- AWS supports the m family for general use, the r family, and t2 instance for burstable compute. Monitor your instance to make sure you have the right size and type.
- Database instances are charged by the hour. Schedule start and stop times if the database is only used at certain times and consider Aurora Serverless for even more flexibility
- When migrating data the cost for Data IN and between AZs is free, but data OUT incurs costs.
Optimising costs can be challenging, but by tracking usage through tags and using the tools provided by AWS to review what can be switched off or scaled-down this is much easier.