All skills

Advises on Amazon RDS open-source engines (MySQL, MariaDB, PostgreSQL) for instance creation, upgrade planning, commitment pricing, proxy evaluation, and Blue/Green deployments. Handles any RDS MySQL, MariaDB, or PostgreSQL question, including create a production-ready RDS MySQL instance, provision an RDS PostgreSQL database, run the RDS upgrade advisor for my RDS MySQL instance, what are my upgrade options, upgrade RDS MariaDB from 10.6 to the latest version, should I buy reserved instances or a savings plan for db.r7g.2xlarge RDS MySQL, change a VARCHAR to INT column on RDS MySQL 8.0 with Blue/Green, and does RDS Proxy help when PgBouncer already runs in transaction mode. Covers instance creation with production best practices, describe-db-instances and describe-db-engine-versions upgrade-target workflow, live prechecks via SSM or direct connection, RI versus DSP commitment pricing, RDS Proxy versus PgBouncer, and Blue/Green lifecycle with binlog replay compatibility.

Use this Skill: https://skilld.dev/gh/aws/agent-toolkit-for-aws/rds-oss

This session only. Nothing lands on disk.

referencesproxy-pinning-postgresql.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

PostgreSQL RDS Proxy Pinning Risks

RDS Proxy for PostgreSQL uses connection multiplexing at the session level. Certain PostgreSQL features create session state that prevents the proxy from reusing backend connections.

High Pinning Risk (defeats proxy purpose)

Pattern Why It Pins Diagnostic Query
Prepared statements (PREPARE/EXECUTE) Server-side prepared state is session-scoped SELECT name, statement FROM pg_prepared_statements; (run per-session)
Advisory locks (pg_advisory_lock) Lock is held on a specific backend SELECT * FROM pg_locks WHERE locktype = 'advisory';
LISTEN/NOTIFY LISTEN registers on a specific backend connection SELECT * FROM pg_listening_channels();
SET (session parameters) e.g., SET search_path, SET work_mem — session-scoped SHOW search_path; — if app sets this per-connection, every connection pins
Temporary tables Session-scoped, can't be transferred Check application code for CREATE TEMP TABLE
DECLARE CURSOR WITH HOLD (without CLOSE) Holdable cursor survives the transaction and is session-scoped Check for open holdable cursors: SELECT * FROM pg_cursors WHERE is_holdable = true;
Sequence manipulation (CURRVAL) CURRVAL depends on session's last NEXTVAL call Check application code for CURRVAL() usage

Medium Pinning Risk

Pattern Notes
SET LOCAL (transaction-scoped) Pins only for transaction duration. Less impactful than SET (session).
SAVEPOINT Pins for transaction duration. Fine if transactions are short.
Large result sets with cursors Pins until cursor is closed. Use LIMIT/OFFSET instead.
SET ROLE / SET SESSION AUTHORIZATION Pins for session duration.

Low / No Pinning Risk

Pattern Notes
Simple queries (SELECT, INSERT, UPDATE, DELETE) No session state. Full multiplexing.
Autocommit single statements No pinning.
PL/pgSQL functions (without session state) Executed server-side, no pinning.
COPY (bulk load) No pinning after completion.

PostgreSQL-Specific Gotchas

search_path

Many ORMs and frameworks set search_path per connection. This pins every connection. Mitigation:

  • Set search_path in the proxy's init query instead of per-connection
  • Or set it in the PostgreSQL parameter group as the default

Extended query protocol

PostgreSQL's extended query protocol (Parse/Bind/Execute) creates server-side prepared statements implicitly. Many drivers (libpq, JDBC, node-postgres) use this by default. This causes pinning.

Mitigation:

  • JDBC: set prepareThreshold=0 to disable server-side prepared statements
  • node-postgres: avoid passing a name property in query config objects (named queries create persistent server-side prepared statements that pin connections)
  • Python psycopg2: uses simple query protocol by default (no pinning)
  • Python psycopg3: uses extended protocol by default (pins) — set prepare_threshold=None

PgBouncer vs RDS Proxy

If already using PgBouncer in transaction mode, RDS Proxy adds little value — both do connection multiplexing. RDS Proxy's advantage is managed infrastructure + IAM auth + automatic failover handling. But PgBouncer in transaction mode is more aggressive at multiplexing (no pinning on SET).

Diagnostic: Check Pinning Potential

Run these on the database to estimate pinning risk before deploying proxy:

-- Check for advisory locks
SELECT COUNT(*) AS advisory_locks FROM pg_locks WHERE locktype = 'advisory';

-- Check for active LISTEN channels
SELECT COUNT(*) AS listen_channels FROM pg_listening_channels();

-- Check for prepared statements (current session — ask app team to check during peak)
SELECT COUNT(*) AS prepared_stmts FROM pg_prepared_statements;

-- Check for temp tables in current sessions
SELECT COUNT(*) AS temp_tables FROM pg_class WHERE relpersistence = 't';

-- Check for open cursors
SELECT COUNT(*) AS open_cursors FROM pg_cursors WHERE is_holdable = true;

Mitigation Strategies

  1. Move search_path to proxy init query or parameter group default
  2. Disable server-side prepared statements in the driver (see above)
  3. Replace advisory locks with application-level locking (Redis, DynamoDB)
  4. Replace LISTEN/NOTIFY with SQS, SNS, or EventBridge
  5. Avoid DECLARE CURSOR WITH HOLD — use LIMIT/OFFSET or keyset pagination
  6. Keep transactions short to minimize pin duration

Source: SKILL.md on GitHub

No alerts3mo3 checks · Risk SAFE
  • Gen Agent Trust Hub3mo

    This skill is a specialized advisor for Amazon RDS open-source engines, providing workflows for resource provisioning, upgrades, and cost optimization. It adheres to security best practices by enforcing encryption, multi-factor availability, and secure credential management via AWS Secrets Manager. No malicious patterns were identified.

  • Socket3mo

    No alerts

  • Snyk3mo

    Risk: LOW · No issues

Signed by skilld at aea59f3. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 3 months ago
version
1

README badge

README badge for aws/agent-toolkit-for-aws/rds-oss