awslabs/aurora-dsql-pdo-pgsql
awslabs/aurora-dsql-pdo-pgsql provides a PDO PostgreSQL-compatible driver for Amazon Aurora DSQL, enabling PHP applications to connect through PDO. It simplifies using DSQL's serverless, distributed SQL database in existing PHP workflows.
Architecture fit
awslabs/aurora-dsql-pdo-pgsql is the PHP PDO adapter that lets standard PDO connect to it, primarily by generating a short-lived IAM auth token in place of a static password.DB::transaction all sit on a PDO instance. That means the mechanism fits: a custom connector can return a DSQL-backed PDO and the ORM will work largely untouched.$table->id() → bigserial), foreign-key constraints (foreignId()->constrained()), and pessimistic locking (lockForUpdate). DSQL uses optimistic concurrency control, does not support foreign keys or sequences, and imposes per-transaction limits. The gap is in schema and concurrency semantics, not in the driver.$table->id() and cascading FKs.Integration feasibility
DB::extend('pgsql-dsql', ...) or Connection::resolverFor) in a service provider, subclass Illuminate\Database\Connectors\PostgresConnector, and have createConnection supply the IAM token as the password.DB::reconnect(), queue workers and Horizon holding connections open, and Octane reusing the PDO handle across requests. Each of these needs an explicit token-refresh strategy and tests.Technical risk
id() or FKs, uses SELECT ... FOR UPDATE, advisory locks, triggers, or Postgres extensions will fail at migrate-time or runtime. This includes common candidates for session, cache, permission, and audit packages.40001 serialization failures become a normal operating condition and must be retried with backoff; Laravel's DB::transaction($cb, $attempts) recognizes 40001 for Postgres, but that needs verification against DSQL's actual error surface.Key questions
ON CONFLICT, CTEs, window functions, JSONB, LISTEN/NOTIFY)?Stack fit
pdo_pgsql, aws/aws-sdk-php. Works with Eloquent models, query builder, pagination, and most read paths.lockForUpdate/sharedLock, $table->id() and any bigserial, foreignId()->constrained(), advisory-lock-based migration helpers, and any DB-backed cache/session/lock driver that relies on row-level locking rather than unique-constraint upserts.Migration path
dsql) alongside the existing pgsql. Never remove the standard connection; it is the local dev and rollback path.DsqlConnector extends PostgresConnector; inject credentials via the default AWS provider chain (IAM role on ECS/EKS/EC2), cache the generated token per host+user until shortly before expiry, and override reconnect behavior so a fresh token is minted.DsqlServiceProvider via DB::extend; configure through config/database.php with a pgsql-dsql driver key and a DB_CONNECTION env switch.HasUuids, $incrementing = false, $keyType = 'string') and replace $table->id() with an explicit UUID blueprint macro repo-wide.40001; add a metric for retry rate per endpoint.Compatibility
pgsql and pgsql-dsql are interchangeable at the schema level once FKs and sequences are removed — validate that the vanilla-Postgres test path still passes with the portable schema.Sequencing
40001 rate and retry amplification; confirm backoff tuning.Maintenance
$table->id() and foreignId() will reappear within a month.Support
Scaling
40001 storms long before throughput ceilings. Design keys to avoid hot partitions.Failure modes
Ramp-up
TPM recommendation: fund the two-week spike against one bounded service with an explicit no-go option. This is an early-market bet — the opportunity score is real, but with 2 stars, 0 dependents, and an experimental AWS Labs package, the correct posture is option-buying, not platform commitment. Keep the standard pgsql connection alive and the schema portable so the exit cost stays measured in days.
How can I help you explore Laravel packages today?