User provided services allow your application running on PCF to connect
to backing services that are not running on PCF. For example, if you have
an existing database that your Spring app needs to connect to, you could
bind a user provided service instance to your application with the database's
connection credentials so the app can connect to it. Similar to regular
service bindings, the credentials you specify will be available via
VCAP_SERVICES
.
In this lab you will leverage a user provided service to connect to a MySQL database running on Amazon RDS. Once you have connected, you will write a simple UI that lists data from a table in the database.
- Fork this lab
- Clone it to your workspace
- Get it working locally
- Push the app to PCF
- Make sure the app is running correctly
- Modify the app to read your names from a database externaldatabase with a table called cohort and a column called name.
- Display them on the start page
- Create a user provided service that exposes the credentials for our external database via VCAP_SERVICES
- Bind that service to the app
- Read the connection data from the bound user provided service
- Push your app to PCF
- Make sure the app is running correctly
- Modify your user provided service so that the spring cloud connector can pick up the credentials automatically
- Push the app to PCF
- Make sure the app is running correctly
- Write a task that writes your and your pair's nickname into the database in a column called nickname. Make sure to put it next to your name.
- Modify the app from above to display name and nickname on the page.