Creating a Watson Discovery service instance from the command line
Use the command-line interface to create a Watson Discovery service instance.
This task is equivalent to provisioning a service instance from the Cloud Pak for Data web client. For more information, see Creating a Watson Discovery service instance from the web client. Alternatively, you can use the application programming interface to create a service instance. For more information, see Creating a Watson Discovery service instance programmatically.
Required role: To use the create
command, you must have the
can_provision permission in Cloud Pak for Data.
Prerequisite steps
- Install the cpd-cli. For more information, see Installing the Cloud Pak for Data command-line interface ().
- Create a Cloud Pak for Data configuration profile name that has permission to provision instances. For more information, see Creating a profile to use the management commands.
Creating the service instance
To create a service instance by using the command-line interface, complete the steps described in
service-instance.create
.
- Create a JSON file that defines the service instance that you want to create. Store the file in
a location from which it can be referenced when you submit a command to the cpd-cli later.
Use the following JSON snippet as a starting point, and then replace the values that are identified as variables.
Replace the following variables with values that reflect your deployment:{ "addon_type": "discovery", "addon_version": "${VERSION}", "create_arguments": { "deployment_id": "${PROJECT_CPD_INSTANCE}-wd", "parameters": { "serviceId": "discovery", "url": "https://wd-discovery-gateway.${PROJECT_CPD_INSTANCE}.svc.cluster.local:60443/v2/service_instances", "watson": true } }, "display_name": "<instance-name>", "namespace": "${PROJECT_CPD_INSTANCE}" }
${VERSION}
- Environment variable for the version of the Cloud Pak for Data software that is installed.
${PROJECT_CPD_INSTANCE}
- Environment variable for the project name (formerly namespace) that was defined before the service was installed. For more information, see Setting up installation environment variables.
<instance-name>
- Name that you want to use for the service instance. This name is displayed in the Instances page of the Cloud Pak for Data web client. The name can contain alphanumeric characters, spaces, dashes, underscores, and periods.
- Use the following command to create the service
instance:
Specify values for the following parameters:cpd-cli service-instance create \ --profile <cpd-configuration-profile-name> --from-source <filename.json>
<cpd-configuration-profile-name>
- Specify the Cloud Pak for Data configuration profile
that you created as a prerequisite step. For example,
cpd-admin-profile
. <filename.json>
- Specify the file path to the JSON file that you created in the previous step.
cpd-cli service-instance create \
--profile cpd-admin-profile --from-source ./wd-instance.json
Listing the service instances
The following example syntax lists the Cloud Pak for Data service instances that are associated with the specified profile:
cpd-cli service-instance \
--profile <cpd-configuration-profile-name> list
cpd-cli service-instance \
--profile cpd-admin-profile list
Getting a service instance
The following example syntax returns information about the Cloud Pak for Data service instance that you specify by name.
cpd-cli service-instance \
--profile <cpd-configuration-profile-name> get <instance-name>
cpd-cli service-instance \
--profile cpd-admin-profile get wd-test-instance
Deleting a service instance
The following example syntax shows you how to delete a service instance that you specify by name:
cpd-cli service-instance \
--profile <cpd-configuration-profile-name> delete <instance-name>
cpd-cli service-instance \
--profile cpd-admin-profile delete wd-test-instance