Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change heroku region after creation

Tags:

heroku

region

Thought this could work, but it doesn't:

 heroku appname --region=eu

This works, but I already have an existing app, so this does not make sense for me:

heroku create --region eu

Or for an addon:

heroku addons:list --region=eu
like image 296
user254197 Avatar asked Sep 07 '15 11:09

user254197


People also ask

How do I know my Heroku region?

You can use heroku info <APP-NAME> to find the Region ID. It will display some data like below. As you can see the Region ID is us . Then, you can use heroku regions command to find the regions belong to the ID.


1 Answers

There is NO native ability just to switch region, but still there is a way how to do this.

Create fork of the app in a region you need.
For example, you have app in US region and you want to migrate it to EU:

  • The heroku fork command is no longer included with the Heroku CLI by default, but it is available via a plugin with the following command:

    heroku plugins:install heroku-fork
    
  • Run this command to create a new app that will be a copy of existing:

    heroku fork --from sourceapp --to targetapp --region eu
    
  • After check if it is working, check (and copy-paste if needed) settings, permissions, addons, etc. They might copy too, but it is better to check.

  • Rename sourceapp to something like sourceapp_old.

  • Rename targetapp to sourceapp.

NOTE: But still this method has few cons:

  • it doesn't migrate database (but there is a method how to handle that)
  • there can be issues with DNS and SSL
  • if the web server is live - you'll need to use maintenance mode

Anyhow, I'd recommend to read official Heroku documentation before doing so risky actions like this.

like image 137
wowkin2 Avatar answered Oct 21 '22 01:10

wowkin2