# Self Hosted to Cloud Migration

The cloud migration workflow exports configuration from a self-hosted Nexus Repository 3 instance and imports that configuration to Nexus Repository Cloud. It migrates content from the source instance to the cloud target. The migrator supports one-time content migration and continuous polling to keep the target instance synchronized.

Take the following steps to migrate a self-hosted instance to a cloud instance:

1. Configure source and target connection details. See [Configure the Migrator](https://help.sonatype.com/en/configure-the-migrator.html "Configure the Migrator").

2. Run `migrate-configuration-read` to export configuration from the source instance.

3. Run `migrate-configuration-write` to import configuration to the cloud target.

4. Run `migrate-content` to migrate repository content.

5. Run `migrate-content-polling` to continue migrating newly added assets.

## Example:

```
# Start interactive shell
java -jar nexus-repository-instance-migrator.jar

# Configure source and target
config set source-nexus-url http://localhost:8081
config set source-nexus-username admin
config set source-nexus-password admin123
config set target-nexus-url https://my-org.repository.sonatype.com
config set target-nexus-username myuser
config set target-nexus-password mypass

# Verify connectivity
status

# Perform migration
migrate-configuration-read     # Export from source
migrate-configuration-write    # Import to target
migrate-content                # Transfer repository content (one-time)
stop-migrate-content           # Stop ongoing content migration

# Alternative: Complete migration in one command
migrate-all                    # Run all operations in sequence

# For continuous monitoring and real-time migration
migrate-content-polling        # Start polling for new assets
stop-migrate-content-polling   # Stop polling service
```
