skillfed

pymongo-auth-aws

MONGODB-AWS authentication support for PyMongo

pymongo-auth-aws v1.3.0 2.2M downloads/30d#3,205 on PyPI11
Permissive 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) Active released

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-aws

uv

uv add pymongo-auth-aws

poetry

poetry add pymongo-auth-aws

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Database

Tags

mongodb aws authenticationpymongo iam credentialsmongodb-aws authaws iam mongodb driverpymongo aws iammongodb authentication awsboto3 mongodb auth
aws-iammongodb-auth

More Database packages