Emulate IoT hardware in the Cloud with balenaVirt and Amazon Machine Images (AMI)

Emulate IoT hardware in the Cloud with balenaVirt- Amazon Machine Images (AMI) and balena.

Amazon Machine Images (AMI) are now available for virtualizing hardware on AWS, and balenaVirt for simple setup on Digital Ocean.

As developers, we all value the ability to iterate on our products quickly. Quicker development times leads to quicker time to market, and quicker implementation of features and fixes for customers. Yet IoT poses a particular challenge for developers. We seek to mimic as closely as possible our production environments while requiring higher performance than is often available on our IoT devices.

Enter virtualization. Virtualization allows us to run balenaOS on a virtual device, removing the need for physical hardware, allowing us to scale the performance of the hardware to speed up our development and testing times, or scale down the performance to test the limitations of our code. Virtualization provides a middle ground between our local development environments and our on-device environments, delivering a number of benefits:

Virtualization vs local development environments

  • Allows replicating balenaOS for interaction with the Supervisor and balenaCloud
  • Allows use of balena tools such as the balena CLI and balenaCloud
  • Allows scaling or limiting of the resources available
  • Replicates the balenaOS kernel and operating environment to better reflect the production environment

Virtualization vs on-device development environments

  • Ability to scale resources to suit the development needs
  • Faster write speeds than SD card based devices
  • Ability to run multiple development environments and scenarios simultaneously without the need for multiple units of expensive hardware

We wanted to go a step further. Building virtual environments can be particularly complicated. They vary depending on the platform your developers are working on (MacOS, Apple Silicon, Windows, Linux), often entails installation of third-party software and requires complicated and time consuming setups. That’s why we now enable virtualization of balenaOS on cloud-based services like Digital Ocean and AWS:

Cloud-based virtualization

  • All the same performance benefits and ability to replicate the balenaOS environment as above
  • Predictable environments for running QEMU prevent breaking changes to setups and serve developers on whichever platform they choose to use (Windows, Mac, Linux, etc.).
  • Ability to assign even more resources to build environments. 8 CPUs? 32GB of RAM? No problem.
  • Scale up and down the number of test devices you need, paying only for what you use
  • Allows an always-on or on demand solution for integration with automated testing environments
  • Create large fleets of devices for development and testing without the need for expensive hardware
  • Hardware acceleration to provide near-native performance using KVM
  • Start a device for as little as $0.006 USD per hour (example based on Digital Ocean Droplets)

There will always be limitations to what virtualization can offer – namely the ability to effectively virtualise interfaces, which will require hardware testing at the end of our development workflow. Yet we can see how cloud-based virtualization can significantly improve our development workflows by providing a higher performing and flexible development environment that moves us through our development stages with ease and speed.

It wouldn’t be a balena product unless it was as frictionless as humanly possible. That’s why we now provide Amazon Machine Images (AMI) for virtualizing hardware on AWS, and balenaVirt for simple setup on Digital Ocean.

We would love to hear what you think. As another balena open source project, we would also love to see your contributions as we continue to explore virtualization.


Posted

in

Tags: