AWS is the world’s leading cloud computing platform, providing a wide range of services including computer computing, storage, networking, and platform as a service (PaaS).
AWS cost optimization requires identifying areas for cost-saving measures, tracking your usage, and putting advice into practice. Your Amazon costs are largely influenced by the cost of EC2 instances provided by the Elastic Compute Cloud (EC2).
We can reduce costs across our Amazon account by switching instances from on-demand pricing to lower-cost spot instances or reserved instances, or by applying savings plans. Many optimization strategies involve reducing the cost of EC2 instances.
We can save more costs by selecting the right purchase model while launching servers.
1. On-Demand Instances:
- Pay for computing capacity by the second with no long-term commitments
- Spiky workloads to define needs
2. Reserved Instances (Ris):
- Make a 1 or 3-year commitment and receive a significant discount on On-Demand prices
- Committed and steady-state usage
3. Savings Plans:
- Same great discounts as Amazon EC2 Rls with more flexibility
- Flexible access to compute
4. Spot Instances:
- Spare Amazon EC2 capacity at savings of up to 90% on On-Demand prices
- Fault-tolerant, flexible, stateless workloads
Typically, most of us use serverless models for software development and automation. AWS Lambda is a renowned service for serverless models. For this reason, optimizing Lambda functions is also more important for cost savings.
Optimizing AWS Lambda Functions
Cost Factors:
- Number of executions
- Duration and memory used (combined as GB-seconds )
- Data transfer
Optimization Techniques:
- Choose the correct memory allocation
- Validate function size using AWS Lambda Power Tuning
Storage optimization: Amazon S3 storage classes:
Another commonly used service in AWS is S3 for storing data. So, we can segregate data stored in S3 buckets into different classes based on access patterns to save some cost.
S3 provides some of the storage classes where we can store data based on how quickly and regularly, we want to access that data.
Amazon S3 Standard:
- Active, frequently accessed data
- Milliseconds access
Amazon S3 Intelligent Tiering:
- Data with changing access patterns
- Milliseconds access
Amazon S3 Standard-IA:
- Infrequently accessed
- Milliseconds access
Amazon S3 One Zone-IA:
- Re-creatable, less accessed
- Milliseconds access
Amazon S3 Glacier:
- Archive data
- Select minutes or hours
Amazon S3 Glacier Deep Archive:
- Archive data
- Select 12 or 48 hours
General purpose SSD volume recommended for most workloads: gp3
EBS is the most common block storage we use while launching servers. By selecting the proper EBS volume type, we can also save some costs without compromising performance.
Some advantages of selecting gp3 over gp2.
- Ideal for relational and non-relational databases, enterprise applications, containerized workloads, big data, file systems, media workflows
- 3,000 baseline IOPS (versus 3 IOPS/GiB in gp2) and 1,000 MiB/s (versus 250 MiB/s in gp2); provision throughput and IOPS separately from capacity
- Up to 20% lower storage price than previous gp2 volumes
AWS also provides many services for monitoring and reducing costs, so in this section, we will look at some important AWS services for cost optimization.
- AWS-provided solution
- Custom start & stop schedules
- Works with Amazon EC2 & Amazon RDS instances
- Deploy using AWS CloudFormation
- Selectively tag instances to schedule
- Multiple schedules per instance
- 5-minute granularity
- Delivers recommendations for selected types of Amazon EC2 instances, Amazon EC2 AWS AutoScaling groups, Amazon EBS volumes, and AWS Lambda functions.
- Lower costs and improve workload performance
- Applies insights from millions of workloads to make recommendations
- Saves time comparing and selecting optimal resources for your workload
- Identify further cost savings recommendations by identifying
- Underutilized Amazon EC2 Instances
- Underutilized Amazon EBS Volumes
- Idle Amazon RDS Instances
- Idle Elastic Load Balancing (ELB)
- Model your solutions
- See the math behind the pricing
- Find instances to match your needs
- Model your solutions
- See the math behind the pricing
- Find instances to match your needs
- Save and share estimates
- Export to .CSV
5. Forecasting with AWS Cost Explorer
Plan for future spending
- Increased forecasting accuracy to plan with more confidence
Customize your forecasts
- Use filters to forecast costs along specific usage dimensions
Programmatic access
- Forecasting also available via API
6. AWS Budgets
Customizable budgets:
- Set custom budgets for cost and usage thresholds
- Set utilization and coverage targets for your Reserved Instances and Savings Plans
Ongoing monitoring and alerting
- Receive regular budget reports
- Be alerted when cost and usage exceed (or are forecasted to exceed) the budgeted amount
Flexible automation
- Execute actions when a budget exceeds its threshold (actual or forecasted amounts)