If you're attempting this migration, feel free to ask questions and provide feedback via the PostHog Communty Slack workspace or a GitHub issue. You should also be aware that some of the steps on this document are potentially destructive! Proceed with caution.
Requirements
- You should have an account on PostHog Cloud.
- Your self-hosted instance should be running a minimum version of
1.30.0
Approach
We will only be migrating data used to run analytical queries, such as events, persons and person distinct IDs. This means that dashboard configuration, feature flags and other data that is not used in analytical queries will need to be recreated on cloud.
With this migration, we will migrate over your events using a PostHog app, which will create the necessary person, person distinct ID, and related records in cloud.
Exporting events
We will use the PostHog Migrator 3000.
Important considerations
This app works on PostHog instances with version 1.29.0 or above.
Version 1.30.0 fixes a bug with exporting autocaptured events, so, unless you do not use autocapture at all, we recommend upgrading to 1.30.0 on both instances before performing the events migration.
Instructions
Get your Project API Key (token) for your new instance from the 'Project Settings' page.
Visit the 'Apps' page on the old instance and click on the 'Advanced' tab.
Under 'Install from GitHub, GitLab or npm', add the URL
https://github.com/PostHog/posthog-plugin-migrator3000
and click 'Fetch and install'.A app configuration drawer should open. Here, add the hostname for your new instance, as well as the project API key from step 1. Also, make sure the toggle at the top is 'Enabled'.
Specify a date to start exporting events in the format
YYYY-MM-DD
(e.g. 2021-10-26) and click 'Save'.That's it! The app will now start exporting your events to the new instance. To keep track of its progress, click on the 'Logs' icon for the app. Ignore the progress bar, focusing instead on the timestamps in the logs. Once the app is done exporting all of your historical events, it will then continue to export the events that are coming in live, but with a delay. Our recommendation is to change the event sources to point to the new instance once you notice all historical events have been exported.