{"id":20058664,"url":"https://github.com/roboflow/roboflow_cloud_upload","last_synced_at":"2026-05-13T06:05:25.596Z","repository":{"id":203837771,"uuid":"710507341","full_name":"roboflow/roboflow_cloud_upload","owner":"roboflow","description":"How to upload images from Cloud Platforms (AWS, Azure, GCP) to Roboflow.","archived":false,"fork":false,"pushed_at":"2023-10-26T23:28:01.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-25T09:59:40.591Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roboflow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-26T20:51:11.000Z","updated_at":"2023-10-26T21:06:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"71475642-9264-428e-9c68-737787415fda","html_url":"https://github.com/roboflow/roboflow_cloud_upload","commit_stats":null,"previous_names":["roboflow/roboflow_cloud_upload"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboflow%2Froboflow_cloud_upload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboflow%2Froboflow_cloud_upload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboflow%2Froboflow_cloud_upload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roboflow%2Froboflow_cloud_upload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roboflow","download_url":"https://codeload.github.com/roboflow/roboflow_cloud_upload/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241488154,"owners_count":19970826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T13:03:09.571Z","updated_at":"2026-05-13T06:05:25.532Z","avatar_url":"https://github.com/roboflow.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Uploading Images to Roboflow using Presigned URLs\n\nThis repository contains a script for uploading images to a Roboflow project using presigned URLs. The script supports AWS S3, Azure Blob Storage, and Google Cloud Storage. Chec out the Examples folder for sample scripts uploading data to Roboflow using signed URLs for each of these cloud storage providers.\n\n\n## Requirements\n- Python 3.x\n- boto3 for AWS S3\n- azure-storage-blob for Azure\n- google-cloud-storage for Google Cloud\n- requests\n\n## Getting Started\n\n### AWS S3\n\nInstall the AWS SDK for Python (`boto3`):\n\n```bash\npip install boto3\n```\n\nCode to generate a presigned URL:\n\n```python\nimport boto3\nfrom botocore.config import Config\n\ndef generate_presigned_url_aws(bucket_name, object_name, region='us-east-2'):\n    s3 = boto3.client('s3', region_name=region, config=Config(signature_version='s3v4'))\n    url = s3.generate_presigned_url('get_object',\n                                    Params={'Bucket': bucket_name, 'Key': object_name},\n                                    ExpiresIn=3600)\n    return url\n```\n\n### Azure Blob Storage\n\nInstall the Azure Blob Storage client library for Python:\n\n```bash\npip install azure-storage-blob\n```\n\nCode to generate a signed URL:\n\n```python\nfrom azure.storage.blob import BlobServiceClient, generate_blob_sas, BlobSasPermissions\n\ndef generate_signed_url_azure(blob_service_client, container_name, blob_name):\n    blob_client = blob_service_client.get_blob_client(container=container_name, blob=blob_name)\n    sas_token = generate_blob_sas(blob_service_client.account_name,\n                                  container_name,\n                                  blob_name,\n                                  account_key=blob_service_client.credential.account_key,\n                                  permission=BlobSasPermissions(read=True),\n                                  expiry=datetime.utcnow() + timedelta(hours=1))\n    url = blob_client.url + '?' + sas_token\n    return url\n```\n\n### Google Cloud Storage\n\nInstall the Google Cloud Storage client library for Python:\n\n```bash\npip install google-cloud-storage\n```\n\nCode to generate a signed URL:\n\n```python\nfrom google.cloud import storage\n\ndef generate_signed_url_gcp(bucket_name, blob_name):\n    storage_client = storage.Client()\n    bucket = storage_client.bucket(bucket_name)\n    blob = bucket.blob(blob_name)\n    url = blob.generate_signed_url(expiration=datetime.timedelta(hours=1), method='GET')\n    return url\n```\n\n## Example API Usage\n\nLoad the configuration, fetch object keys, and generate presigned URLs, then use `upload_to_roboflow()` to upload images. Save uploaded image IDs to avoid re-uploads.\n\n```python\nimport requests\nimport urllib.parse\n\nAPI_URL = \"https://api.roboflow.com\"\n\ndef upload_single_image_to_roboflow(api_key: str, project_name: str, signed_url: str, image_name: str, split: str = \"train\") -\u003e bool:\n    \"\"\"\n    Uploads a single image to Roboflow using a signed URL.\n\n    Args:\n        api_key (str): Your Roboflow API key.\n        project_name (str): Your Roboflow project name.\n        signed_url (str): The signed URL for the image you want to upload.\n        image_name (str): The name you want to give to the image.\n        split (str): The data split you want to assign to the image (train/test/val).\n    \n    Returns:\n        bool: True if upload was successful, False otherwise.\n    \"\"\"\n  \n    # Construct the upload URL for Roboflow API\n    upload_url = \"\".join(\n        [\n            API_URL + \"/dataset/\" + project_name + \"/upload\",\n            \"?api_key=\" + api_key,\n            \"\u0026name=\" + image_name,\n            \"\u0026split=\" + split,\n            \"\u0026image=\" + urllib.parse.quote_plus(signed_url)\n        ]\n    )\n    \n    # Make the POST request to upload the image\n    response = requests.post(upload_url)\n    \n    if response.status_code == 200:\n        print(f\"Successfully uploaded {image_name} to {project_name}\")\n        return True\n    else:\n        print(f\"Failed to upload {image_name}. Error: {response.content.decode('utf-8')}\")\n        return False\n\n# Example usage\napi_key = \"YOUR_API_KEY\"\nproject_name = \"YOUR_PROJECT_NAME\"\nsigned_url = \"YOUR_SIGNED_URL\"\nimage_name = \"example_image.jpg\"\n\nupload_single_image_to_roboflow(api_key, project_name, signed_url, image_name)\n```\n\nReplace the placeholders (`YOUR_API_KEY`, `YOUR_PROJECT_NAME`, `YOUR_SIGNED_URL`) with your actual values, then run the script to upload the image.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froboflow%2Froboflow_cloud_upload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froboflow%2Froboflow_cloud_upload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froboflow%2Froboflow_cloud_upload/lists"}