12.04.2021 - Read in 3 min.
How to reduce the cost of microservices in the cloud?
12.04.2021 - Read in 3 min.
If you’ve been wondering how to cut costs related to microservices in the cloud and how containerisation as well as ECS may help you achieve it, our article is a must read for you. Who knows, maybe making a few initial, even fractional changes, will save you between a few hundred and a few thousand dollars on cloud solutions.
Miscroservices tempt us with efficiency and low failure frequency. If you want to know when to choose them, what they will require, and what the transition looks like, read our latest free e-book titled Microservices vs. Monolith:
When developing your own product it’s worth to consider cutting environment-related costs. What solutions you’ll be able to choose depends directly on the industry or technology. Here are a few possibilities of organising development environments in AWS:
- Machine for each service – often a first and not always a good choice (final budget might eventually exceed the project).
- Elastic Beanstalk – multicontainer environments – this solution offers a possibility of significantly reducing costs thanks to containerisation (all services are launched in containers in the EC2 machine; the solution is expensive when you scale only some of microservices, as launching a new EC2 instance becomes necessary).
- ECS – Elastic Container Service – this option offers many more possibilities than Beanstalk, as it enables to use all leased EC2 resources by scaling each service individually.
Learn more about ECS Elastic Container Service
Available for free and relatively user-friendly, this Docker containers orchestrator can be operated via AWS and CLI consoles or by means of a dedicated API. ECS helps to operate containers (Tasks), which are part of the Service.
It independently decides which Tasks of the EC2 instance of a cluster to launch, allowing users to better allocate their resources and reduce costs.
You can learn more here:
With these tricks we’ve managed to decrease costs of maintaining environments by fourfold
- Auto Scaling to zero – start saving
Automatic scaling of services will not prove effective in the case of trial environments (there’s no need to allocate more resources). How and why decrease them to zero? For instance in the afternoon, when everyone finishes their work and EC2 is still running. ECS has been fitted with a feature called scheduled scaling allowing the user to set up their own scaling schedule according to predictable load, thus eliminating additional costs when EC2 is not used. To create a scheduled action for an Auto Scaling group, just open the Amazon EC2 Auto Scaling console and define the settings accordingly.
EC2 — Spot instances – a cheaper, yet risky solution
Launch Configuration enables the user to define which EC2 instances will be launched for their group (Auto Scaling Group). How to benefit and save? By using Spot instances – they’re much cheaper and riskier, as the user runs the risk of losing access to an acquired instance. In DEV and RC environments these instances are not a priority; they can be set up as preferred, allowing the user to decrease the cost of an EC2 instance by up to 90% for all microservices in trial environments.
RDS – one instance for multiple bases
RDS is another resources-based service. Establishing many data based on one RDS instance will help you further cut costs. All services should define access to data bases in external settings (Parameter Store AWS or environmental variables).
To find out more read:
RST Software Masters – AWS Select Consulting Partner with many years of experience in building microservices. We combine our expertise in the field of business process automation and robotisation with over 20 years of experience in creating highly scalable cloud software.
Download free whitepaper and learn more
Microservices or monolith