{"id":22347643,"url":"https://github.com/pgx-contrib/pgxaws","last_synced_at":"2026-05-05T23:34:09.326Z","repository":{"id":251051448,"uuid":"836088545","full_name":"pgx-contrib/pgxaws","owner":"pgx-contrib","description":"AWS IAM authentication for pgx v5 — RDS, Aurora DSQL, and query caching with DynamoDB \u0026 S3","archived":false,"fork":false,"pushed_at":"2026-05-04T13:34:44.000Z","size":322,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-04T15:34:39.761Z","etag":null,"topics":["aurora","aws","cache","dsql","dynamodb","golang","iam","pgx","postgresql","rds","s3"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/pgx-contrib/pgxaws","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pgx-contrib.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-31T06:13:52.000Z","updated_at":"2026-05-04T13:34:53.000Z","dependencies_parsed_at":"2024-11-08T07:28:58.270Z","dependency_job_id":"44a0e1e3-fbde-42c2-853a-1c514d2d0584","html_url":"https://github.com/pgx-contrib/pgxaws","commit_stats":null,"previous_names":["pgx-contrib/pgxaws"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pgx-contrib/pgxaws","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgx-contrib%2Fpgxaws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgx-contrib%2Fpgxaws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgx-contrib%2Fpgxaws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgx-contrib%2Fpgxaws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pgx-contrib","download_url":"https://codeload.github.com/pgx-contrib/pgxaws/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pgx-contrib%2Fpgxaws/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32672676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aurora","aws","cache","dsql","dynamodb","golang","iam","pgx","postgresql","rds","s3"],"created_at":"2024-12-04T10:10:07.919Z","updated_at":"2026-05-05T23:34:09.321Z","avatar_url":"https://github.com/pgx-contrib.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pgxaws\n\n[![CI](https://github.com/pgx-contrib/pgxaws/actions/workflows/ci.yml/badge.svg)](https://github.com/pgx-contrib/pgxaws/actions/workflows/ci.yml)\n[![Release](https://img.shields.io/github/v/release/pgx-contrib/pgxaws)](https://github.com/pgx-contrib/pgxaws/releases)\n[![Go Reference](https://pkg.go.dev/badge/github.com/pgx-contrib/pgxaws.svg)](https://pkg.go.dev/github.com/pgx-contrib/pgxaws)\n[![License](https://img.shields.io/github/license/pgx-contrib/pgxaws)](LICENSE)\n[![Go Version](https://img.shields.io/github/go-mod/go-version/pgx-contrib/pgxaws)](go.mod)\n[![pgx](https://img.shields.io/badge/pgx-v5-blue)](https://github.com/jackc/pgx)\n[![AWS](https://img.shields.io/badge/AWS-SDK_v2-orange)](https://github.com/aws/aws-sdk-go-v2)\n\nAWS IAM authentication for [pgx v5](https://github.com/jackc/pgx), supporting Amazon RDS and Aurora DSQL connections, plus query caching backends using DynamoDB and S3.\n\n## Features\n\n- **IAM Authentication** for Amazon RDS and Aurora DSQL via `pgx.ConnConfig.BeforeConnect`\n- **Automatic token refresh** — tokens are renewed every 10 minutes in the background\n- **DynamoQueryCacher** — query result caching backed by DynamoDB (implements [pgxcache](https://github.com/pgx-contrib/pgxcache))\n- **S3QueryCacher** — query result caching backed by S3 (implements [pgxcache](https://github.com/pgx-contrib/pgxcache))\n\n## Installation\n\n```bash\ngo get github.com/pgx-contrib/pgxaws\n```\n\n## Usage\n\n### Connector (RDS / DSQL)\n\nThe `Connector` automatically detects whether the host is an RDS or DSQL endpoint and issues the appropriate IAM auth token.\n\n```go\nconfig, err := pgxpool.ParseConfig(os.Getenv(\"PGX_DATABASE_URL\"))\nif err != nil {\n    panic(err)\n}\n\nctx := context.TODO()\n// Create a new pgxaws.Connector\nconnector, err := pgxaws.Connect(ctx)\nif err != nil {\n    panic(err)\n}\n// close the connector\ndefer connector.Close()\n\nconfig.BeforeConnect = connector.BeforeConnect\n\n// Create a new pgxpool with the config\npool, err := pgxpool.NewWithConfig(ctx, config)\nif err != nil {\n    panic(err)\n}\ndefer pool.Close()\n\nrows, err := pool.Query(ctx, \"SELECT * from organization\")\nif err != nil {\n    panic(err)\n}\ndefer rows.Close()\n\ntype Organization struct {\n    Name string `db:\"name\"`\n}\n\nfor rows.Next() {\n    organization, err := pgx.RowToStructByName[Organization](rows)\n    if err != nil {\n        panic(err)\n    }\n    fmt.Println(organization.Name)\n}\n```\n\n### DynamoQueryCacher\n\nCache query results in DynamoDB using [pgxcache](https://github.com/pgx-contrib/pgxcache):\n\n```go\n// Create a new cacher\ncacher := \u0026pgxaws.DynamoQueryCacher{\n    Client: dynamodb.NewFromConfig(cfg),\n    Table:  \"queries\",\n}\n\n// create a new querier\nquerier := \u0026pgxcache.Querier{\n    Options: \u0026pgxcache.QueryOptions{\n        MaxLifetime: 30 * time.Second,\n        MaxRows:     1,\n    },\n    Cacher:  cacher,\n    Querier: conn,\n}\n\nrows, err := querier.Query(context.TODO(), \"SELECT * from customer\")\n```\n\n### S3QueryCacher\n\nCache query results in S3 using [pgxcache](https://github.com/pgx-contrib/pgxcache):\n\n```go\n// Create a new cacher\ncacher := \u0026pgxaws.S3QueryCacher{\n    Client: s3.NewFromConfig(cfg),\n    Bucket: \"queries\",\n}\n\n// create a new querier\nquerier := \u0026pgxcache.Querier{\n    Options: \u0026pgxcache.QueryOptions{\n        MaxLifetime: 30 * time.Second,\n        MaxRows:     1,\n    },\n    Cacher:  cacher,\n    Querier: conn,\n}\n\nrows, err := querier.Query(context.TODO(), \"SELECT * from customer\")\n```\n\n## Development\n\n### DevContainer\n\nOpen in VS Code with the Dev Containers extension. The environment provides Go,\nPostgreSQL 18, and Nix automatically.\n\n```\nPGX_DATABASE_URL=postgres://vscode@postgres:5432/pgxaws?sslmode=disable\n```\n\n### Nix\n\n```bash\nnix develop          # enter shell with Go\ngo tool ginkgo run -r\n```\n\n### Run tests\n\n```bash\n# Unit tests only (no database required)\ngo tool ginkgo run -r\n\n# With integration tests\nexport PGX_DATABASE_URL=\"postgres://localhost/pgxaws?sslmode=disable\"\ngo tool ginkgo run -r\n```\n\nIntegration tests require real AWS infrastructure (RDS/DSQL/DynamoDB/S3) and are skipped automatically when credentials are not set.\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgx-contrib%2Fpgxaws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpgx-contrib%2Fpgxaws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpgx-contrib%2Fpgxaws/lists"}