Skip to content

AwsS3Connector ​

Upload, download, list, and delete objects in AWS S3 buckets. Supports optional session tokens for temporary credentials and an optional region parameter.

Credentials ​

CredentialWhere to get it
access_key / secret_keyIAM → Users → Security credentials — create an access key for a user with S3 permissions
session_tokenOptional; issued with temporary credentials from STS or assumed roles. Use None for long-term IAM keys
regionBucket region in the S3 console

Docs: Managing access keys for IAM users

Usage ​

python
from elsai_cloud.aws import AwsS3Connector

s3_client = AwsS3Connector(
    access_key="your_access_key",
    secret_key="your_secret_key",
    session_token="your_session_token",
)

# With an explicit region
s3_client = AwsS3Connector(
    access_key="your_access_key",
    secret_key="your_secret_key",
    session_token="your_session_token",
    region="us-east-1",
)

Constructor parameters:

ParameterRequiredDescription
access_keyYesAWS access key ID
secret_keyYesAWS secret access key
session_tokenYesAWS session token (use None for long-term credentials)
regionNoAWS region (e.g. "us-east-1")

Upload a file:

python
s3_client.upload_file_to_s3(
    bucket_name="your_bucket_name",
    s3_key="your_s3_key",
    file_path="path/to/your/file.txt",
)

Download a file:

python
s3_client.download_file_from_s3(
    bucket_name="your_bucket_name",
    file_name="your_s3_key",
    download_path="path/to/download/file.txt",
)

Delete a file:

python
s3_client.delete_file_from_s3(
    bucket_name="your_bucket_name",
    s3_key="your_s3_key",
)

List objects in a folder:

python
objects = s3_client.list_objects_in_s3_folder(
    bucket_name="your_bucket_name",
    prefix="your_folder_path/",
)
print(objects)

Download an entire folder:

python
s3_client.download_folder_from_s3(
    bucket_name="your_bucket_name",
    prefix="your_folder_path/",
    download_dir="path/to/local/download/folder",
)

See also ​

Copyright © 2026 elsai foundry.