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.

Create a deployment space

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

  1. In your watsonx Code Assistant instance, click the Navigation Menu icon Navigation Menu, then select Deployments.

  2. Click New deployment space.

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

  4. In Code assistant service, select your instance.

  5. Click Create.

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

Add the service ID as a space collaborator

Enable the API to connect to your deployment space.

  1. On the Manage tab of your deployment space, click 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 the IBM watsonx Code Assistant user service ID that you created, and select Editor for the role.

  4. Click Add.

    The service ID is added to the list of collaborators.

Sign up for 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.

Add the Db2 connection to your space

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

  1. On the Assets tab of your deployment space, click Import assets.

  2. Click Data access, then click Connection.

  3. Click To service.

  4. Select your Db2 service instance and click Select.

    A Create connection: IBM Db2 on Cloud panel appears with prepopulated information from your service instance.

  5. 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?.

Set up the Db2 database

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 the Run SQL Run SQL icon.

  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.

Next steps

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.

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