AWS S3 Bucket
Upload Images from an AWS S3 bucket to Roboflow
This page covers fallback workflows for one-time or ad hoc uploads only:
Signed URLs: Upload images directly from S3 to Roboflow using presigned URLs, without downloading them locally first.
CLI Locally: Download images from S3 to your local machine, then upload them to Roboflow. Use this when you need to preprocess or inspect images before uploading.
If you are setting up a reusable connection between Roboflow and S3, stop here and use Datasources plus AWS S3 Credentials.
AWS CLI Setup
Before using the script, ensure AWS CLI has access to the target bucket.
Configuring the AWS CLI
Once you've installed the AWS CLI, open a terminal or command prompt.
Run the following command:
aws configureYou'll be prompted to enter your AWS credentials:
AWS Access Key ID [None]: YOUR_ACCESS_KEY AWS Secret Access Key [None]: YOUR_SECRET_ACCESS_KEY Default region name [None]: YOUR_PREFERRED_REGION (e.g., us-west-1) Default output format [None]: json
Option 1: Upload Via Signed URL
Use this only for one-time or scripted imports where you do not want to create a Datasource.
You can generate signed URLs for your images in the S3 bucket by using boto3 in Python.
In the code snippet above, you need the name of your S3 bucket, the object name for the image in the S3 bucket, and the AWS region. The signed URL of the image is generated and returned.
Building around this, we can generate a complete solution that pulls all the available objects in the S3 bucket, and then uploads them to Roboflow via the API. An outline for this solution can be seen below:
Option 2: Download Data Locally from AWS
Use this only when you need local preprocessing, inspection, or file transformation before upload. Otherwise, use Datasources.
To upload data from AWS, first install the awscli command line tool. This tool allows you to interact with your AWS account on the command line. Once you have the command line tool installed, run the following command:
Replace mybucket with the name of your bucket and folder_path with the name of the folder or file you want to export. This command downloads assets from AWS to your current working directory (.).
Upload Data to Roboflow
Now that we have downloaded data, we can upload it to Roboflow either by using the Upload Web Interface or the Roboflow CLI.
See Also
Datasources (Bucket Mirror) - continuous, automatic sync from S3 without scripting
AWS S3 Credentials - secure AWS setup for Datasources
Last updated
Was this helpful?