PHPackages                             paeire/laravel-rds-proxy-iam - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. paeire/laravel-rds-proxy-iam

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

paeire/laravel-rds-proxy-iam
============================

Connect Laravel to AWS RDS / RDS Proxy using IAM database authentication — short-lived IAM tokens instead of static credentials.

v1.1.0(5mo ago)0840↑190%PHPPHP ^8.1CI passing

Since Sep 18Pushed 1mo agoCompare

[ Source](https://github.com/paeire/laravel-rds-proxy-iam)[ Packagist](https://packagist.org/packages/paeire/laravel-rds-proxy-iam)[ RSS](/packages/paeire-laravel-rds-proxy-iam/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

laravel-rds-proxy-iam
=====================

[](#laravel-rds-proxy-iam)

Connect Laravel to **AWS RDS / RDS Proxy** using **IAM database authentication**. The package adds a `mysql-iam-proxy` database driver that generates a short-lived IAM auth token on every connection instead of relying on a static password.

- No static database credentials in your app.
- Works with RDS Proxy and RDS directly (MySQL / Aurora MySQL).
- Order-independent registration — the driver is ready no matter when your app first resolves the database.
- TLS, connection timeout, read-only hardening, and session bootstrap statements built in.

Requirements
------------

[](#requirements)

- PHP `^8.2`
- Laravel `11` or `12`
- `aws/aws-sdk-php` `^3.300` (installed automatically)

Installation
------------

[](#installation)

```
composer require paeire/laravel-rds-proxy-iam
```

The service provider is auto-discovered — no manual registration required.

Configuration
-------------

[](#configuration)

Add a connection using the `mysql-iam-proxy` driver in `config/database.php`:

```
'connections' => [
    'mysql' => [
        'driver' => 'mysql-iam-proxy',

        'host' => env('DB_HOST'),
        'port' => env('DB_PORT', 3306),      // local port (tunnel / proxy)
        'database' => env('DB_DATABASE'),
        'username' => env('DB_USERNAME'),

        // Host/port used to sign the IAM token. Defaults to host/port above.
        'token_host' => env('DB_TOKEN_HOST', env('DB_HOST')),
        'token_port' => env('DB_TOKEN_PORT', 3306),
        'aws_region' => env('AWS_REGION', 'us-east-1'),

        'charset' => 'utf8mb4',
        'collation' => 'utf8mb4_unicode_ci',
        'prefix' => '',
    ],
],
```

No `password` is set — it is replaced at connect time by a freshly generated IAM token.

### AWS credentials

[](#aws-credentials)

The IAM token is signed with the default AWS credential provider chain (`Aws\Credentials\CredentialProvider::defaultProvider()`), so it works with environment variables, an EC2/ECS/EKS instance role, or any standard AWS credential source. No AWS keys are stored by this package.

### AWS-side setup (once)

[](#aws-side-setup-once)

1. Enable **IAM database authentication** on the RDS instance / cluster (and on the RDS Proxy if used).
2. Create a database user that authenticates with the AWS plugin, for example: `CREATE USER 'iam_user'@'%' IDENTIFIED WITH AWSAuthenticationPlugin AS 'RDS';`
3. Grant the IAM principal permission to connect with an `rds-db:connect` policy scoped to that database user.

How it works (load order)
-------------------------

[](#how-it-works-load-order)

Registration is **order-independent**. The connector is bound in the container as `db.connector.mysql-iam-proxy` (which Laravel's `ConnectionFactory` resolves automatically), and the connection itself is registered through `Illuminate\Database\Connection::resolverFor()`. Because both live outside the resolved `db` manager, the driver is ready the moment the service provider's `register()` runs — you do **not** need to reorder providers, even if another provider resolves the database very early.

The PDO connection (and therefore the IAM token) is created **lazily** on first query, keeping the token close to its use within its ~15-minute validity window and preserving Laravel's reconnect and read/write connection behavior.

Options
-------

[](#options)

Each option can be set on the Laravel connection array and, as a fallback, via an environment variable.

OptionEnv fallbackDefaultDescription`host``DB_HOST`— (required)Host Laravel connects to (tunnel/proxy).`port``DB_PORT``3306`Port Laravel connects to.`database``DB_DATABASE`—Default database.`username``DB_USERNAME`— (required)IAM-enabled database user.`token_host``DB_TOKEN_HOST``host`Host used to sign the IAM token.`token_port``DB_TOKEN_PORT``port`Port used to sign the IAM token.`aws_region``AWS_REGION``us-east-1`Region for token signing.`ssl_ca``DB_SSL_CA`—Path to a CA bundle for TLS.`ssl_verify``DB_SSL_VERIFY``true`Verify the server certificate.`connect_timeout``DB_CONNECT_TIMEOUT``5`PDO connect timeout (seconds).`force_readonly``DB_FORCE_READONLY``false`Force a read-only, safe-updates session.`session_init_statements``DB_SESSION_INIT_STATEMENTS`—`;`-separated string or array of SQL to run on connect.`enable_cleartext_plugin`—`true`Enable the MySQL cleartext auth plugin (required for IAM).Security notes
--------------

[](#security-notes)

- The IAM token and `password` are never written to logs.
- TLS is on by default; point `ssl_ca` at the [Amazon RDS CA bundle](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html)and keep `ssl_verify` enabled in production.
- The MySQL **cleartext auth plugin** is enabled because IAM authentication sends the token as a cleartext password over the (TLS-encrypted) connection. This is required by RDS IAM auth and is safe as long as TLS is used.

Testing
-------

[](#testing)

```
composer install
composer test        # phpunit
composer analyse     # phpstan
composer format:test # pint --test
```

Contributing
------------

[](#contributing)

Issues and pull requests are welcome at .

License
-------

[](#license)

The MIT License (MIT). See [LICENSE](LICENSE).

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance83

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~80 days

Total

3

Last Release

175d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7323066?v=4)[paeire](/maintainers/paeire)[@paeire](https://github.com/paeire)

---

Top Contributors

[![savalosAdinstra](https://avatars.githubusercontent.com/u/114181079?v=4)](https://github.com/savalosAdinstra "savalosAdinstra (6 commits)")

### Embed Badge

![Health badge](/badges/paeire-laravel-rds-proxy-iam/health.svg)

```
[![Health](https://phpackages.com/badges/paeire-laravel-rds-proxy-iam/health.svg)](https://phpackages.com/packages/paeire-laravel-rds-proxy-iam)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M322](/packages/laravel-ai)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45844.8k1](/packages/pressbooks-pressbooks)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

265.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
