Software Engineering

Introducing mlstacks: a refreshed way to deploy MLOps infrastructure

Alex Strick van Linschoten
Sep 1, 2023
3 Mins Read
Contents

Last updated: September 1, 2023

We're excited to launch the new mlstacks Python package. MLStacks builds on the work done to create Stack Recipes, allowing you to quickly spin up MLOps infrastructure using Terraform. It is designed to be used with ZenML, but can be used with any MLOps tool or platform.

You can use mlstacks directly as a Python package, deploying infrastructure with the CLI after defining your stacks in YAML. Alternatively, you can let ZenML handle writing the stack and component specification files by using the ZenML CLI to define which components you want to deploy. We currently support modular MLOps stacks on AWS, GCP and K3D (for local use).

We reworked the previous way of doing things to be more stable and reliable. We even added new features like the ability to get a cost estimate for your MLOps stacks.

We were inspired by the work done by the FuzzyLabs team on Matcha as well as by conversations with users of the old mlops-stacks repository / functionality. In that spirit, MLStacks is also designed to be able to work as a standalone deployment option independent of ZenML. All of this is available in the new mlstacks Python package and with ZenML's latest release (0.44.1).

How can I try it out?

To use mlstacks directly you'll want to create .yaml files to define your stack and the individual components in your stack. (Examples of how to do this can be found in the dedicated mlstacks documentation site.)

Using mlstacks with ZenML is easier as you aren't required to define your stacks and components in .yaml files; ZenML handles all of that for you. As a quick example, you can run:

zenml stack deploy -p gcp -a -n
my_mlstacks_stack -r us-east1 -t env=dev -x 
bucket_name=my-new-bucket -x project_id=zenml

This would deploy a stack to GCP that has an artifact store created for you in the us-east1 region. It will also import that stack (with the name my_mlstacks_stack) into ZenML ready for you to use.

Most of the examples shown here are fairly simple as they allow you to try things out without needing to wait for too long or to incur significant cloud costs, but you're encouraged to try it out for stacks that suit your needs!

How it works

MLStacks works by taking stack and component specification files and parsing them into Terraform files which are in turn deployed to your cloud (or local, in the case of k3d) infrastructure. Our Python package will validate your specification files to ensure that you're not using invalid or unsupported combinations of components.

If you find something that we don't yet support but that you need for your work, we encourage you to contribute to the project!

When using mlstacks through ZenML, you don't have to do the work of writing the stack specification .yaml files. You simply need to compose the CLI command that specifies which components you need in your stack.

We're working to provide other (easier) ways to deploy your infrastructure using ZenML but for now CLI deployments offer all the flexibility of the mlstacks package without the need to write your own stack and component specifications!

Try it out!

We encourage you to try out mlstacks and to deploy MLOps stacks, either through ZenML or by writing your own stack specifications. Full guides for both options are available in our documentation:

  • To spin up infrastructure using ZenML, start with our introduction to deploying individual stack components via the CLI
  • To try out mlstacks directly and see how easy it is to specify your stacks using the .yaml specification files, check out one of our QuickStart guides appropriate to your favorite cloud platform (or use the k3d guide to test deployment locally)

We'd love to hear your feedback, good and bad! Please let us know how you got on with mlstacks in Slack. Happy deploying!

Looking to Get Ahead in MLOps & LLMOps?

Subscribe to the ZenML newsletter and receive regular product updates, tutorials, examples, and more articles like this one.
We care about your data in our privacy policy.