Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1191c20
build(deps): bump @mermaid-js/layout-elk from 0.1.9 to 1.0.1 in /site…
dependabot[bot] Oct 13, 2026
86c867d
build(deps): keep @mermaid-js/layout-elk at 0.1.9 (#36)
dependabot[bot] Oct 13, 2026
34d9eca
build(deps): bump actions/setup-node from 7.0.0 to 7.1.0 (#37)
dependabot[bot] Oct 13, 2026
26e16c5
build(deps): bump shell-quote from 1.10.0 to 1.12.0 in /site (#38)
dependabot[bot] Oct 13, 2026
cde5612
build(deps): bump source-map-js from 1.2.1 to 1.2.2 in /site (#39)
dependabot[bot] Oct 13, 2026
5052474
docs - main (ruby): correct how iam_expiration_sec controls the IAM t…
aaron-congo Oct 13, 2026
b5cc109
docs(ruby): link the KMS trigger SQL from the wrapper repo and docume…
aaron-congo Oct 21, 2026
81c2a32
build(deps): bump follow-redirects from 1.16.0 to 1.16.1 in /site (#47)
dependabot[bot] Oct 23, 2026
39ab1ec
build(deps): bump dompurify from 3.4.16 to 3.4.17 in /site (#49)
dependabot[bot] Oct 23, 2026
092e790
build(deps): bump launch-editor from 2.14.1 to 2.14.2 in /site (#48)
dependabot[bot] Oct 23, 2026
0576b47
docs - main (ruby): declare the gems Ruby 3.4 dropped, and make the f…
karenc-bq Oct 28, 2026
5add550
build(deps): bump fast-uri from 3.1.8 to 3.1.9 in /site (#52)
dependabot[bot] Nov 2, 2026
145547e
build(deps): bump actions/setup-python from 7.0.0 to 7.1.0 (#50)
dependabot[bot] Nov 2, 2026
dcbdbdd
build(deps): bump the site-minor-and-patch group across 1 directory w…
dependabot[bot] Nov 2, 2026
e5656df
build(deps): bump joi from 17.13.8 to 17.13.9 in /site (#57)
dependabot[bot] Nov 2, 2026
37f5113
build(deps): bump postcss-selector-parser from 6.1.4 to 6.1.5 in /sit…
dependabot[bot] Nov 2, 2026
b6d9ffe
build(deps): bump body-parser from 1.20.8 to 1.20.9 in /site (#55)
dependabot[bot] Nov 2, 2026
2312505
build(deps): bump follow-redirects from 1.16.1 to 1.16.2 in /site (#53)
dependabot[bot] Nov 2, 2026
0d8b363
build(deps): bump qs from 6.16.0 to 6.16.2 in /site (#54)
dependabot[bot] Nov 2, 2026
1fe8ef2
Merge branch 'main' into ruby/1.1.0
aaron-congo Nov 4, 2026
9ee33a1
docs(ruby): adapt main's changes to 1.1.0
aaron-congo Nov 4, 2026
3cbce6f
docs(ruby): address review comments
aaron-congo Nov 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ updates:
labels:
- "dependencies"
- "javascript"
ignore:
# @mermaid-js/layout-elk is a dependency of @docusaurus/theme-mermaid, which
# requires ^0.1.9. A previous Dependabot PR bumped it which breaks `npm install`
# (ERESOLVE) and the Docusaurus build. Block major and minor bumps until
# theme-mermaid declares support for them. Remove this entry when that happens.
- dependency-name: "@mermaid-js/layout-elk"
update-types:
- "version-update:semver-major"
- "version-update:semver-minor"
groups:
site-minor-and-patch:
patterns:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: '3.11'
cache: pip
Expand All @@ -57,7 +57,7 @@ jobs:
run: python generate.py

- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '20'
cache: npm
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/verify-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: '3.11'
cache: pip
Expand Down Expand Up @@ -75,7 +75,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: '20'
cache: npm
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Each wrapper's documentation is grouped into the same sections:

| Section | What's in it |
|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Overview** | What the wrapper is and how to install it. |
| **Overview** | What the wrapper is, how to install it, and one complete program that connects and runs a query. The page to read first. |
| **Set up by Scenario** | An interactive builder — answer a few questions about your application and get a working configuration. |
| **Using Plugins** | One page per feature plugin (Failover, IAM Authentication, AWS Secrets Manager, Blue/Green, KMS Encryption, and so on), describing what the plugin does and every parameter it accepts. |
| **Shared Configuration** | Cross-cutting settings — TLS/SSL, AWS credentials resolution, host selection strategies — that more than one plugin relies on. |
Expand Down
160 changes: 124 additions & 36 deletions content/failover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,22 @@ wrappers:
# optional heading and an ordered list of blocks; a block is either prose
# (`text`) or a fenced code sample (`code` + `lang`).
#
# Active Record comes first because the adapters are the wrapper's primary
# integration: changing the adapter name is the whole change. The gem name
# matches its entry point file, so Bundler's default require loads it.
# Active Record leads because most Ruby users arrive through it: the adapters
# are the wrapper's primary integration and changing the adapter name is the
# whole change. The driver-direct path follows under an unnumbered "Or ..."
# heading, which is where an alternative goes in this style.
#
# The driver-direct block is a whole working program, not a fragment. A
# reader who copies it has a process that connects, queries and exits, with
# no gaps to fill from elsewhere on the site: the exact gem name, the exact
# require path, the constructor, the query call, and the teardown are all
# present. Fragments cost a reader (and an agent reading on their behalf) an
# edit-and-rerun loop per gap, which is the most expensive thing a
# getting-started page can do. The Active Record path cannot be shown that
# way because it needs a Rails application around it, so the two paths are
# ordered by who the reader is, not by what fits in one file.
gettingStarted:
note: "Requires Ruby 3.3 or later. Tested with Active Record 7.2, 8.0, and 8.1, `pg` 1.6.3 or later, and `mysql2` 0.5.7 or later."
note: "Requires Ruby 3.3 or later. The gem is `aws_advanced_ruby_driver_wrapper` on RubyGems. Tested with Active Record 7.2, 8.0, and 8.1, `pg` 1.6.3 or later, and `mysql2` 0.5.7 or later."
steps:
- title: "1. Add the gem"
blocks:
Expand All @@ -87,17 +98,71 @@ wrappers:
code: |
bundle install
- text: >-
Bundler requires the gem for you (in a plain Ruby script, add
`require 'aws_advanced_ruby_driver_wrapper'`). That single require
registers the Active Record adapters and makes the connection classes,
error classes, and other public API available for direct use.
Without Bundler, `gem install aws_advanced_ruby_driver_wrapper pg`
does the same thing.
# The house pattern for "this needs another gem" is a warning with
# its own snippet, as on the IAM and Secrets Manager pages, rather
# than commented lines inside the main Gemfile. The wrapper itself
# declares every gem it requires, so this warning is only for a gem
# `mysql2` requires on Windows without declaring it.
- text: |
:::warning
If you are using `mysql2` on Windows with Ruby 4.0 or later, you may also need to add `fiddle` to your Gemfile:

```ruby
gem 'fiddle'
```

On Windows, `mysql2` uses `fiddle` to load `libmysql.dll` when you set
`RUBY_MYSQL2_LIBMYSQL_DLL`, when the gem ships its own `libmysql.dll`, or
when Ruby was not installed with RubyInstaller, but it does not declare
`fiddle` as a dependency. Ruby 4.0 removed `fiddle` from the default gems,
so in those cases a bundle without it raises `LoadError` when `mysql2` is
required.
:::

- title: "2. Point Active Record at your cluster"
blocks:
- text: >-
The wrapper registers two adapters, `aws_postgresql` and `aws_mysql2`,
which are drop-in replacements for `postgresql` and `mysql2`. Change the
adapter name and point the host at your cluster endpoint:
which are drop-in replacements for `postgresql` and `mysql2`.
# Without this, Active Record raises AdapterNotFound and names only
# its own built-in adapters, which does not hint that a require is
# missing. Bundler covers the Rails case; a plain script does not.
- text: >-
Bundler requires the gem for you. In a plain Ruby script, add
`require 'aws_advanced_ruby_driver_wrapper'` first: that single require
is what registers both adapters, and without it Active Record reports
`aws_postgresql` as a nonexistent adapter.
- text: >-
If you are starting without a Rails application, add
`gem 'activerecord'` to the Gemfile from step 1 (outside Rails, nothing
else installs it), run `bundle install`, and this is a complete program.
Save it as `main.rb` and run it:
- lang: ruby
code: |
# main.rb
require 'active_record'
require 'aws_advanced_ruby_driver_wrapper'

ActiveRecord::Base.establish_connection(
adapter: 'aws_postgresql',
host: 'my-cluster.cluster-xyz.us-east-1.rds.amazonaws.com',
database: 'mydb',
username: '<username>',
password: '<password>',
wrapper_plugins: 'failover'
)

puts ActiveRecord::Base.connection.select_value('SELECT version()')
- lang: bash
code: |
bundle exec ruby main.rb
- text: >-
In a Rails application the same keys go in `config/database.yml`
instead, and Bundler has already done the require. The adapter name
is the only key that changes; leave the host as whichever endpoint
you already connect to:
- lang: yaml
code: |
# config/database.yml
Expand All @@ -108,13 +173,10 @@ wrappers:
username: <username>
password: <password>
- text: >-
That is the whole change — no application code moves. When
`wrapper_plugins` is not set, the wrapper loads `failover` and
`initial_connection`, so connections made through this adapter already
recover when the cluster promotes a new writer. Enable more by adding
wrapper properties alongside the Active Record keys. Setting
`wrapper_plugins` replaces the default list rather than adding to it, so
list the defaults you want to keep:
That is the whole change — no application code moves, and
connections made through this adapter already recover when the
cluster promotes a new writer. Wrapper properties go alongside the
Active Record keys, under the same connection:
- lang: yaml
code: |
production:
Expand All @@ -123,6 +185,10 @@ wrappers:
wrapper_plugins: failover,initial_connection,iam
iam_region: us-east-1
failover_timeout_sec: 300.0 # seconds
- text: >-
`wrapper_plugins` is optional — leaving it out loads
`failover,initial_connection`. Setting it replaces the default list
rather than adding to it, so list the defaults you want to keep.
- text: >-
Active Record keeps its own connection pool and its reading and writing
roles; the wrapper's plugins run underneath both.
Expand All @@ -134,16 +200,28 @@ wrappers:
(`aws_postgresql`/`aws_mysql2`), a custom type registered for one is shared
with the other, because both resolve under the same underlying adapter key.
:::
- text: |
:::note Keeping the password out of your source
Read it from the environment with `ENV.fetch('PGPASSWORD')` in Ruby, or
`<%= ENV.fetch('PGPASSWORD') %>` in `config/database.yml`, or have
AWS manage it: add `secrets_manager` to `wrapper_plugins` and drop the
`password:` key, as described on
[AWS Secrets Manager Plugin](using-plugins/aws-secrets-manager). For a
database user with no password at all, consider using `iam` instead; see
[IAM Authentication Plugin](using-plugins/iam-authentication).
:::

- title: "Or connect with the driver directly"
blocks:
- text: >-
If you use the `pg` or `mysql2` gem without Active Record, the wrapper
provides connection classes that stand in for `PG::Connection` and
`Mysql2::Client`:
Without Active Record, the wrapper provides connection classes that
stand in for `PG::Connection` and `Mysql2::Client`. This is a complete
program; save it as `main.rb` and run it:
- lang: ruby
code: |
# PostgreSQL (pg)
# main.rb
require 'aws_advanced_ruby_driver_wrapper/postgresql'

conn = AwsAdvancedRubyDriverWrapper::WrapperPgConnection.new(
host: 'my-cluster.cluster-xyz.us-east-1.rds.amazonaws.com',
dbname: 'mydb',
Expand All @@ -152,27 +230,37 @@ wrappers:
wrapper_plugins: 'failover',
failover_timeout_sec: 300.0
)
- lang: ruby

begin
result = conn.exec('SELECT version()')
puts result.first['version']
ensure
conn.close
end
- lang: bash
code: |
# MySQL (mysql2)
conn = AwsAdvancedRubyDriverWrapper::WrapperMysql2Client.new(
host: 'my-cluster.cluster-xyz.us-east-1.rds.amazonaws.com',
database: 'mydb',
username: '<username>',
password: '<password>',
wrapper_plugins: 'failover',
failover_timeout_sec: 300.0
)
bundle exec ruby main.rb
- text: >-
The calls your code already makes on the driver connection keep working,
and the plugins act on each one.

For PostgreSQL, `require 'aws_advanced_ruby_driver_wrapper/postgresql'`
and use `AwsAdvancedRubyDriverWrapper::WrapperPgConnection`, which
stands in for `PG::Connection` and takes `dbname:` and `user:`.
For MySQL, `require 'aws_advanced_ruby_driver_wrapper/mysql'` and use
`AwsAdvancedRubyDriverWrapper::WrapperMysql2Client`, which stands in
for `Mysql2::Client` and takes `database:` and `username:`. Either
way the calls your code already makes keep working, and the plugins
act on each one.
- title: "Next"
blocks:
- text: >-
The wrapper supports other plugins and wrapper properties. For
further information see the plugin pages, starting with
[Enhanced Failover Plugin](enhanced-failover). Every wrapper property
the examples did not use is listed with its type, default and unit on
the plugin page that reads it. To check a combination before shipping,
see [Plugin Compatibility](compatibility).
- text: >-
Not sure which plugins you need? [Set up by Scenario](setup) builds a
configuration from a few questions about your application. To check a
combination before shipping, see [Plugin Compatibility](compatibility).
configuration from a few questions about your application.

parameters:
- concept: failoverMode
Expand Down
Loading
Loading