The cloud is virtually unavoidable today. For any software-based business, from large corporations to startups, the benefits of deploying your software to the cloud are hard to ignore. Choosing which platform to use can be an anxiety-inducing task that many teams ponder for days, weeks, or even months. A major source of this anxiety is the fear of getting locked into a specific cloud provider, as it can be a costly, difficult, and time-consuming process to switch to another provider.
A successful cloud migration preserves the sovereignty of code and its ability to run outside of the selected cloud platform. Throughout this article, we’ll explore development practices that will help you enjoy all the benefits of the modern cloud without becoming locked-in with your selected provider.
Containerize your projects
The first – and often most important – thing your team can do to stay cloud agnostic is containerize your application. There are several options for containerization services these days, each with its own strengths and weaknesses. Docker is typically the first solution developers reach for, and for good reason. Docker containers are a widely supported standard, and the technology isn’t going anywhere soon: Thousands of small and large businesses have made it an integral part of their process. Containerizing your solution ensures that your software will run on any platform, from the most advanced Kubernetes clusters to good old-fashioned bare metal, and even local developer environments.
Use a neutral CI/CD platform
Cloud platforms are infamous for creating environments which make it difficult to leave. This isn’t an accident, as AWS, Google Cloud Platform, Azure, etc. all want to inhibit your ability to switch to a competitor. The stickiness starts as early as the continuous integration and deployment pipeline. Many cloud platforms provide CI/CD features that are convenient to use. However, if you keep your build and deployment pipelines separate from your selected cloud provider, it makes it significantly easier to change the deployment destination for your code without having to change the pipeline itself. Using CI/CD features in products like GitHub, GitLab, and Bitbucket help decouple the code pipeline from the deployment target.
Decouple your code from the cloud provider
One of the most attractive aspects of many cloud platforms is the array of services they make available to developers. AWS and Azure, for example, offer logging repositories, blob storage, database instances, caching solutions, messaging queues and much more. Leveraging these services can make your cloud migration significantly more successful and often more cost effective. However, it is important to integrate with these services safely and in a way that preserves the independence of your application. At the code level, this can be accomplished by implementing abstractions of the SDK of your choice and accessing the functionality of the cloud service only through these abstractions. For instance, if you wanted to leverage AWS S3 in your software, you should first create the interface “IFileStorage,” which is implemented by a concrete class, “S3StorageService.” This concrete class should be the only place in your software that directly makes use of the S3 library. Your code would then reference the interface when it’s necessary to persist files to external storage.
The benefit of this practice is twofold:
- All cloud-specific logic is consolidated in a few files, lending confidence that you know exactly where any code changes must take place should you need to switch cloud providers.
- Your code is decoupled from the cloud provider you’ve selected. The selected service provider can change any time, and your code just keeps calling the interface.
At the end of the day, cloud migration proves to be both a challenge and an opportunity for development teams. Despite what some may say, there is no silver bullet when it comes to developing with these platforms in mind. There will always be dependencies, and developers will always need to find ways to manage them. While every project is different, the practices I’ve described here can help you take advantage of everything the cloud has to offer and keep your risk of vendor lock-in low while doing it.
Clayton Henderson is Senior Developer in 27Global’s Kansas City office. Founded in 2008, 27Global designs, builds and operates custom software solutions for businesses of all sizes. The perfect pairing of a local leadership with offshore pricing, 27Global has the business acumen to understand your vision and the expertise to build your software solution. To learn more, visit 27Global.com or connect with us on LinkedIn and Twitter.