Skip to content

S3 module#

Index > S3

Auto-generated documentation for S3 type annotations stubs module types-boto3-s3.

How to install#

You can generate type annotations for boto3 package locally with mypy_boto3_builder. Use uv for build isolation.

  1. Run mypy-boto3-builder in your package root directory: uvx --with 'boto3==1.35.86' mypy_boto3_builder
  2. Select boto3 AWS SDK.
  3. Add S3 service.
  4. Use provided commands to install generated packages.

VSCode extension#

Add AWS Boto3 extension to your VSCode and run AWS boto3: Quick Start command.

Click Modify and select boto3 common and S3.

From PyPI with pip#

Install types-boto3 for S3 service.

# install with boto3 type annotations
python -m pip install 'types-boto3[s3]'

# Lite version does not provide session.client/resource overloads
# it is more RAM-friendly, but requires explicit type annotations
python -m pip install 'types-boto3-lite[s3]'

# standalone installation
python -m pip install types-boto3-s3

How to uninstall#

python -m pip uninstall -y types-boto3-s3

Usage#

Code samples can be found in Examples.

S3Client#

Type annotations and code completion for boto3.client("s3") as S3Client boto3 documentation

# S3Client usage example

from boto3.session import Session

from types_boto3_s3.client import S3Client

def get_client() -> S3Client:
    return Session().client("s3")

Paginators#

Type annotations and code completion for paginators from boto3.client("s3").get_paginator("...").

# ListBucketsPaginator usage example

from boto3.session import Session

from types_boto3_s3.paginator import ListBucketsPaginator

def get_list_buckets_paginator() -> ListBucketsPaginator:
    return Session().client("s3").get_paginator("list_buckets"))

Waiters#

Type annotations and code completion for waiters from boto3.client("s3").get_waiter("...").

# BucketExistsWaiter usage example

from boto3.session import Session

from types_boto3_s3.waiter import BucketExistsWaiter

def get_bucket_exists_waiter() -> BucketExistsWaiter:
    return Session().client("s3").get_waiter("bucket_exists")

S3ServiceResource#

Type annotations and code completion for boto3.resource("s3") as S3ServiceResource boto3 documentation

# S3ServiceResource usage example

from boto3.session import Session

from types_boto3_s3.service_resource import S3ServiceResource

def get_s3_resource() -> S3ServiceResource:
    return Session().resource("s3")

Collections#

Type annotations and code completion for collections from boto3.resource("s3").*.

# ServiceResourceBucketsCollection usage example

from boto3.session import Session

from types_boto3_s3.service_resource import ServiceResourceBucketsCollection

def get_collection() -> ServiceResourceBucketsCollection:
    return Session().resource("s3").buckets

Resources#

Type annotations and code completion for additional resources from session.resource("s3").*.

# Bucket usage example

from types_boto3_s3.service_resource import Bucket

def get_resource() -> Bucket:
    return resource.Bucket(...)

Literals#

Type annotations for literals used in methods and schema.

# AnalyticsS3ExportFileFormatType usage example

from types_boto3_s3.literals import AnalyticsS3ExportFileFormatType

def get_value() -> AnalyticsS3ExportFileFormatType:
    return "CSV"

Type definitions#

Type annotations for type definitions used in methods and schema.