Skip to main content
Uploads files to AWS S3 storage with flexible configuration options. This function accepts various file types including Playwright Download objects, binary data, making it versatile for different upload scenarios. It automatically handles file metadata and provides comprehensive S3 configuration options.

S3 configuration fallback

The function uses a fallback system to determine S3 settings:
  1. S3Configs Parameter - If provided, uses the explicit S3Configs object with your custom settings.
  2. Environment Variables - If no configs provided, automatically reads from environment variables:
    • AWS_ACCESS_KEY_ID - Your AWS access key
    • AWS_SECRET_ACCESS_KEY - Your AWS secret key
    • AWS_REGION - AWS region (e.g., “us-west-1”)
    • AWS_BUCKET - S3 bucket name
    • AWS_ENDPOINT_URL - Optional custom S3 endpoint
    • Check Environment Variables & Secrets to learn more about setting environment variables.
  3. Intuned Defaults - If environment variables aren’t set, falls back to Intuned’s managed S3 storage. See S3 Attachment Storage for more details.

Examples

Arguments

file
FileType
required
The file to upload. See FileType for supported types.
configs
S3Configs
Optional S3Configs for customizing the S3 upload. If not provided, uses environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION, AWS_ENDPOINT_URL, AWS_BUCKET). If environment variables aren’t set, uses default Intuned S3 settings.
file_name_override
str
Optional custom filename for the uploaded file. If not provided, uses the original filename or generates a unique name.
content_type
str
Optional MIME type for the uploaded file (e.g., “application/pdf”, “image/png”). If None, uses the original content type.

Returns: Attachment

An Attachment object with file metadata and utility methods