Migrating IoT infrastructure to AWS

Introduction

We have been contacted by the owner of an IoT company, which is developing and manufacturing IoT devices at a smaller scale for several years. The devices are used for fiscalisation of parking machines, game machines, vending machines, etc. 

The company has now taken on a couple of projects where both the need for manufacturing and the development of new features has significantly increased. They have hired a new developer to help with the development of the new features, but as soon as he saw the infrastructure on which the application is hosted he raised a concern.

He explained that, now that the development is nearly finished, they should explore the option of migrating their infrastructure to the cloud. Considering that this developer was already familiar with our work, because we already worked on one project together, he recommended our services.

Original infrastructure

Their old infrastructure looked like this:

Image 1. Infrastructure before migration to AWS.

and we explained that this kind of infrastructure is prone to hardware failure and with that they risk the following:

  • Data loss 
    • They didn’t have off site backups.
  • Power loss
    • Their server didn’t have a redundant power supply or UPS.
  • Potential money loss 
    • If they had to pay for the damages to the client if the service is not available and the fiscalisation is not working.
  • Potential loss of current and future clients
    • If their service was unreliable.

As soon as we explained the potential risks of having their application and a database on a single, bare metal, server without redundancy they decided that migration to the cloud is the right choice.

Migration to the AWS

Although we recommended a different setup, that would cost a bit more, the most important thing for this migration, to the company, was to keep the monthly infrastructure cost the same as it was for the original, bare metal, server.

Their developer had the microservice infrastructure in mind during the development, so it was fairly easy to separate the main components to separate servers. The application was split between the:

  • Frontend server – which hosts the application’s web frontend,
  • Backend server – which hosts the application’s api to which the IoT devices connect to,
  • RDS (AWS Relational Database Service) – which hosts the database.  

Image 2. New infrastructure hosted on AWS

Cost of the new AWS infrastructure

Production environment

Considering the tight budget for the infrastructure, we created the instances of following sizes: 

  • Frontend t3a.small + 30GB EBS = $20/month
  • Backend t3a.medium + 30GB EBS = $35/month
  • DB db.t3.medium + 20GB EBS = $62/month

With some small cost for the Route53 for the DNS service, the entire cost of their new production cloud infrastructure sums up to just under $120/month

Development environment

Considering that we are trying to stay within the budget, and that the development environment is used for functional testing, the servers for the development environment are the smallest EC2 and RDS instances available. 

  • Frontend t3a.nano + 30GB EBS = $8/month
  • Backend t3a.nano + 30GB EBS = $8/month
  • DB db.t2.small + 20GB EBS = $32/month

Which would sum up to just under $50/month if it was running the entire month. But considering that on AWS you only pay for what you use, we have created scripts that turn on or off the entire environment. In addition to these scripts we have created a simple fronted which the developer can access using the URL that we have provided. There are only two links, one to start the entire DEV environment when they need to use it, and another to stop the DEV environment in order to save money when they are done.  

All Instances were created in the eu-central-1 region, to provide the best network performances, because it was closest to their clients.

Backup and recovery

We configured the AWS backup plan to create daily backups of EC2 instances. Backup retention period is 7 days. RDS instances are also backed up daily with the retention period of 7 days.

Monitoring

We offered additional monitoring (Zabbix) in order to provide proactive and reactive support. This already helped us identify some issues in early production stages.

Conclusion

Both the company and their development team are very happy with this setup. The company is happy because they pay the same monthly amount for the infrastructure while having their servers in the cloud, and their development team because they can now use all the benefits that AWS provides.