Configuring virtual-hosted-style S3 access for external clients
Configure Ozone S3 Gateway, Hive Metastore, and Hive on Tez so that external clients such as Snowflake can read shared Iceberg tables with virtual-hosted-style S3 requests, while cluster services (such as Hive Metastore hosting REST Catalog and HiveServer2) keep using path-style requests.
- You must complete Configuring Hive Metastore as a REST Catalog for Ozone storage.
- You must have a publicly accessible S3-compatible endpoint, such as a load
balancer or reverse proxy in front of Ozone S3 Gateway, that the
external client can reach. The endpoint must forward the original
Hostheader to Ozone S3 Gateway unchanged, including any port number. S3 clients sign theHostheader of each request, so if the endpoint changes the header, Ozone S3 Gateway rejects the request with an HTTP 403 error. The same requirement applies to any internal load balancer in front of Ozone S3 Gateway. - You must have DNS records for the endpoint domain
(
[***PUBLIC_S3_DOMAIN***]) and for the wildcard domain (*.[***PUBLIC_S3_DOMAIN***]) that resolve to the endpoint. - You must have a TLS certificate from a publicly trusted certificate authority
for the endpoint that covers both
[***PUBLIC_S3_DOMAIN***]and*.[***PUBLIC_S3_DOMAIN***], so that external clients trust the endpoint. If TLS terminates at the endpoint, Ozone S3 Gateway can keep using its internal certificate. - For Snowflake, the endpoint must also meet the Snowflake requirements for S3-compatible storage, and Snowflake Support must enable the endpoint for your Snowflake account. For more information, see Requirements for S3-compatible storage in the Snowflake documentation.
Some external clients, such as Snowflake, send virtual-hosted-style S3 requests, in
which the bucket name is part of the host name, for example
https://[***BUCKET_NAME***].[***PUBLIC_S3_DOMAIN***]/[***KEY***].
By default, Ozone S3 Gateway and the Cloudera Iceberg REST Catalog use path-style requests, for
example
https://[***S3_HOST***]/[***BUCKET_NAME***]/[***KEY***].
In this configuration, two access paths use different endpoints and addressing styles:
- Hive Metastore, which hosts the REST Catalog, and HiveServer2 read and write
Iceberg metadata through their own S3A client. The
fs.s3a.endpointproperty points this client to an Ozone S3 Gateway, or to an internal load balancer in front of the Ozone S3 Gateways, on the internal network, which it reaches with path-style requests. - External clients use the public endpoint that the REST Catalog returns to them
in the
hive.metastore.catalog.ozone.s3.gatewayproperty, which they reach with virtual-hosted-style requests. They reach the Cloudera Iceberg REST Catalog itself through the Knox URL, which is the URL that you use, for example, in the Snowflake catalog integration.
Ozone S3 Gateway serves both styles at the same time when the
ozone.s3g.domain.name property is set. For more information
about the two styles, see Virtual hosting of buckets in the Amazon
S3 documentation.
The REST Catalog loadTable call returns the table metadata, and the
response tells external clients to use virtual-hosted-style requests to the public
endpoint. To test the call, see Supported REST Catalog APIs for accessing the
data.
If loadTable fails with an UnknownHostException
for a host name such as
[***BUCKET_NAME***].[***OZONE_S3_GATEWAY_HOST***],
Hive is sending virtual-hosted-style requests to the internal Ozone S3 Gateway.
Add the per-bucket path.style.access property for that
bucket.
To configure Snowflake to read the shared tables, see Configure an external volume for S3-compatible storage and Configure a catalog integration for Apache Iceberg REST catalogs in the Snowflake documentation.
