Secure credentials for connector service
Connector Service integrates with Secure Store to keep database passwords, API keys, and other secrets out of Connector configuration. Credentials stored in Secure Store are resolved at connection time and never appear in the Connector spec, in API responses, or in worker pod environments.
How it works
When a Connector uses Secure Store credentials:
- A Workspace Administrator uploads the secret value to Secure Store once, under a name like
postgres-password. - The Connector's configuration references the secret name — not the secret value — using a
credentialsblock. - When a user opens a connection, the Connector Service workload manager reads the secret value from Secure Store and holds it in memory for that connection.
- The worker requests the credential from the workload manager over an internal, authenticated call when it opens a data stream. The value is never written to an API response or to a pod environment variable.
This means end users can open connections against a secured Connector without ever seeing or handling the underlying credentials.
Supported credential types
| Provider | Credential key | Description |
|---|---|---|
| PostgreSQL | PGPASSWORD | Database password |
| Snowflake | SNOWFLAKE_PASSWORD | Snowflake user password |
| Snowflake | SNOWFLAKE_PRIVATE_KEY | PKCS#8 private key for key-pair authentication |
| Amazon S3 / MinIO | AWS_ACCESS_KEY_ID | Access key ID |
| Amazon S3 / MinIO | AWS_SECRET_ACCESS_KEY | Secret access key |
| Azure Blob Storage | AZURE_STORAGE_KEY | Storage account key |
Admin setup: storing a secret
A Workspace Administrator uploads the secret value to Secure Store in the workspace where the Connector will live. The following example uses the h2o-secure-store Python library:
import os
import h2o_secure_store as hss
from h2o_secure_store.clients.secret_version.secret_version import SecretVersion
clients = hss.login(
environment=os.environ["H2O_CLOUD_ENVIRONMENT"],
platform_token=os.environ["H2O_CLOUD_CLIENT_PLATFORM_TOKEN"],
)
workspace = f"workspaces/{os.environ['WORKSPACE_ID']}"
# Create the secret once. It holds metadata only, not the value.
clients.secret_client.create_secret(parent=workspace, secret_id="postgres-password")
# Store the value as a new version of the secret.
clients.secret_version_client.create_secret_version(
parent=f"{workspace}/secrets/postgres-password",
secret_version=SecretVersion(value=b"<actual-password>"),
)
To rotate the password, create a new version of the same secret. By default, the connection uses the latest version of the secret. To pin a specific version, see Pinning a secret version.
Admin setup: referencing the secret in a Connector
When creating the Connector, reference the Secure Store secret name in the credentials field instead of embedding the password in data_source_config:
import os
from h2o_connector_service import Client
client = Client(
h2o_cloud_url=os.environ["H2O_CLOUD_ENVIRONMENT"],
refresh_token=os.environ["H2O_CLOUD_CLIENT_PLATFORM_TOKEN"],
)
# Connector config does NOT contain the password
config = {
"PGHOST": "<your-database-host>",
"PGPORT": "5432",
"PGDATABASE": "<your-database-name>",
"PGUSER": "<your-database-user>",
}
# Credentials reference the Secure Store secret name, not the value
credentials = {
"source": "CREDENTIAL_SOURCE_SECURE_STORE",
"config": {
"PGPASSWORD": "postgres-password", # Key = credential name; value = Secure Store secret name
},
}
connector = client.connectors.create(
os.environ["WORKSPACE_ID"],
metadata={"name": "<connector-id>"},
data_source_type="postgresql",
data_source_config=config,
credentials=credentials,
)
print(f"Created connector: {connector.metadata.name}")
Use the bare secret name, for example postgres-password. Do not use the full resource name workspaces/<workspace>/secrets/postgres-password. The platform reads the secret from the same workspace as the connection.
Blob storage example
For S3 or MinIO connectors that use two credential values:
credentials = {
"source": "CREDENTIAL_SOURCE_SECURE_STORE",
"config": {
"AWS_ACCESS_KEY_ID": "aws-access-key-id", # Secure Store secret name
"AWS_SECRET_ACCESS_KEY": "aws-secret-access-key", # Secure Store secret name
},
}
Pinning a secret version
By default, the platform reads the latest version of each secret. To use a specific version, add secret_versions. The key is the credential name. The value is the version ID: the last segment of the version name that create_secret_version returns (workspaces/<workspace>/secrets/<secret>/versions/<version-id>). Version IDs are random strings, not numbers.
credentials = {
"source": "CREDENTIAL_SOURCE_SECURE_STORE",
"config": {
"PGPASSWORD": "postgres-password",
},
"secret_versions": {
"PGPASSWORD": "a4nxgehq2s06",
},
}
End-user experience
Data Scientists and Data Engineers open connections against a Secure Store-backed Connector in exactly the same way as any other connector. No additional configuration is required:
with client.open_session(
workspace_id=os.environ["WORKSPACE_ID"],
connector="connectors/<connector-id>",
worker="workers/<worker-id>",
extraction={"query": "SELECT id, name FROM my_table"},
) as session:
session.stream_to_csv("output.csv")
The credential resolution is transparent to the end user.
Admin and user responsibilities
| Task | Role |
|---|---|
| Upload secret value to Secure Store | Workspace Administrator |
Create Connector with credentials referencing the secret | Workspace Administrator |
| Open connections and stream data | Data Scientist / Data Engineer |
To open a session, end users need the connections/CREATE, connections/GET, and connections/DELETE permissions in the workspace. They do not need access to Secure Store or to the Connector's credential configuration.
Troubleshooting
| Symptom | Cause | Resolution |
|---|---|---|
| Connection fails with a credential resolution error | The Secure Store secret name in the Connector's credentials.config does not match an existing secret in the workspace | Ask your Workspace Administrator to verify the secret name and workspace ID |
| Connection fails with a credential resolution error after the secret name was checked | The value is a full resource name such as workspaces/<workspace>/secrets/<name> | Use the bare secret name |
| Connection fails with an authorization error | The platform does not have permission to read from Secure Store | Ask your Platform Administrator to verify the authorization policy for the Connector Service workload manager |
| Connector creation is accepted but connections always fail | The secret was created in a different workspace than the Connector | Ensure the secret and Connector are in the same workspace |
- Submit and view feedback for this page
- Send feedback about H2O AI Cloud | Docs to cloud-feedback@h2o.ai