OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

Redshift IAM Auth fails when using PrivateLink/VPC Endpoint hostname

Open joyfulwang opened this issue 6 months ago • 1 comments

Is there an existing issue for this?

I don't believe so. I have searched the existing issues

Environment

  • OpenMetadata Version: 1.12.6
  • Connector: Redshift
  • Cloud: AWS
  • Deployment: Kubernetes (EKS Fargate)

Description

When connecting to a Redshift cluster via AWS PrivateLink (VPC Endpoint), IAM authentication fails because the connector extracts the cluster identifier from the hostname using host.split(".")[0].

Standard Redshift hostnames follow the pattern cluster-id.xxxxx.region.redshift.amazonaws.com, so host.split(".")[0] correctly returns the cluster ID.

However, PrivateLink/VPC Endpoint hostnames look like: vpce-xxxxxxxxxxxxxxxxx-yyyyyyyy.vpce-svc-zzzzzzzzzzzzzzzzz.us-west-2.vpce.amazonaws.com

In this case, host.split(".")[0] returns vpce-xxxxxxxxxxxxxxxxx-yyyyyyyy, which is not a valid cluster identifier. The subsequent GetClusterCredentials API call fails with:

AccessDenied: User is not authorized to perform: redshift:GetClusterCredentials on resource: arn:aws:redshift:us-west-2:111111111111:dbuser:vpce-xxxxxxxxxxxxxxxxx-yyyyyyyy/IAM:openmetadata_user

Why PrivateLink is needed

PrivateLink is required for cross-account Redshift access when VPCs have overlapping CIDR blocks (which prevents VPC peering). This is a common pattern in enterprise AWS environments.

Proposed Fix

Allow users to specify the cluster identifier explicitly via connectionArguments, falling back to hostname parsing when not provided.

In ingestion/src/metadata/ingestion/source/database/redshift/connection.py:

  def _get_provisioned_cluster_identifier(host: str, connection=None) -> str:
      """
      Extract the cluster identifier from a Redshift Provisioned host.
      If connectionArguments contains 'clusterIdentifier', use that instead
      (needed for PrivateLink/VPC Endpoint connections).
      """
      if connection and connection.connectionArguments:
          cluster_id = connection.connectionArguments.get("clusterIdentifier")
          if cluster_id:
              return cluster_id
      return host.split(".")[0]

This is backwards-compatible — existing users who don't set clusterIdentifier in connection arguments will continue to work as before.

Steps To Reproduce

  1. Set up a Redshift cluster accessible via AWS PrivateLink (VPC Endpoint)
  2. Configure a Redshift service connection in OpenMetadata with IAM Auth enabled
  3. Use the VPC Endpoint hostname (e.g., vpce-xxx.vpce-svc-yyy.region.vpce.amazonaws.com:5439)
  4. Test the connection → fails with AccessDenied on GetClusterCredentials

Expected Behavior

Users should be able to specify the Redshift cluster identifier explicitly (e.g., via Connection Arguments: clusterIdentifier = my-cluster-id) so IAM auth works regardless of the hostname format.

Current Workaround

Generate temporary credentials manually using aws redshift get-cluster-credentials and configure the connection with basic auth (username/password). Credentials expire after 1 hour, requiring manual refresh.

joyfulwang avatar May 14 '26 19:05 joyfulwang

This appears to be a database connector issue — could a maintainer add the appropriate label?

joyfulwang avatar Jun 26 '26 22:06 joyfulwang