Registry / aws / boto3
sdk1.43.80pypypi✓ verified 26d ago

Official AWS SDK for Python. Extremely stable API — no breaking changes since v1.0. Two client styles: low-level client (boto3.client()) and high-level resource (boto3.resource()). Credential resolution follows a fixed chain. Region must be specified or set in environment — no global default. Released daily with new AWS service additions.

pip install boto3
INSTALL
IMPORT
SIG · BOTO3
B
boto3
awspythonv1.43.80
Install
4.0s avg
Import
895ms
Disk
62MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.43.80 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.960 runs
installs and imports cleanly · install 0.0s · import 0.947s · 63.1MB
glibc
py 3.103.960 runs
installs and imports cleanly · install 4.0s · import 0.842s · 64MB
62MB installed
● package 62MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

boto3.client (low-level)
import boto3 # Explicit credentials (not recommended for production) client = boto3.client( 's3', region_name='us-east-1', aws_access_key_id='KEY', aws_secret_access_key='SECRET' ) # Preferred: let credential chain resolve client = boto3.client('s3', region_name='us-east-1')
import boto3 client = boto3.client('s3')
Omitting region_name raises NoRegionError for most services unless AWS_DEFAULT_REGION is set.
boto3.Session (multi-profile)
import boto3 session = boto3.Session( profile_name='my-profile', region_name='eu-west-1' ) client = session.client('dynamodb')
boto3.setup_default_session(profile_name='my-profile')
setup_default_session() modifies global state — unsafe in multi-threaded apps. Use Session() instead.

Credential chain order: (1) explicit in code, (2) env vars AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY, (3) ~/.aws/credentials, (4) ~/.aws/config, (5) EC2/ECS instance metadata.

import boto3 from botocore.exceptions import ClientError, NoCredentialsError # Credential chain: env vars → ~/.aws/credentials → IAM role → ... # Set AWS_DEFAULT_REGION or pass region_name explicitly client = boto3.client('s3', region_name='us-east-1') try: # List buckets response = client.list_buckets() for bucket in response['Buckets']: print(bucket['Name']) except NoCredentialsError: print('No AWS credentials found') except ClientError as e: print(f"Error: {e.response['Error']['Code']}: {e.response['Error']['Message']}")
Debug
Known issues
gotchaRegion is not globally defaulted. Calling boto3.client('s3') without region_name and without AWS_DEFAULT_REGION raises botocore.exceptions.NoRegionError. This is the most common source of 'it works on my machine' failures when deploying to CI/CD.
fix
Always pass region_name= explicitly, or set AWS_DEFAULT_REGION in the environment.
affects: all
gotchaNoCredentialsError means the credential chain was exhausted — no credentials found anywhere. Common in CI/CD when AWS_ACCESS_KEY_ID is set but AWS_SECRET_ACCESS_KEY is missing, or when ~/.aws/credentials exists locally but not in the deployment environment.
fix
Check all chain links: env vars (both KEY and SECRET required), ~/.aws/credentials format, IAM instance role attachment.
affects: all
gotchaboto3.client() and boto3.resource() return different objects with different APIs. S3 client uses client.put_object(), resource uses s3.Object().put(). Mixing client and resource patterns causes AttributeError.
fix
Choose one pattern per codebase. boto3.resource() is higher-level but covers fewer services. boto3.client() covers all services.
affects: all
gotchaPinning boto3 without pinning botocore (or vice versa) causes version conflicts. boto3 and botocore ship together daily and must stay version-compatible.
fix
Pin both: boto3==X.Y.Z botocore==A.B.C. Check boto3's setup.py for the exact botocore version it requires.
affects: all
gotchaClientError contains all AWS service errors. The error code is at e.response['Error']['Code'], not as a Python exception type. Catching specific AWS errors requires checking this string.
fix
except ClientError as e: if e.response['Error']['Code'] == 'NoSuchBucket': ...
affects: all
gotchaboto3.setup_default_session() modifies global state and is not thread-safe. In multi-threaded or async applications, concurrent calls with different credentials will interfere.
fix
Use boto3.Session() to create isolated sessions per thread/coroutine.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'boto3'
The boto3 library is not installed in the Python environment where the code is being executed, or the active Python interpreter does not have access to it.
fix
Install boto3 using pip: `pip install boto3` (or `python -m pip install boto3` to ensure it's installed for the correct Python interpreter).
botocore.exceptions.NoCredentialsError: Unable to locate credentials
boto3 cannot find the necessary AWS credentials to authenticate requests to AWS services. This occurs when credentials are not configured via environment variables, the AWS credentials file (~/.aws/credentials), or IAM roles.
fix
Configure your AWS credentials using the AWS CLI (`aws configure`), by setting `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` environment variables, or by ensuring the application runs on an EC2 instance with an appropriate IAM role.
botocore.exceptions.ParamValidationError: Parameter validation failed: Invalid type for parameter ...
A parameter passed to a boto3 client method does not meet the expected type, format, or value required by the AWS service API.
fix
Review the boto3 documentation for the specific service and operation to ensure all parameters are of the correct data type, format, and within valid ranges. Upgrade boto3 if using an older version that might not support newer parameters.
AttributeError: 'S3' object has no attribute 'Bucket'
This error typically occurs when attempting to use high-level resource-style methods (like `.Bucket()`) on a low-level client object (created with `boto3.client('s3')`) instead of a high-level resource object (created with `boto3.resource('s3')`).
fix
Instantiate an S3 resource object using `s3 = boto3.resource('s3')` to access high-level abstractions like `s3.Bucket('your-bucket-name').objects.all()`. If low-level API calls are needed, use `s3_client = boto3.client('s3')` and call methods like `s3_client.list_buckets()`.
botocore.exceptions.NoRegionError: You must specify a region.
Boto3 requires an AWS region to be specified but could not find one through environment variables, configuration files, or direct parameter.
fix
client = boto3.client('s3', region_name='us-east-1')
# Or export AWS_REGION=us-east-1
Upgrade
Version history
1.43.80latest on PyPI · released Aug 25, 2026
Audit
Dependencies
botocorerequiredCore HTTP client, credential management, and service definitions. Installed automatically. boto3 and botocore versions must stay in sync — pinning one without the other causes ImportError.
s3transferrequiredMultipart S3 transfers. Installed automatically.
Agent activity
49 hits · last 30 days
node
42
Amazon
1
OpenAI (training)
1
Resources