Iguy
Iguy

Reputation: 711

Can I use a service bound to apps in one Bluemix region across other Bluemix regions?

There are multiple regions in Bluemix. I have a service instance bound to an application in one region and I want to use that service instance in other Bluemix regions.

I've not found a clear intuitive way to do this. Is there a supported method?

Thanks!

Upvotes: 1

Views: 237

Answers (1)

Iguy
Iguy

Reputation: 711

There is no explicit mechanic for making a service instance available across regions from the Bluemix dashboard, but it can be done with a user-provided service instance.

Starting from the region where I have my service instance running and bound to my application I needed to grab the credentials and connection parameters from the VCAP_SERVICES environment variable for service instance.

I did this by displaying the Overview page in the Bluemix dashboard by clicking the title of my application. Next, in the left navigation pane, I click Environment Variables to get at the value of VCAP_SERVICES. Environment variable details are displayed on the right pane and from there I am able to capture the JSON content for the service instance.

Now I go to the region(s) where I want to make use of the service instance in the first region. I go to the Bluemix menu bar and click the Region icon, then select the new or target region.

User provided services are an excellent vehicle for accessing resources (databases, locally developed programs, ...) that may not exist in Bluemix. So long as you have the credentials needed to get to these resources across the internet, a user-provided service can be built in Bluemix to liase with these external entities. I learned about user-provided services at Creating a user-provided service instance.

I use the credentials and connection parameters I captured from the VCAP_SERVICES environment variable and create a user-provided service instance in the new or target region.

Last step is to bind my new user-provided service instance to an app in the new region by using the following command:

cf bind-service myapp user-provided_service_instance

Upvotes: 3

Related Questions