skillfed

aws-bedrock-token-generator

A lightweight library for generating short-term bearer tokens for AWS Bedrock API authentication

aws-bedrock-token-generator v1.1.0 1.1M downloads/30d#4,428 on PyPI17
Permissive license Apache-2.0 AGING released

What it is and what it does

This package wraps AWS credential handling to generate time-limited bearer tokens suitable for authenticating with AWS Bedrock services. Rather than embedding long-term AWS credentials in client applications, you call provide_token() once per session to obtain a short-lived token that encodes a presigned URL with embedded temporary credentials. The token format is bedrock-api-key-<base64-encoded-presigned-url>&Version=1, with a default expiration of 12 hours (configurable up to that maximum). It integrates with botocore's credential providers, so it works with IAM roles, environment variables, assume-role chains, and other standard AWS credential sources.

The library is designed for scenarios where you need to pass authentication to a Bedrock client without exposing raw AWS credentials—for example, when building web services, SDKs, or multi-tenant applications. It handles the complexity of credential expiry negotiation (the actual token lifetime is the minimum of your requested expiry and the underlying AWS credentials' remaining lifetime) and follows AWS security best practices by defaulting to short-lived tokens.

Use it for:

  • Generate temporary tokens for web applications that need to call AWS Bedrock without embedding long-term credentials.
  • Create short-lived tokens for distributing to third-party clients or SDKs that require Bedrock API access.
  • Build multi-tenant SaaS platforms where each tenant receives a scoped, time-limited token instead of shared credentials.
  • Implement token-based authentication in microservices that delegate Bedrock calls to a central credential manager.
  • Rotate credentials frequently by regenerating tokens on a schedule without redeploying application code.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Generates short-term bearer tokens for AWS Bedrock API authentication, eliminating the need to expose long-term credentials in client code.

Yes, if you are building applications that call AWS Bedrock and need to avoid embedding long-term credentials. The package is lightweight, has low install friction, carries a permissive license, and is maintained by AWS. However, it is still in Beta (first release 2025-07-01) and marked as aging (381 days since latest release), so verify token expiry and refresh behavior matches your use case before production deployment.

Install

aws-bedrock-token-generator on PyPI

pip

pip install aws-bedrock-token-generator

uv

uv add aws-bedrock-token-generator

poetry

poetry add aws-bedrock-token-generator

Installing aws-bedrock-token-generator

Before you install

Low friction: pure Python wheel with a single runtime dependency (botocore). Repository is active and maintained, though the package itself is recent (first release 2025-07-01) and marked Beta in development status.

License in practice

Apache License 2.0 (permissive) allows commercial use, modification, and redistribution with minimal restrictions—suitable for most production environments.

Quickstart

pip install aws-bedrock-token-generator

from aws_bedrock_token_generator import provide_token

token = provide_token()  # uses AWS_REGION env var and default credential chain
print(f"Token: {token}")

Requires AWS credentials available to botocore (via environment variables, IAM role, or credential file) and AWS_REGION environment variable for default usage.

Verify before relying

  • Whether token refresh/renewal is supported or tokens must be regenerated after expiry.
  • Performance characteristics when generating tokens at scale or high frequency.
  • Compatibility with non-standard AWS credential providers or custom credential chains.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 1 — botocore
Maintenance aging — 381 days since the last release
Last repo commit
First released
Downloads 1,057,951/month — #4,428 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: aws_bedrock_token_generator-1.1.0-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

AWS Bedrock token generationbearer token authentication AWStemporary credentials bedrockAWS API token generatorbedrock API authenticationshort-term token creationpresigned URL token
aws-integrationtoken-authcredential-management

More Security packages

SecretStorage

Provides Python bindings to the FreeDesktop.org…

permissive · top 1,000 on PyPI

msal

MSAL for Python handles OAuth2 and OpenID…

permissive · top 1,000 on PyPI

joserfc

joserfc implements JOSE standards (JWS, JWE,…

permissive · top 1,000 on PyPI

Authlib

Authlib provides a complete implementation of…

permissive · top 1,000 on PyPI

argon2-cffi-bindings

Provides low-level CFFI bindings to the…

permissive · top 1,000 on PyPI

adal

ADAL for Python authenticates applications with…

permissive · top 1,000 on PyPI

bedrock-agentcore-starter-toolkit

Provides a Python CLI and SDK for scaffolding,…

permissive · top 5,000 on PyPI

awslabs.bedrock-kb-retrieval-mcp-server

An MCP server that connects AI tools to Amazon…

permissive · top 15,000 on PyPI

llama-index-embeddings-bedrock

Provides Amazon Bedrock embedding models…

permissive · top 5,000 on PyPI

opentelemetry-instrumentation-bedrock

Adds distributed tracing to AWS Bedrock API…

permissive · top 5,000 on PyPI

cloudauthz

Cloudauthz obtains temporary credentials from…

permissive · top 15,000 on PyPI

cybrid-api-id-python

Generated Python client for the Cybrid Identity…

permissive · top 15,000 on PyPI

aws-assume-role-lib

Simplifies AWS role assumption in boto3 by…

permissive · top 15,000 on PyPI

bedrock-agentcore

Deploy AI agents to AWS Bedrock AgentCore with…

permissive · top 5,000 on PyPI

aliyun-python-sdk-sts

Provides Python bindings to Aliyun's Security…

permissive · top 15,000 on PyPI

cognitojwt

Decodes and verifies Amazon Cognito JWT tokens…

permissive · top 15,000 on PyPI