pymongo-auth-aws
MONGODB-AWS authentication support for PyMongo
What it is and what it does
pymongo-auth-aws is a plugin that extends PyMongo's authentication capabilities to support AWS IAM-based credentials. It bridges PyMongo and AWS by using boto3 and botocore to obtain temporary security tokens and pass them to MongoDB's MONGODB-AWS authentication mechanism. This allows applications running on AWS (EC2, Lambda, ECS, etc.) or with AWS credentials configured locally to authenticate to MongoDB Atlas or self-hosted MongoDB instances without managing long-lived database passwords.
The package is designed as a drop-in extension: once installed, you specify `authMechanism=MONGODB-AWS` in your MongoDB connection string, and pymongo-auth-aws handles credential retrieval and token generation transparently. It supports CPython 3.8+ and PyPy 3.7+, and is actively maintained by MongoDB.
Use it for:
- Authenticate Lambda functions or ECS tasks to MongoDB using their IAM roles without embedding database credentials.
- Connect EC2 instances to MongoDB Atlas using temporary AWS STS tokens instead of static passwords.
- Enable local development with AWS IAM credentials by leveraging boto3's credential chain (environment variables, config files, or IAM roles).
- Simplify credential rotation in applications by relying on AWS IAM's built-in token expiration and refresh.
- Integrate MongoDB authentication into AWS-native applications that already use boto3 for other AWS services.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Enables PyMongo to authenticate to MongoDB using AWS Identity and Access Management (IAM) credentials via the MONGODB-AWS authentication mechanism.
Yes. Install this if you are using PyMongo with MongoDB Atlas or MongoDB instances that support MONGODB-AWS authentication and you want to authenticate using AWS IAM credentials. It has low install friction, is actively maintained, carries no known vulnerabilities, and is licensed permissively. The only prerequisite is that you have AWS credentials available in your environment.
Install
pymongo-auth-aws on PyPI
pip
pip install pymongo-auth-awsuv
uv add pymongo-auth-awspoetry
poetry add pymongo-auth-awsInstalling pymongo-auth-aws
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained as of 2026-08-14 with recent commits; no known vulnerabilities.
License in practice
Apache License 2.0 is permissive; you may use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install pymongo-auth-aws
import pymongo_auth_aws
from pymongo import MongoClient
client = MongoClient('mongodb+srv://<user>@<host>/?authMechanism=MONGODB-AWS')
Requires boto3 and botocore to be installed; AWS credentials must be available in the environment (via IAM role, environment variables, or AWS config file).
Verify before relying
- Whether the package works with all PyMongo versions or requires a specific version range.
- Whether AWS credentials must be configured in the environment or if they can be passed programmatically.
Package facts
| License | Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — boto3, botocore |
| Maintenance | actively maintained — 702 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,213,863/month — #3,205 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pymongo_auth_aws-1.3.0-py3-none-any.whl
Keywords: MONGODB-AWS, mongo, mongodb, pymongo, pymongo-auth-aws
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
pymongoPyMongo is the official MongoDB Python driver,…
permissive · top 1,000 on PyPI
Flask-PyMongoFlask-PyMongo integrates MongoDB database…
permissive · top 15,000 on PyPI
pymongocryptPyMongoCrypt provides Python bindings for…
permissive · top 5,000 on PyPI
mongomockMongomock provides an in-memory mock of MongoDB…
permissive · top 5,000 on PyPI
pymongo_inmemoryProvides an in-memory MongoDB instance for…
permissive · top 15,000 on PyPI
motorMotor provides a non-blocking MongoDB driver…
permissive · top 5,000 on PyPI
aws-requests-authAdds AWS Signature Version 4 authentication to…
permissive · top 1,000 on PyPI
mongoengineMongoEngine provides an Object-Document Mapper…
permissive · top 5,000 on PyPI
bsonEncodes and decodes BSON (Binary JSON) data…
permissive · top 5,000 on PyPI
opentelemetry-instrumentation-pymongoAdds automatic tracing and observability…
permissive · top 5,000 on PyPI