Connect to Apache Gravitino
Apache Gravitino provides metadata management and an Iceberg REST catalog. Use its REST endpoint to query and write Iceberg data on S3 from a VeloDB Cloud warehouse. The AWS and Gravitino steps below configure external services that you manage.
Prerequisites
- Connect to a VeloDB Cloud warehouse with a SQL user allowed to create catalogs and use the required databases and tables.
- For SaaS and BYOC warehouses, configure network access from the warehouse to both the external catalog endpoint and the storage endpoints returned in table metadata. An endpoint reachable from your laptop may still be unreachable from the warehouse. Contact VeloDB Cloud support when the integration needs private networking or managed runtime configuration.
- Prepare external service permissions for the metadata and data operations you plan to run. Credential vending still requires the external service to grant storage access.
- Replace sample hosts, account IDs, bucket names, and credentials. The HTTP endpoints and development credentials in local service examples are for an isolated test environment. Use HTTPS and restricted credentials for remote access.
Prepare the integration
1. Prepare the AWS environment
Before we begin, we need to prepare a complete infrastructure on AWS, including S3 buckets and a carefully designed IAM role system, which is the foundation for building a secure and reliable lakehouse architecture.
1.1 Create an S3 bucket
First, create a dedicated S3 bucket to store Iceberg data:
# Create S3 bucket
aws s3 mb s3://gravitino-iceberg-demo --region us-west-2
# Verify bucket creation success
aws s3 ls | grep gravitino-iceberg-demo
1.2 Configure an IAM role
To implement secure credential management, we need to create an IAM role for Gravitino to use through the STS AssumeRole mechanism. This design follows security best practices of least privilege and separation of duties.
Create Data Access Role
-
Create Trust Policy File
Create the
gravitino-trust-policy.jsonfile:{"Version": "2012-10-17","Statement": [{"Effect": "Allow","Principal": {"AWS": ["arn:aws:iam::YOUR_ACCOUNT_ID:root"]},"Action": "sts:AssumeRole"}]} -
Create IAM Role
For demonstration simplicity, we'll use AWS managed policies directly. Production environments should use more fine-grained permission controls.
# Create IAM roleaws iam create-role \--role-name gravitino-iceberg-access \--assume-role-policy-document file://gravitino-trust-policy.json \--description "Gravitino Iceberg data access role"# Attach S3 full access permissions (for testing, use fine-grained permissions in production)aws iam attach-role-policy \--role-name gravitino-iceberg-access \--policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess -
Verify IAM Configuration
Verify that the role configuration is correct:
# Test role assumption functionalityaws sts assume-role \--role-arn arn:aws:iam::YOUR_ACCOUNT_ID:role/gravitino-iceberg-access \--role-session-name gravitino-testSuccessful response example:
{"Credentials": {"AccessKeyId": "ASIA***************","SecretAccessKey": "***************************","SessionToken": "IQoJb3JpZ2luX2VjEOj...","Expiration": "2025-07-23T08:33:30+00:00"}}
2. Deploy and configure Gravitino
2.1 Download and install Gravitino
We'll use Gravitino's pre-compiled version to quickly set up the environment:
# Create working directory
mkdir gravitino-deployment && cd gravitino-deployment
# Download Gravitino main program
wget https://github.com/apache/gravitino/releases/download/v0.9.1/gravitino-0.9.1-bin.tar.gz
# Download Iceberg REST server component
wget https://github.com/apache/gravitino/releases/download/v0.9.1/gravitino-iceberg-rest-server-0.9.1-bin.tar.gz
# Extract and install
tar -xzf gravitino-0.9.1-bin.tar.gz
cd gravitino-0.9.1-bin
tar -xzf ../gravitino-iceberg-rest-server-0.9.1-bin.tar.gz --strip-components=1
2.2 Install the Gravitino dependencies
To support AWS S3 and credential management functionality, additional JAR packages need to be installed:
# Create necessary directory structure
mkdir -p catalogs/lakehouse-iceberg/libs
mkdir -p iceberg-rest-server/libs
mkdir -p logs
mkdir -p /tmp/gravitino
# Download Iceberg AWS bundle
wget https://repo1.maven.org/maven2/org/apache/iceberg/iceberg-aws-bundle/1.6.1/iceberg-aws-bundle-1.6.1.jar \
-P catalogs/lakehouse-iceberg/libs/
# Download Gravitino AWS support package (core for vended-credentials functionality)
wget https://repo1.maven.org/maven2/org/apache/gravitino/gravitino-aws/0.9.1/gravitino-aws-0.9.1.jar \
-P iceberg-rest-server/libs/
# Distribute JAR packages to various directories
cp catalogs/lakehouse-iceberg/libs/iceberg-aws-bundle-1.6.1.jar iceberg-rest-server/libs/
cp catalogs/lakehouse-iceberg/libs/iceberg-aws-bundle-1.6.1.jar libs/
cp iceberg-rest-server/libs/gravitino-aws-0.9.1.jar libs/
2.3 Configure the Gravitino service
-
Main Service Configuration
Create or edit the
conf/gravitino.conffile:# Gravitino server basic configurationgravitino.server.webserver.host = 0.0.0.0gravitino.server.webserver.httpPort = 8090# Metadata store configuration (PostgreSQL/MySQL recommended for production)gravitino.entity.store = relationalgravitino.entity.store.relational = JDBCBackendgravitino.entity.store.relational.jdbcUrl = jdbc:h2:file:/tmp/gravitino/gravitino.db;DB_CLOSE_DELAY=-1;MODE=MYSQLgravitino.entity.store.relational.jdbcDriver = org.h2.Drivergravitino.entity.store.relational.jdbcUser = gravitinogravitino.entity.store.relational.jdbcPassword = gravitino# Enable Iceberg REST servicegravitino.auxService.names = iceberg-rest# Iceberg REST service detailed configurationgravitino.iceberg-rest.classpath = iceberg-rest-server/libs, iceberg-rest-server/confgravitino.iceberg-rest.host = 0.0.0.0gravitino.iceberg-rest.httpPort = 9001# Iceberg catalog backend configurationgravitino.iceberg-rest.catalog-backend = jdbcgravitino.iceberg-rest.uri = jdbc:h2:file:/tmp/gravitino/catalog_iceberg.db;DB_CLOSE_DELAY=-1;MODE=MYSQLgravitino.iceberg-rest.jdbc-driver = org.h2.Drivergravitino.iceberg-rest.jdbc-user = iceberggravitino.iceberg-rest.jdbc-password = iceberg123gravitino.iceberg-rest.jdbc-initialize = truegravitino.iceberg-rest.warehouse = s3://gravitino-iceberg-demo/warehousegravitino.iceberg-rest.io-impl = org.apache.iceberg.aws.s3.S3FileIOgravitino.iceberg-rest.s3-region = us-west-2# Enable Vended-Credentials functionality# Note: Gravitino uses these AK/SK to call STS AssumeRole and obtain temporary credentials for distribution to clientsgravitino.iceberg-rest.credential-providers = s3-tokengravitino.iceberg-rest.s3-access-key-id = YOUR_AWS_ACCESS_KEY_IDgravitino.iceberg-rest.s3-secret-access-key = YOUR_AWS_SECRET_ACCESS_KEYgravitino.iceberg-rest.s3-role-arn = arn:aws:iam::YOUR_ACCOUNT_ID:role/gravitino-iceberg-accessgravitino.iceberg-rest.s3-region = us-west-2gravitino.iceberg-rest.s3-token-expire-in-secs = 3600 -
Start Service
# Start Gravitino service./bin/gravitino.sh start# Check service status./bin/gravitino.sh status# View logstail -f logs/gravitino-server.log -
Verify Service Status
# Verify main servicecurl -v http://localhost:8090/api/version# Verify Iceberg REST servicecurl -v http://localhost:9001/iceberg/v1/config
2.4 Create the Gravitino metadata structure
Create necessary metadata structures through REST API:
# Create MetaLake
curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-d '{
"name": "lakehouse",
"comment": "Gravitino lakehouse for Doris integration",
"properties": {}
}' http://localhost:8090/api/metalakes
# Create Iceberg Catalog
curl -X POST -H "Accept: application/vnd.gravitino.v1+json" \
-H "Content-Type: application/json" \
-d '{
"name": "iceberg_catalog",
"type": "RELATIONAL",
"provider": "lakehouse-iceberg",
"comment": "Iceberg catalog with S3 storage and vended credentials",
"properties": {
"catalog-backend": "jdbc",
"uri": "jdbc:h2:file:/tmp/gravitino/catalog_iceberg.db;DB_CLOSE_DELAY=-1;MODE=MYSQL",
"jdbc-user": "iceberg",
"jdbc-password": "iceberg123",
"jdbc-driver": "org.h2.Driver",
"jdbc-initialize": "true",
"warehouse": "s3://gravitino-iceberg-demo/warehouse",
"io-impl": "org.apache.iceberg.aws.s3.S3FileIO",
"s3-region": "us-west-2"
}
}' http://localhost:8090/api/metalakes/lakehouse/catalogs
3. Connect the warehouse to Gravitino
3.1 Use vended credentials
Gravitino will dynamically generate and distribute temporary credentials to VeloDB Cloud:
-- Create dynamic credential mode Catalog
CREATE CATALOG gravitino_vending PROPERTIES (
'type' = 'iceberg',
'warehouse' = 'warehouse',
'iceberg.catalog.type' = 'rest',
'iceberg.rest.uri' = 'http://127.0.0.1:9001/iceberg/',
'iceberg.rest.vended-credentials-enabled' = 'true'
);
3.2 Verify the connection and data operations
-- Verify connection
SHOW DATABASES FROM gravitino_vending;
-- Switch to vended credentials catalog
SWITCH gravitino_vending;
-- Create database and table
CREATE DATABASE demo;
USE gravitino_vending.demo;
CREATE TABLE gravitino_table (
id INT,
name STRING
)
PROPERTIES (
'write-format' = 'parquet'
);
-- Insert test data
INSERT INTO gravitino_table VALUES (1, 'Doris'), (2, 'Gravitino');
-- Query verification
SELECT * FROM gravitino_table;
See also
Common errors
| Symptom | Check and resolution |
|---|---|
| Connection timeout or hostname resolution failure | Check the catalog URI and connectivity from the warehouse, then check the storage endpoints in table metadata. Ask VeloDB Cloud support to investigate managed network access when needed. |
| Unauthorized or forbidden response | Check the catalog authentication method, token or client credentials, expiry, and permissions on the external catalog and namespace. |
| Catalog metadata loads but a table scan fails | Check storage credentials or credential vending, object permissions, and reachability of the data-file endpoint. Metadata access alone does not grant data access. |
Clean up test resources
Queries and writes consume warehouse compute, and the sample can create billable external storage or services. See Billing Overview. Remove only the test tables and external services you created when you finish. Check the external catalog's deletion behavior before dropping a table or namespace because it can also delete data files.