Skip to content

Quickstart

This guide walks you through installing mlflow-dynamodbstore, starting an MLflow server backed by DynamoDB, and running your first experiment.

Prerequisites

  • Python 3.11+
  • AWS credentials configured (aws configure or environment variables)
  • An S3 bucket for artifact storage
  • IAM permissions for DynamoDB and CloudFormation (the plugin auto-provisions the table)

Required IAM Permissions

The IAM principal running the server needs:

  • dynamodb:* on the table resource
  • cloudformation:CreateStack, cloudformation:DescribeStacks, cloudformation:UpdateStack
  • s3:* on the artifact bucket (for MLflow artifact operations)

Installation

uv pip install mlflow-dynamodbstore

This installs the plugin along with MLflow and its dependencies.

Start the Server

export MLFLOW_FLASK_SERVER_SECRET_KEY=$(python -c "import secrets; print(secrets.token_hex(32))")

mlflow server \
  --app-name dynamodb-auth \
  --backend-store-uri dynamodb://us-east-1/my-table \
  --default-artifact-root s3://my-bucket/mlflow-artifacts \
  --enable-workspaces \
  --host 0.0.0.0 \
  --port 5000

Secret Key Required

MLflow 3.x requires MLFLOW_FLASK_SERVER_SECRET_KEY for CSRF protection when using auth plugins. Set it to a static value across all server instances. In production, store this in AWS Secrets Manager or a similar service.

On first startup, the plugin creates a CloudFormation stack named mlflow-dynamodbstore-my-table that provisions:

  • A DynamoDB table with 5 GSIs and 5 LSIs
  • DynamoDB TTL enabled on the ttl attribute
  • Pay-per-request billing mode

First Startup

The first startup may take 1-2 minutes while CloudFormation creates the DynamoDB table with all 5 GSIs and 5 LSIs.

Local Development

For local development with DynamoDB Local:

export MLFLOW_FLASK_SERVER_SECRET_KEY="dev-secret-key"

mlflow server \
  --app-name dynamodb-auth \
  --backend-store-uri dynamodb://localhost:8000/my-table \
  --default-artifact-root ./mlartifacts \
  --enable-workspaces

Configure the Client

Point the MLflow client at your server:

export MLFLOW_TRACKING_URI=http://localhost:5000

Create an Experiment

mlflow experiments create --experiment-name "my-experiment"
import mlflow

mlflow.set_tracking_uri("http://localhost:5000")
mlflow.set_experiment("my-experiment")

Log a Run

import mlflow

mlflow.set_tracking_uri("http://localhost:5000")
mlflow.set_experiment("my-experiment")

with mlflow.start_run():
    mlflow.log_param("learning_rate", 0.01)
    mlflow.log_param("epochs", 100)
    mlflow.log_metric("loss", 0.42)
    mlflow.log_metric("accuracy", 0.95)
    mlflow.set_tag("model_type", "xgboost")

Search Runs

import mlflow

runs = mlflow.search_runs(
    experiment_names=["my-experiment"],
    filter_string="params.learning_rate = '0.01'",
)
print(runs)

View in the UI

Open http://localhost:5000 in your browser to see experiments, runs, and metrics in the MLflow UI.

What's Next?