Sync to Cloud¶
Reference
Find the reference for the local.Application
class here.
The local Application gives you the ability to ease the transition to Cloud by syncing it to a Cloud Application.
All your local runs are structured under the .nextmv
directory of your local
app. The sync process will track all your local runs and push them to your
Cloud Application.
To unleash the full potential of Nextmv, let's create a
cloud.Application
, and sync our
local.Application
to that target. With the Cloud app,
you can take full advantage of the Nextmv Platform with features such as:
- Testing and experimentation
- Versioning
- Configuration for operators
Let's start by creating a Cloud Application.
import os
from nextmv import cloud
client = cloud.Client(api_key=os.getenv("NEXTMV_API_KEY"))
cloud_app = cloud.Application.new(client=client, name="sample-cloud-app", id="sample-cloud-app", exist_ok=True)
Now, let's sync our local Application to our cloud Application using the
local.Application.sync
method.
from nextmv import local
local_app = local.Application(src="<YOUR_APP_SRC>") # Path to your local app, where the app.yaml manifest is located.
local_app.sync(target=cloud_app, verbose=True) # Set verbose to True to visualize what happens.
You should see an output similar to the following:
âī¸ Starting sync of local application `/Users/sebastian-quintero/nextmv/github/nextmv-py/nextmv/app-voo59k17` to Nextmv Cloud application `sample-cloud-app`.
âšī¸ Found 3 local runs to sync from /Users/sebastian-quintero/nextmv/github/nextmv-py/nextmv/app-voo59k17/.nextmv/runs.
đ Syncing local run `local-75l23gzf`...
â
Synced local run `local-75l23gzf` as remote run `devint-CIZjpy3Ng`.
đ Syncing local run `local-9881aggf`...
â
Synced local run `local-9881aggf` as remote run `devint-OVSjtyqHR`.
đ Syncing local run `local-au9xnvbj`...
â
Synced local run `local-au9xnvbj` as remote run `devint-D6OCps3Ng`.
đ Process completed, synced local application `/Users/sebastian-quintero/nextmv/github/nextmv-py/nextmv/app-voo59k17` to Nextmv Cloud application `sample-cloud-app`: 3/3 runs.
- You can specify the
run_ids
parameter to sync specific runs, as opposed to all the runs in your local app. - You can specify the
instance_id
parameter to sync the runs to a specific instance of your Cloud Application.
What happens when you run the command again?
âī¸ Starting sync of local application `/Users/sebastian-quintero/nextmv/github/nextmv-py/nextmv/app-voo59k17` to Nextmv Cloud application `sample-cloud-app`.
âšī¸ Found 3 local runs to sync from /Users/sebastian-quintero/nextmv/github/nextmv-py/nextmv/app-voo59k17/.nextmv/runs.
đ Syncing local run `local-75l23gzf`...
âī¸ Skipping local run `local-75l23gzf`, already synced at 2025-10-03T09:14:58.879628+00:00.
đ Syncing local run `local-9881aggf`...
âī¸ Skipping local run `local-9881aggf`, already synced at 2025-10-03T09:15:02.777086+00:00.
đ Syncing local run `local-au9xnvbj`...
âī¸ Skipping local run `local-au9xnvbj`, already synced at 2025-10-03T09:15:06.868320+00:00.
đ Process completed, synced local application `/Users/sebastian-quintero/nextmv/github/nextmv-py/nextmv/app-voo59k17` to Nextmv Cloud application `sample-cloud-app`: 0/3 runs.
The SDK recognizes that the runs were already synced, and skips them. The local Application keeps track of the synced runs, so they are not replicated in Cloud.