Tuesday, June 3, 2025

Babelfish for Aurora PostgreSQL

 

Babelfish for Aurora PostgreSQL – Overview

Babelfish for Aurora PostgreSQL allows SQL Server applications to run directly on Amazon Aurora PostgreSQL, with minimal code changes.

It adds T-SQL support, along with SQL Server wire protocol (TDS), so twtech existing applications can connect to Aurora PostgreSQL as if it were SQL Server — without rewriting database access logic.

 What Babelfish Does

Capability

Description

T-SQL support

Understands SQL Server-specific syntax, data types, functions, stored procedures.

TDS protocol

Accepts connections from SQL Server clients (like sqlcmd, SSMS, etc.).

Schema compatibility

Translates SQL Server schemas into PostgreSQL-compatible forms.

Authentication

Supports SQL Server authentication over the wire.

 Why Use Babelfish

·        Lift-and-shift SQL Server apps to Aurora PostgreSQL.

·        Avoid SQL Server licensing costs.

·        Keep your application code unchanged.

·        Gradually adopt PostgreSQL features over time.

 How It Works

Babelfish runs within Aurora PostgreSQL, acting like a compatibility layer for SQL Server. It listens on a separate port (default 1433) and processes incoming TDS/T-SQL requests, translating them to native PostgreSQL commands.

# pgsql

          ┌────────────┐       SQL Server Client (SSMS, App)
          │   Client   │ ────────────► Port 1433
          └────────────┘
                             Aurora PostgreSQL + Babelfish
                                ┌────────────────────┐
                                │  TDS/T-SQL Layer   │
                                │ (Babelfish Engine) │
                                └────────────────────┘
                                │ PostgreSQL Engine  │

 Supported Aurora Versions

·        Aurora PostgreSQL 13.4+ and 14.3+

·        Only supported in Aurora Provisioned mode (not Serverless).

 Enabling Babelfish

Babelfish must be enabled at cluster creation time — it cannot be added to an existing cluster.

AWS CLI Example:

# bash
aws rds create-db-cluster \
  --engine aurora-postgresql \
  --engine-version 14.6 \
  --db-cluster-identifier babelfish-cluster \
  --enable-babelfish

Note: Babelfish uses a separate port (usually 1433) for TDS connections.

 Tools & Connection

Tool

Connection Type

Notes

SQL Server Mgmt Studio (SSMS)

TDS on port 1433

Works like connecting to MSSQL.

sqlcmd

TDS

Native SQL Server CLI support.

psql

PostgreSQL port (5432)

Use for direct PostgreSQL access.

 Supported SQL Server Features

✅ Supported:

·        T-SQL basics (SELECT, INSERT, UPDATE, DELETE)

·        Stored procedures and functions

·        Data types (e.g., nvarchar, datetime, money)

·        System stored procedures (partial support)

❌ Not supported:

·        SQL Server-specific features like SSIS, CLR, Service Broker

·        Windows authentication (only SQL Auth)

·        Linked servers, replication, some advanced T-SQL commands

 Limitations

·        Cannot enable Babelfish on existing clusters — must create new cluster.

·        Feature support is not 100%; complex stored procs or triggers may require refactoring.

·        Only Aurora PostgreSQL supports Babelfish — not standard RDS PostgreSQL.

·        Requires Aurora Provisioned, not Serverless.

 Monitoring & Management

·        Monitor using Amazon CloudWatch, Aurora Performance Insights.

·        Audit logs include TDS traffic and Babelfish errors.

 Pricing

·        No extra cost for Babelfish.

·        Standard Aurora PostgreSQL pricing (compute, storage, backups, I/O).

No comments:

Post a Comment

Kubernetes Clusters | Upstream Vs Downstream.

  The terms "upstream" and "downstream" in the context of Kubernetes clusters often refer to the direction of code fl...