sigv4
Sign AWS HTTP requests with AWS Signature Version 4 — no boto3 or botocore required.
Supports IRSA (IAM Roles for Service Accounts on EKS), ECS task roles, EC2 instance profiles, environment variables, and ~/.aws/credentials. Zero Python package dependencies (pure stdlib).
Installation
# uv
uv add sigv4
# pip
pip install sigv4
Quick Start
High-level API (recommended)
import aiohttp
from sigv4 import Signer
signer = Signer(region="us-east-1", service="execute-api")
# Pre-warm credentials at startup (optional — avoids latency on first request)
signer.credentials.refresh()
# Later, sign any HTTP request:
url = "https://api-id.execute-api.us-east-1.amazonaws.com/stage/resource"
auth_headers = signer.sign(method="GET", url=url)
# Merge auth_headers into your request:
async with aiohttp.ClientSession() as session:
async with session.get(url, headers=auth_headers) as resp:
data = await resp.json()
Low-level API (zero I/O, predictable latency)
from sigv4 import Credentials, sign_headers
# Manage credentials yourself (e.g. fetched via your own IRSA logic)
creds = Credentials(
access_key="AKIAIOSFODNN7EXAMPLE",
secret_key="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
token="optional-session-token",
)
# Pure computation — no I/O, microseconds
headers = sign_headers(
method="POST",
url="https://dynamodb.us-east-1.amazonaws.com/",
headers={"host": "dynamodb.us-east-1.amazonaws.com", "content-type": "application/x-amz-json-1.0"},
body=b'{"TableName": "MyTable"}',
region="us-east-1",
service="dynamodb",
credentials=creds,
)
# headers = {"Authorization": "AWS4-HMAC-SHA256 ...", "X-Amz-Date": "..."}
Credential Chain
Credentials are resolved in this order:
- Environment variables —
AWS_ACCESS_KEY_ID+AWS_SECRET_ACCESS_KEY+ optionalAWS_SESSION_TOKEN - IRSA (EKS) —
AWS_WEB_IDENTITY_TOKEN_FILE+AWS_ROLE_ARN→ STSAssumeRoleWithWebIdentity - Config file —
~/.aws/credentialsand~/.aws/config(respectsAWS_PROFILE) - Container credential endpoint —
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI/AWS_CONTAINER_CREDENTIALS_FULL_URI(ECS task roles, EKS Pod Identity, and compatible runtimes) - EC2 instance profile — IMDSv2 at
169.254.169.254
Observability and Pre-warming
from sigv4 import resolve_credentials
creds = resolve_credentials()
# Check state
print(creds.is_ready) # False until first fetch
print(creds.needs_refresh) # True if in advisory refresh window
print(creds.expires_at) # datetime | None
# Pre-warm (blocks until credentials are fetched)
creds.refresh()
print(creds.is_ready) # True
Metadata
Release files for sigv4 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sigv4-0.1.0.tar.gz | 15.0 kB | Without provenance | Details for sigv4-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sigv4-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sigv4-0.1.0-py3-none-any.whl |
Total release size: 36.2 kB
Release files / sigv4-0.1.0.tar.gz
| Download URL | sigv4-0.1.0.tar.gz |
|---|---|
| Size | 15.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
194d918da8d6152e905401312c488e592f87472bb5a600ca3acf4561993d4ce2
|
|
BLAKE2b-256 checksum How to use checksums |
277a5100be39db3caec6e3389dbee3b0b22d8adbc8e5a9e8846957c601ad0547
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / sigv4-0.1.0-py3-none-any.whl
| Download URL | sigv4-0.1.0-py3-none-any.whl |
|---|---|
| Size | 21.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f81a83414a3def13d234dc8613c7f8add8617f2dfcf519a1811f6a731c9bfbb2
|
|
BLAKE2b-256 checksum How to use checksums |
0bf017200def16367ddedeb2bc4a3f38efda1a74db34288101e22e21283b1ac0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for sigv4 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.