In addition to the other methods for accessing your Pantheon services, you are able to open SSH tunnels to connect to your services. This can be helpful if you want to use a local MySQL or Redis client to connect to the Pantheon-hosted service, and need to do so over an encrypted channel.
In order to open an SSH tunnel, you need a few key pieces of information:
- Your site's UUID, which can be found in your dashboard URL, git connection string, etc.
- The environment you want to connect to (dev, test, or live)
- The service you want to connect to (dbserver or cacheserver)
- The port your service runs on, which can be found using the "Connect" option for that environment's database
You can then combine these like so:
# Replace these exports with real values from your site export $SITE="your-site-uuid" export $ENV="dev" export $SERVICE="dbserver" export $PORT="port-number" # Now open the tunnel ssh -f -N -L $PORT:localhost:$PORT -p 2222 $ENV.$SITE@$SERVICE.$ENV.$SITE.drush.in # Now use it with your local mysql client mysql -u pantheon -h 127.0.0.1 -p -P $PORT