IBM Cloud Docs
Setting up watsonx Code Assistant for Z in IBM Cloud

Setting up watsonx Code Assistant for Z in IBM Cloud

watsonx Code Assistant for Z

As a cloud administrator, you must generate an API key to connect the service with a deployment space through IBM Cloud. After you set up your environment, your users can enable Visual Studio Code to interact with watsonx Code Assistant for Z.

Before you begin

  • Make sure that you have an IBM Cloud account.

  • Provision an instance of watsonx Code Assistant through the IBM Cloud catalog page or by working with an IBM sales representative.

When you finish provisioning your instance, click Setup to open an onboarding checklist page to help you configure the instance. Or, you can select Administration and then Setup to access this onboarding checklist.

Items in that checklist correspond to each of the following steps. Click the action arrows on the checklist page that are associated with each item to complete the steps.

Create a Service ID and API key

You can use this API key later to enable Visual Studio Code to communicate with watsonx Code Assistant.

  1. On the Service IDs page, click Create.

  2. Enter IBM watsonx Code Assistant user as the name for your service ID. Optionally, enter a description.

  3. Click Create.

    You are redirected to the dashboard for your service ID, which includes tabs for Access and API keys.

  4. Click the API Keys tab.

  5. Click Create.

  6. Enter IBM watsonx Code Assistant API key as the name for your API key. Optionally, enter a description.

  7. Click Create.

  8. Click Download or Copy and store the API key in a safe location.

    The key is only available for 296 seconds. Make sure to store it somewhere you can find it later.

    Although watsonx Code Assistant supports allowing multiple users to share the API key for the Service ID, the best practice is for each user to have their own API key. For more information about adding users to your instance, see Managing IAM access for watsonx Code Assistant for Z.

Set up Db2

Watsonx Code Assistant for Z uses Db2 to store code input and output. If you don't already have an instance of Db2, IBM Cloud can help you create one that is optimized for watsonx Code Assistant for Z.

  1. Select a region from the list of available regions.

  2. Review the preselected Db2 pricing plan.

  3. Click Create.

After watsonx Code Assistant for Z is set up in IBM Cloud, the Db2 administrator needs to configure the database by loading the provided script.

  1. In the Db2 on Cloud console, click SQL.

  2. Click the plus (+) tab to add a script.

  3. Click From file and browse to select adscan_DB2oC_CreateObjects.sql.

    The file is included in the compressed file for the watsonx Code Assistant for Z Visual Studio Code extension. For more information, see Set up a development environment..

  4. Click Run all to create the schema and tables.

Create a deployment space

The deployment space is the serving environment for watsonx Code Assistant.

  1. Enter Code Assistant Models as the name for your deployment space. Optionally, enter a description.

  2. Click Create.

  3. A status window appears. After the space is created, click Close.

Your instance is automatically associated with your new deployment space.

Add the service ID as a space collaborator

Enable the API to connect to your deployment space.

  1. On the Manage tab of the Code Assistant Models page, select Access control.

  2. Click Add collaborators and select Add service IDs from the menu.

    A list of service IDs that are associated with your account appears.

  3. Click the checkbox for your IBM watsonx Code Assistant user service ID and select Editor for the role.

  4. Click Add.

    The service ID is added to the list of collaborators.

Add the Db2 connection to your space

Enable the deployment space to send and retrieve code from Db2 storage.

  1. On the Code Assistant Models page, select the Assets tab.

  2. Click Import Assets.

  3. On the Import Assets > Data access panel, click Connection.

  4. Click Import.

  5. On the Connect to a data source panel, select the Deployed services tab.

  6. Select your Db2-wz service instance and click Select.

    A Connect to a data source: IBM Db2 on Cloud panel appears with prepopulated information from your service instance.

  7. Click Create.

    If you did not set a location and sovereignty, a window appears where you can confirm that you want to create the connection without setting these values. To accept, click Create. If you need to set the values, click Cancel and select Location and sovereignty.

    If your database is on another IBM Cloud account, or if the automated population fails, see Why can't I connect watsonx Code Assistant for Z to my Db2 database?.

You deployed and connected your IBM Cloud components to your provisioned watsonx Code Assistant instance. You're ready to take your next steps and integrate with your Open Z Editor in Visual Studio Code.

Next steps

For information about setting up your development environment, see the IBM watsonx Code Assistant for Z documentation.