DEV Community

Hana Khelifa for Scaleway

Posted on • Updated on

Moving your infra to the cloud - best practices

Moving to the cloud has its well known advantages... But it is easier said than done. So here are a few best practices to design your migration plan.

Redesigning the legacy

The first thing to do is separating your existing infrastructure in three: the front, the back, and your database. Understanding where you come from and what kind of legacy you are dealing with is crucial. There are basically two types of legacies:

The made from scratch infrastructure

You didn’t automate the deployment of your OS and your applications back then. So today your priority will be to understand it back. Tools exists to c/p the content of your server from your server from another, but you can also retro engineering it.

The automated infrastructure

When you already automated your infrastructures (with scripts to install web servers, databases, etc.), a server is a server. So you would be able to just reinstall what they had because they had the script.
This migration will not require too much energy or money but you won’t be able to enjoy what the cloud has to offer if you simply rehost.

Now that you understand where to start, let’s see what your options are.

Main migration strategies

Rehosting

Rehosting is cost-effective, needs no code change and no architecture change. It has little to no impact: you move the application into the cloud as is. It won't allow you to take full advantage of what the cloud has to offer though.

In some cases, it could be a good alternative if you need to migrate quickly, but don't stop your migration at this point.

Replatforming

Replatforming is pretty similar to rehosting applications on the cloud but you will need to make a few modifications on the app to enjoy cloud functionalities.
The modifications will mostly impact the configuration or the way the application scales, by partly automating your process.

Refactoring

This is when you update your applications’ architectures and alter them in depth. Refactoring is the most complex cloud migration strategy. You may have to make deep changes to your code and architecture, rebuild your deployment pipeline, and carefully test your applications to avoid regressions.

But you will be able to take full advantage of the cloud services (Serverless, Managed Kubernetes), microservices, infrastructure-as-code, containerization and cost optimization.

Cheat Sheet on migration strategies

Replatform best practices

Stop wasting your time scaling your application by yourself, let the infrastructure do it for you.

Infrastructure-as-code (IaC)

Using IaC tools like Terraform enables you to develop faster, deploy in a more reliable way, while ensuring quality.

Version control is an important part of IaC. Since they are files, they can and should be managed by a source control system like any other software source code.

For instance, Terraform is an open-source tool which deploys your infra with an added layer of abstraction.

Deploy or redeploy your code

Instead of deploying your code yourself, and handling all the constraints - such as finding the right time to do it, warning teams and clients, etc. - you can automate the chain of deployment of your application.
By automating the packaging, the tests, and the deployment, you’ll be able to deploy in a quick & reproducible way on different environments (test, dev, prod, etc.).

CI/CD practices will help define processes for a quicker iteration, reducing the margin for human error. You will be able to allocate your spare time to your critical tasks.

meme

What benefits can I get from the cloud now?

Moving your app to the cloud is a great step to start optimizing your infrastructure with cloud products. With a whole new world ahead, and spare time now that you don’t have to maintain your VM yourself, here are a few ideas on what you could do.

Managed services

Focus on your product and let your cloud provider handle the rest.

If you sell chairs online, why bother with self-managed databases when you could let your cloud provider manage your databases, do the hard work, and let you focus on your mission.

Application scaling

The main advantage of the cloud is that it makes your application more flexible and scalable. You can directly use products to do so - such as Kubernetes, which allows auto-scale, or Serverless, which can scale from zero to many. Or you can design your application in a way that will make it easy to use the right amount of resources placed where you need it.

Cost

Cloud products allow you to only consume and pay for the resources you need so your billing is as optimized as possible.

Happy engineer team

You’ll be able to help your engineering team focus more on your product and optimize your application. Enjoy better security, availability, and free your time to focus on tasks that bring more value to your users.

Is a migration worth it?

While moving to the cloud will require time, money, and training, it will pay off in the future - it is an investment for the future.
Now you have all the tools to find a strategy that is right for you. Also know that it can be done one step at a time. And if you have questions about your migration, you can reach out to us at Scaleway.

The content of this article has first been published on Scaleway's blog.

Top comments (0)