AWS Cost Savings with minimal efforts (S1E1)
High Savings → Least Efforts → Zero Production Impact.
I want to emphasize that with this new series, our focus is not just on one-time “Cost Savings” but rather on continuous Cost Optimization, which is one of the key pillars in the AWS Well-Architected Framework. When designing infrastructure, we should always consider the cost optimization pillar. It’s common to see people designing and deploying infrastructure without initially considering the cost, only to realize later that it’s hitting their pockets. Implementing a “cost savings” initiative at that point is not the ideal approach. Cost optimization is an ongoing process that involves continuously reviewing the infrastructure and optimizing costs based on requirements. Remember, the golden rule is to “Pay only for what we are actually using” as. I remember one of the quotes i.e
“The true cost of the cloud lies not only in what you use but also in what you don’t use efficiently”
I don’t want to overwhelm you with a lengthy lecture, so let’s dive into the first post of the “AWS Cost Optimization” series. With a tradeoff between savings and efforts, This post will target — highlighting the easiest options with the highest impact.
So Grab a Coffee☕️ , sit back, and let’s start saving some bucks from your company’s pocket….!
Phase-1 Cost Optimization Options: (Minimal Efforts / High Savings)
Compute commitments — Reservation & Savings Plans
S3 Optimization - Lifecycle Rules for Retention & S3 Intelligent Tiering:
Let’s Cleanup — Identify & shutdown unused resources
EBS Optimization - Migrate EBS GP2 to GP3
Don’ t just skip the remaining blog after reading above options,
We’ve recently tackled a massive challenge with over a huge AWS Org. with 200+ AWS accounts. So, hang in there and get ready for some awesome AWS Tips in coming your way!
1. Compute commitments:
Here we are giving commitment to utilize specific resources in exchange for cost savings. With Savings Plans, you commit to a certain Amount of usage measured in $ per hour, while with Reserved Instances, you commit to Reserving specific instance capacity for a given term.
a) Reservation — EC2, RDS, Redshift, or Elastic Cache resources.
Note: Read and understand indepth about below mentioned reservations options before doing any reservations.
i). 1 Year vs 3 Yr Reservation
ii) NoUpfront vs Partial Upfront vs Full Upfront
iii) Standard vs Convertible reservation
iv) Regional vs Zonal Reserved instances
“3 Year + Full Upfront will give higher cost savings Opportunity but it will come with little bit risky condition also”
Reference to dig more:- https://docs.aws.amazon.com/whitepapers/latest/cost-optimization-reservation-models/reserved-instances-payment-options.html
b) Savings Plan
EC2 Savings Plan and Compute Savings Plan are two pricing options offered by Amazon Web Services (AWS) for optimizing costs in different usage scenarios. Here’s a brief comparison between the two:
i) EC2 Savings Plan:
Designed for EC2 instances, including EC2 Auto Scaling and AWS Fargate.
Provides a discounted hourly rate in exchange for a commitment to a specific instance family, region, and term length (1 or 3 years).
Offers flexibility in instance size, operating system, and tenancy within the chosen instance family.
Best suited for steady-state or predictable workloads with consistent instance utilization.
ii) Compute Savings Plan:
Covers a broader range of compute usage, including EC2 instances, Fargate, AWS Lambda, and AWS Batch.
Offers a discounted hourly rate based on the commitment to a specific dollar amount per hour, region, and term length (1 or 3 years).
Provides flexibility to apply the savings to different instance families, sizes, and instance types within the eligible compute services.
Ideal for variable or bursty workloads that leverage different AWS compute services.
Now, You know all about Reservations/Savings Plan — let's see how we can plan & Purchase this?
i.e we need to plan the total instances count / reservation upfront cost and estimate savings, correct? Manually doing all this things are increase the efforts here, AWS come as rescue here with reservation suggestion tools under AWS cost Management tools
AWS cost manangement → Reservations → Recommendations
AWS cost manangement → Savings Plan→ Recommendations
Implementation Tips::
1. Never Jump and do reservation unless you know all options and its limitation read aws documentaion and decide the perfect reservation options.2. Check with Application owners/respective team and make sure that we are not expecting any application architecture changes in those reserved instances (only reserve those instance which we are confident to keep to the commites periods otherwise it will backfire)
Q. Scenario- You have reserved instance for next 1 year but after 2 month aplication deprecated , what should you do now?
A. Sell this in AWS Market Place. (docs.aws.amazon.com/AWSEC2/latest/UserGuide..)
2. S3 Optimzation — Lifecycle Rules for Retention & S3 Intelligent Tiering:
I told you earlier you should always consider cost optimization during design stage :-) , but ya still not late just go through below chart and identify in which storage class should Ineed & compare with current storage class and just change it — if you dont have idea about object usage / retrival patterns or confuse then select “Intelligent Tiering”
(Ref- https://www.youtube.com/watch?v=MaLVbCLmoZM)
- S3 Lifecycle Rules for Retention / S3 Intelligent Tiering:
Optimize storage costs by automatically transitioning objects between different storage classes based on specified criteria.
Automate the transition process to simplify management.
Here, We cannot change the storage class at Bucket level but there is few option we can achive similar action with different methods —
S3 Transition Lifecycle Rules — https://docs.aws.amazon.com/AmazonS3/latest/userguide/lifecycle-transition-general-considerations.html
Implementation Tips:
o Use AWS S3 lens to analyse your S3 usage insights; this will helps to take a decisions sometime.AWS console → S3 → AWS S3 Lens
Ref:- aws.amazon.com/blogs/aws/s3-storage-lens
3. Let’s Cleanup — Identify the Idle resources & shutdown
a) Compute resources — EC2 Instances/RDS/Elastic cache/Redshift.
- Immediate cost savings by eliminating idle or underutilized instances.
b) Unattached EBS Volumes:
- Reduce storage costs by eliminating unused or unattached volumes.
for region in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text); do aws ec2 describe-volumes --query 'Volumes[?VolumeType==`gp2`]' --output table --region $region; done
c) Unattached Elastic IPs:
- Eliminate costs associated with unutilized Elastic IPs, identify the unassociated Elastic Ip and release it.
for region in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text); do aws ec2 describe-addresses --query 'Addresses[?AssociationId==null]' --output table --region $region; done
Implementation Tips:
o Use AWS Trusted Advisor to identify the idle resources
Reference: — docs.aws.amazon.com/awssupport/latest/user/..o Explore Opensource "cloud custodian" (this is a big topic to cover, we’ll write another specific article for “custodian deep-dive for cloud governance” )
Reference:- cloudcustodian.ioo Double check the dependency of the Elastic IP before releasing , once its released then it will assign back to AWS IP Pool in that case its not possible to get it back.
4. EBS Optimization - Migrate GP2 to GP3:
Enjoy easy savings of up to 20% by migrating GP2 EBS volumes to GP3 volumes without any impact in performance
Optimize IOPS and throughput for better performance.
Identify all EBS volume with GP2
for region in $(aws ec2 describe-regions - query 'Regions[].RegionName' - output text); do aws ec2 describe-volumes - query 'Volumes[?VolumeType==`gp2`]' - output table - region $region; done
Referenece:- https://aws.amazon.com/blogs/storage/migrate-your-amazon-ebs-volumes-from-gp2-to-gp3-and-save-up-to-20-on-costs/
Change EBS Volume type to GP2 (We can do it on the fly in single shot using aws cli loops, but still it is advisable to review first and execute this accordingly)
aws ec2 modify-volume - volume-type gp3 -volume-id vol-11111111111111111
✅ Congratulations on completing Phase 1 of your AWS cost optimization journey! By following these simple steps, you can achieve significant cost savings with minimal effort.
Remember, cost optimization is an ongoing proces so Stay tuned for [Phase 2] of Cost Optimization! 😉💡
We'll focus on High Savings → Medium Efforts → Medium Production Impact.
Teaser ✨
Phase-2: possibly include Right sizing strategies, Graviton migrations, Instance scheduler, spot instance startegy , lambda power tuning etc- (lots of Interesting stuff not like this article.
----------------------------------------------------------------------------------------
"Stay in the know! Subscribe to the blog for the latest insights on tech trends, DevOps and Cloud strategies, and more. 📚✨ #StayTuned
- Sitereliability.in