Developer Preview: This documentation covers the AWS SDK for Python v4, which is in Developer Preview and intended for evaluation and testing only. Do not use it for production workloads. For production applications, use the AWS SDK for Python (Boto3). To understand the differences between the two SDKs, see Choosing the right AWS SDK for Python.
Amazon S3
Amazon Simple Storage Service (Amazon S3) is an object storage service. You store data as objects in containers called buckets. The pages in this section provide runnable examples for common Amazon S3 tasks. They show how to create and delete buckets, upload and download objects, list and delete objects, use the asynchronous client, handle errors, and verify data with checksums.
The AWS SDK for Python v4 doesn't provide presigned URLs, paginators, waiters, or the Amazon S3 Transfer Manager yet.
Install the Amazon S3 client package.
python -m pip install aws-sdk-s3
Set up the examples
The following examples use a client that you create by calling the create_client() function in the following snippet. Use the client in a with statement, or call client.close() after the last operation, as described in Creating a service client.
Configure an AWS Region and credentials before you run the examples. For more information, see Configuration variables and Credential providers.
For Amazon S3-specific endpoint settings, such as force_path_style, see Amazon S3 endpoint settings.
Imports
from aws_sdk_s3 import S3Client, S3Config
Code
def create_client() -> S3Client: config = S3Config.resolve() return S3Client(config=config)