Zero Python package dependencies. AWS Signature Version 4 request signing. Supports env vars, IRSA, ECS, EC2, and config file credentials. No boto3 required.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sigv4-0.1.0.tar.gz.
File metadata
- Download URL: sigv4-0.1.0.tar.gz
- Upload date:
- Size: 15.0 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
194d918da8d6152e905401312c488e592f87472bb5a600ca3acf4561993d4ce2
|
|
| MD5 |
13ac135c8bdd6e8f883aa2eae226e986
|
|
| BLAKE2b-256 |
277a5100be39db3caec6e3389dbee3b0b22d8adbc8e5a9e8846957c601ad0547
|
File details
Details for the file sigv4-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sigv4-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.2 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f81a83414a3def13d234dc8613c7f8add8617f2dfcf519a1811f6a731c9bfbb2
|
|
| MD5 |
9ae062d6957586e8cb7c5d06f91219d3
|
|
| BLAKE2b-256 |
0bf017200def16367ddedeb2bc4a3f38efda1a74db34288101e22e21283b1ac0
|