+++
title = "Migrating from Heroku to a Direct Account"
weight = 128
updated = 2024-05-16
aliases = ["/docs/migrating-from-heroku-to-a-direct-account", "/docs/managed-search/elasticsearch-and-opensearch/deployment/heroku/migrating-from-heroku-to-a-direct-account/", "/docs/deployment/heroku/migrating-from-heroku-to-a-direct-account/"]

[extra]
weight = 70
+++

Migrating your Bonsai resources from Heroku to our direct service requires no cutovers or downtime to your search. Read the following article to follow the steps for a seamless transition.

Warnings:
- Migrating from a Heroku Account to a Direct Account requires minor environment configuration changes in the Heroku application. This will require redeployment of the application.
- DO NOT delete your Bonsai Heroku Add-on before receiving confirmation from support that your account has been successfully migrated. Doing so will cause your cluster to be deleted, and we cannot guarantee index recovery after this action has been taken.

## Steps to Migrate to Direct

1. Sign up for an account at [Bonsai.io](https://sprout.bonsai.io/signup). Skip creating a sandbox cluster and do not create new clusters.
2. Navigate to account billing and add a credit card.
3. Change your application to use `ELASTICSEARCH_URL` environment variable rather than `BONSAI_URL`.
4. Configure your application in Heroku with `ELASTICSEARCH_URL`, using your add-on cluster's url:

```bash
heroku config:set ELASTICSEARCH_URL=$(heroku config:get BONSAI_URL)
```

When you uninstall the Bonsai Add-on, Heroku will remove the `BONSAI_URL` configuration setting. By redeploying your application to use this different environment variable now, you can remove any downtime for your application in later steps.

5. Email [support@bonsai.io](mailto:support@bonsai.io) and include
  - The email address associated with your new Bonsai account and the account name, e.g. Acme Enterprises, developer@acme.com
  - The Add-ons cluster(s) that you want migrated over. ex. the add-on name, `bonsai-animated-112233`, or its cluster id, found in the URL for your cluster, ex `bonsai-animated-s6g354` from `https://user:password@bonsai-animated-s6g354.us-east-1.bonsaisearch.net`. Please do not paste your access credentials from the URL in your email.
    
  An example email:
  ```
    Hello Bonsai support,
    
    We're ready to move our Heroku Add-on resources to Bonsai direct. Here is our account information:
    
    Direct Account: Acme Enterprises, developer@acme.com
    Heroku Add-ons:
    - bonsai-animated-112233
    - bonsai-triangular-887766
    - bonsai-adjacent-985363
    
    Thank you,
    
    Sarah J
  ```
  
  To ensure account security, submit your request with an email that is associated with your Heroku account. We cannot move resources without confirming allowed email access.
  
6. Once we've reviewed your email and confirmed your direct account billing settings, we'll respond with one more confirmation via the support thread. After your email confirmation reply, we'll immediately perform the migration and let you know once it is completed. At completion:
  - Your cluster URLs and all your data will remain intact.
  - You will be billed at the monthly rate. Direct pricing is always equivalent to or cheaper than our Heroku Add-on pricing. 
  - Any clusters we have migrated will now belong to your Bonsai.io account and can be managed there.
7. Once you receive your email confirmation of migration completion, remove the Bonsai add-on(s) from your Heroku app so you're not being billed twice! Thankfully, both Heroku and our systems prorte by the minute. Uninstalling the Bonsai add-on at this step in Elasticsearch will remove the `BONSAI_URL` environment setting and halt your Heroku billing for the resource:

```bash
  heroku addons:destroy bonsai-animated-112233
  heroku addons:destroy bonsai-triangular-887766
  heroku addons:destroy bonsai-adjacent-985363
```

Reference: <a href="https://devcenter.heroku.com/articles/managing-add-ons" target="_blank">Heroku Managing Add-ons Documentation</a>

That's it! Migrations are zero-downtime and take only a few minutes once our support team takes the ticket.
