13.4. Managing Storage Secrets #
This section describes how to manage storage secrets. Secrets store credentials for connecting Postgres Pro AXE to S3 storages, such as MinIO.
All S3 storage operations require a secret, including:
A secret only provides the technical ability to connect to an S3 storage, whereas the actual access to analytical tables and shared directories in this storage is managed using privileges (refer to the diagram below).
Figure 13.1. Two-Level Access Management
13.4.1. Creating a Storage Secret (axe.create_simple_secret) #
You can only create one simple secret for an S3 storage.
Required privileges: Superuser or the Postgres Pro AXE administrator with the following privileges:
the
USAGEprivilege on theduckdbforeign data wrapperthe
CREATEprivilege on the database
For more information about access management, refer to Chapter 12.
Execute the following command on the Postgres Pro AXE server:
SELECT axe.create_simple_secret(
type := 'S3',
key_id := 'access_key',
secret := 'secret_access_key',
session_token := 'session_security_token',
region := 'region',
url_style := 'URL_style',
provider := 'credentials_provider',
endpoint := 'endpoint_URL',
scope := 'scope_restriction',
validation := '',
use_ssl := 'encryption_usage'
);
Where:
access_keyandsecret_access_key: The access key and secret access key for connecting to the S3 storage.session_security_token: A temporary security session token required when using short-lived credentials (STS).Default value: '' (empty string) — a permanent access key is used.
Optional parameter.
region: The region where the S3 storage is located.Optional parameter.
URL_style: The URL format used to access the bucket within the S3 storage.The
pathvalue includes the bucket name in the path of the URL (e.g.,storage.example.com/my-bucket).Optional parameter.
credentials_provider: Specifies how the access key and secret access key are provided.The
''(empty string) value uses the providedaccess_keyandsecret_access_key.Optional parameter.
endpoint_URL: The endpoint URL of the S3 storage.Optional parameter.
scope_restriction: A bucket path prefix that restricts the scope of the secret to a specific location in the S3 storage.Default value: '' (empty string) — the secret applies to all paths in the S3 storage.
Optional parameter.
validation: A service parameter, leave it empty.encryption_usage: Specifies whether to encrypt communication between Postgres Pro AXE and the S3 storage.Possible values:
truefalse
Optional parameter.
Postgres Pro AXE will return the name of the created storage secret.
Example 13.4. Creating a Storage Secret
SELECT axe.create_simple_secret(
type := 'S3',
key_id := 'AKIAIOSFODNN7EXAMPLE',
secret := 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
region := 'us-east-1',
url_style := 'path',
endpoint := 'minio.example.com:9000',
use_ssl := 'false'
);
13.4.2. Retrieving Information about a Storage Secret (axe.show_simple_secret) #
Required privileges: All roles.
For more information about access management, refer to Chapter 12.
Execute the following command on the Postgres Pro AXE server:
SELECT * FROM axe.show_simple_secret();
Postgres Pro AXE will return the following columns:
secret_name: The storage secret name.secret_type: The storage secret type.options: The S3 storage connection parameters specified when creating the storage secret.Note
This stored procedure does not return the access key and the secret access key for connecting to the S3 storage. A database superuser can retrieve them from the
pg_user_mappingssystem view.
Example 13.5. Retrieving Information about a Storage Secret
SELECT * FROM axe.show_simple_secret(); secret_name | secret_type | options ----------------+-------------+-------------------------------------------- simple_s3_secret | S3 | url_style=path, endpoint=127.0.0.1:9000, use_ssl=false (1 row)
13.4.3. Deleting a Storage Secret (axe.drop_simple_secret) #
You may need to delete a storage secret to update its parameters and then recreate it.
Required privileges: Superuser or the Postgres Pro AXE administrator with ownership of the storage secret.
For more information about access management, refer to Chapter 12.
Execute the following command on the Postgres Pro AXE server:
SELECT axe.drop_simple_secret('S3');