Cloud costs - areas, problems and solutions
Karolina Boboli
Cloud Architect & Consultant | AWS Community Hero | Entrepreneur
Part 1
No matter why and how we use cloud, there is one aspect that is present from the very beginning: cloud costs - sometimes as the very reason of using the cloud, but always as inevitable usage result. Let's explore the topic - in a series of articles.
Benefits and traps
Let's start with potential benefits. In contrast to the on-premise solutions, in cloud you pay only for what you use. Using cloud infrastructure offers much greater flexibility - it is relatively easy to adjust your infrastructure to your current needs. What is more, a great part of these adjustments can be automated. Still, after using the cloud for some time or reading other's cloud journey stories, it is easy to notice that cloud costs may get out of control - resulting in unexpected, high bills to pay and disappointment. Therefore it is crucial to understand cloud costs and to build cloud systems that are cost-efficient.
Cost-efficient cloud systems
What is the cost-efficient cloud system? It fully utilises cloud resources, it meets functional and non-functional requirements and it provides desired results at the lowest possible costs. This can be achieved by:
Let's explore areas to pay attention to and some examples of problems architects and cloud engineers encounter while building cost-efficient systems.
Note: Cloud-cost related problems and recommendations are usually cloud-agnostic. However, as I specialise in AWS, some technical examples or solutions in this article will be AWS-specific.
Using cost-effective resources
Problem: Design for cost effectiveness
What should we consider when we design applications to save on cloud resources later on?
Solution: Design and develop your applications having cloud costs in mind
Here are some areas to pay attention on:?
Problem: Resource rightsizing
?How to ensure that our resources are right-sized? In the initial phase of systems design it is difficult to guess the optimal size
Solution: Rightsizing in iterations
Rightsizing of cloud resources is an iterative process. Make assumptions, design and deploy infrastructure. Monitor most important metrics related to your resources. Review your assumptions on a regular basis and adjust your resources accordingly.
Problem: Costs of managed services and serverless solutions vs. costs of instances
?Prices of managed services and serverless solutions are higher than prices of virtual instances.
Solution: Consider total cost of ownership
Have in mind the total cost of ownership of resources types - not only the actual costs of resources usage, but also the cost of maintenance, manpower etc. Have in mind that many serverless solutions allow avoiding unnecessary software development, as systems are built from ready building blocks.
Matching Supply & Demand
?
Problem: On-demand vs. provisioned resources
There are several purchases options for virtual instances and many services that use these instances. How can we choose appropriate ones?
领英推荐
Solution: Explore purchasing options and use cloud tools to generate recommendations.
For instance, AWS offers several purchasing options for EC2 instances (virtual machines):
On-demand: flat-rate payment, without long-term commitments. This option is recommended for systems with short-term workloads, where usage spikes periodically or unpredictable workloads that cannot be interrupted. It is also suitable for test and development environments
Spot instances: allow to use spare EC2 instances up to 90% cheaper that on-demand. Suitable for batch processing, scientific research, video processing or any other area where workloads can be interrupted at any time and resumed later on. Spot instances are available for Amazon ECS Fargate, Amazon SageMaker or Amazon EMR
Reserved instances/capacity: this option allows to reserve & purchase computing resources in-advance, with discount and with commitment for 1 or 3 years. You may pay for reservations upfront (partially or fully) or each month and choose between Standard and Convertible type. Reserved instances are suitable for predictable, production workloads. Reserved instances are available for EC2, RDS, Redshift, ElastiCache and ElasticSearch.
EC2 fleet: in this case you define a target compute capacity, specify instance types and balance On-Demand, Reserved and Spot instances.
Saving Plans: Available for EC2 instances, AWS Fargate and AWS Lambda - this solution combines reserved instances / capacities with on-demand options. Any usage beyond declared commitment is charged at on demand pricing.
On-demand vs. provisioned options for other AWS services:
DynamoDB: choose between provisioned read and write capacity and on-demand options
Amazon Aurora: choose between serverless and provisioned instances.
AWS Lambda: choose between provisioned concurrency and on-demand option
?
Problem: Automatic match of supply and demand
Manual resizing of resources would be ineffective. How can we automate match supply and demand?
Solution: Autoscaling
Use auto scaling for EC2 instances, ECS containers, DynamoDB read and write capacity units or RDS storage. Serverless solutions scale automatically - with minimal or without any additional configuration. Note: not all serverless solutions scale to 0 - pay attention to avoid costly surprises.
Problem: Costs of resources that are not used 24/7
Some of our applications and environments (for instance: test and development environments) are used only during known business hours. We do not want to incur costs of cloud resources that are not actively used or do not bring business value
Solution: Switching on an off based in schedule
Schedule switching on and off resources. This can be achieved using scheduled autoscaling or - if your infrastructure is defined as code - by creating, tearing down and re-creating infrastructure based on a defined schedule
?
Problem: Unused resources that generate cloud costs
?Even in the best designed environments there are abandoned or unused resources that generate unnecessary costs. This is especially common in test and development environments.
Solution: Regular resource clean-up
Identify unused resources on a regular basis using AWS Trust Advisor or scripts using AWS API calls. Remove old backups or snapshots. Identify unused EBS volumes, create snapshots and then delete the volumes.
?
Problem: Underused resources
?Overprovisioning of resources results in unnecessary costs. How can we avoid this?
Solution: Resource monitoring
Identify underused resources on a regular basis using resource metrics. Use autoscaling to automatically match resource usage and demand. Examples: Identify low-utilization resources and reduce their costs by stopping (Amazon RDS) or pausing
Stay tuned for the following articles: I will explore areas like: building cloud costs awareness, how cloud security and cloud costs are related and optimizing cloud resources over time. If you are particularly interested in any cloud-cost related topic - let me know - I will gladly share my knowledge and experience.
Cloud DevOps | Xebia PL AWS Guild Master
2 个月Thank you for pointing this out. You motivated me to take a look at Trusted Advisor. I found it to be a great tool, right alongside AWS Pricing Calculator https://calculator.aws/#/.
Cloud Architect & Consultant | AWS Community Hero | Entrepreneur
2 个月What are the other aspects of cloud costs you would like to read about? DM or leave a comment :)