Creating a workload secret for Cloudera Data Engineering Spark Jobs using API

Creating a workload secret for Cloudera Data Engineering (CDE) Spark Jobs using API provides a secure way to create workload secrets. This is a more secure alternative to storing credentials in plain text embedded in your application or job configuration.

  1. Create Workload Credentials with name workload-cred-:
    curl -k -X "POST" 'https://<dex-vc-host>/dex/api/v1/credentials' \
      -H 'Accept: application/json' \
      -H 'Connection: keep-alive' \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer ${CDE_TOKEN}" \
      --data '{
      "workloadCred": {
        "aws-secret": "secret123",
        "db-pass": "dbpass123"
      },
      "name": "workload-cred-1",
      "type": "workload-credential",
      "description": "workload credential description"
    }'
  2. Edit the existing workload credentials with new data. For example, edit workload-cred-1:
    curl -k -X "PATCH" 'https://<dex-vc-host>/dex/api/v1/credentials/workload-cred-1' \
      -H 'Accept: application/json' \
      -H 'Connection: keep-alive' \
      -H 'Content-Type: application/json' \
      -H "Authorization: Bearer ${CDE_TOKEN}" \
      --data '{
      "workloadCred": {
        "aws-secret": "newsecret123",
        "db-pass": "newdbpass123"
      }
    }'