Cloud computing, part 1: costs
Cloud computing provides user computing resources and hostings with a payment based on factual usage. It allows you to forget about the need to maintain servers or data centers. Instead, you get access to IT services — computing tools, storage, and databases — that you can use thanks to the cloud services providers: Microsoft Azure, Amazon Web Services (AWS), and Google Cloud, to name a few.
Why are so many businesses moving to the cloud? There’s a whole scope of advantages to cloud computing.
With cloud technology, you get access to a multitude of options. You can use various databases, computing resources, and services. Deployment of IT services takes place within minutes, instead of hours, and that is how you can bring the ideas and solutions to life without needing to set up resources and use time-consuming preparations.
There is no need to allocate resources beforehand for cases of activity bursts. Instead, you can allocate just the necessary amount of resources for the period of time. In cloud infrastructure, resources could also be scaled, by maximizing or minimizing their volume, based on your exact business needs.
- Cost reduction
You pay just for the IT resources you use, which, in turn, facilitates understanding and forecasting of costs related to the maintenance of a business, platform, or app, including a cost-per-user calculation.
- Global accessibility
You can scale the business presence in new geographical regions and skyrocket the global expansion of your product or business.
What types of cloud services are there — IaaS vs PaaS vs SaaS?
IaaS (infrastructure as a service) offers low-level accessibility to computing resources, and to servers directly. These services usually possess the highest degree of flexibility and resource control but are higher in cost when it comes to setup and configuration. This type is most suitable for businesses and enterprises where the highest level of control over data and resources is required (i.e. fintech, medtech, etc.).
PaaS (platform as a service) offers access to a ready infrastructure with the serviced software. For instance, when you use a PaaS database, there is no need for you to service the server and follow the software updates closely. This type also provides you better access to reserve copies’ creation, replications, and restorations.
SaaS (software as a service) is the highest-level solution. Simply put, it is a ready product for the end-users or businesses, such as a mail server or a web analytics platform. Most typically, such solutions would have a program interface for integration and manipulations with the future product. You just need to decide on the preferred way you plan to use the SaaS solution.
How to maintain cloud services?
First things first: clear setup and correct configuration of cloud infrastructure are absolutely essential. Despite the fact that cloud service providers tend to simplify the setup constantly, create usage patterns, and publish guides and “how-tos”, the most effective way to configure a cloud platform is to let a professional do it.
What applications are suitable to be hosted on the Cloud?
Almost any. Regardless of the size of your product, you will get advantages in the aforementioned elasticity, flexibility, and cost-effectiveness. Perhaps the only exception would be certain governmental solutions, where physical access to data centers, and therefore, to data remains the highest priority.
Is AWS always so expensive?
Because the key advantage of cloud services is the ability to pay upon the fact of usage, the price depends on the correct configuration, but also — on the architecture of your IT solution. In other words, a badly configured solution can be expensive when it comes to maintenance, no matter the deployment method — both in cloud infrastructure or on a dedicated server. Also, there is a possibility to use the IaaS type where costs for the services can be planned in advance. So, the short answer would be: no, it is not expensive, but only when you know how to use it.
Let’s look at an example of a rather simple IT solution located in AWS infrastructure and using IaaS and PaaS services. Let’s say:
Our platform is an API that works in Docker space and uses one of the usual Django, Laravel, Rails or Express.js frameworks.
Let’s see the most typical IaaS solution where we rent a virtual server, set up a Docker environment, and allocate several containers:
- API (works with the HTTP commands)
- Database (stores the data)
- Message queue (intermediary between a processor and an API)
- Queue processor (service for delayed actions, such as processing or data analysis, scheduled tasks, etc.)
How much does this cost? Let’s drop possible practices of optimization, like advance payment of long-term server reservation, which can actually save us up to 40% of the server costs.
For the start, the virtual server with 2 vCPU and 2Gb RAM will suffice. Therefore, we can opt for t4g.small. In total:
Amazon EC2 (t4g.small) On-Demand instances (monthly): 14.02 USD Let’s imagine we decide on a yearly subscription. Amazon EC2 Instance Savings Plans instances (monthly): 8.83 USD
Together with Amazon Elastic Block Storage (EBS) — 30 Gb: 3.57 USD
We are getting 12.40–17.59 USD/month.
But what if your platform receives a higher load?
You could fairly say. Just a few clicks and we can change the type of the virtual server and get more resources! This is called Vertical scaling. If the configuration is right, and the architecture of the platform is appropriately built, you can do it automatically. Simply adjust the amount of the available resources — for instance, increase in peak hours and decrease at night.
If we want our platform to grow and develop, we can change its architecture. Let’s imagine that our server can still handle the API requests, but the database is overloaded and using way too much out of the server resources. Therefore, let’s include the PaaS database service — for example, AWS RDS — in our project. What are the advantages we are getting? Our database is now stored on an allocated server, which means that it has all the available service resources, is maintained by the AWS platform, and creates reserved copies on a regular basis. Besides, we can easily connect to the database directly, without loading the main server.
What are the costs? Amazon RDS PostgreSQL instances cost (monthly): 30.66 USD
Storage pricing (monthly): 4.11 USD = 34.77 USD/month
In case of a yearly subscription: 25.06 USD/month
Ok, what if just a part of our IT solution is needing more resources?
Let’s say the queue manager doesn’t handle a load of messages in the queue and we need to maximize the number of resources simply for the needs of data processing. In cases like this, cloud services provide us with even more options. For instance, in order to abolish the necessity of maintaining the software of the message queue and keeping an eye on the workload, we can use AWS SQS infrastructure.
1 million standard requests to the queue will cost us: 0.40 USD/month
Again, we only pay for what we use. So if there are 2 million requests, we pay 0.80 USD.
What if we go even further and imagine that we need to be ready for a 10x higher workload at any given moment, yet, we don’t want to provide the resources in advance. Maybe this is the right time to consider horizontal scaling. We let the AWS cloud balance the load of our IT solution and launch the number of API servers that are needed in the given moment — not less than one, and not more than 10. Let’s use AWS ALB (Application Load Balancer).
Application Load Balancer fixed hourly charges (monthly): 19.71 USD
Now, we can use fewer server resources, just by adding more servers as the workload grows.
But what if we don’t even need to program API, and our web and mobile app will simply use the Software as a service solution?..
Let’s keep this door open :) We will continue this topic soon.
Dmitry Isichko, Solution Architect & Technical Lead at Moqod