---
title: "View source for Aws S3 - DreamFactory Wiki"
source: "http://wiki.dreamfactory.com/index.php?action=edit&title=Aws_S3"
canonical_url: "http://wiki.dreamfactory.com/index.php?action=edit&title=Aws_S3"
converted_at: "2026-11-23T23:02:34.057Z"
format: "markdown"
converted_by: "html-to-md-ai"
---
[]()
	
	
	
	# View source for Aws S3

	
		
		← [Aws S3](/Aws_S3)
		
		
		
		[Jump to navigation](#mw-head)
		[Jump to search](#searchInput)
		You do not have permission to edit this page, for the following reason:

The action you have requested is limited to users in the group: [Users](/index.php?title=DreamFactory_Wiki:Users&action=edit&redlink=1).---

You can view and copy the source of this page.

{{#seo:
|title=AWS S3 - DreamFactory Documentation
|title_mode=replace
|description=Create a REST API for AWS S3 buckets to manage files with role-based access and rate limiting
|keywords=AWS S3, file storage, REST API, cloud storage, S3 bucket, file upload, file download, Amazon S3
|og:title=AWS S3
|og:type=article
|og:site_name=DreamFactory Documentation
|og:description=Create a REST API for AWS S3 buckets to manage files with role-based access and rate limiting
}}
'''Create a REST API for AWS S3 buckets to manage files with role-based access and rate limiting'''

&lt;span id="aws-s3">&lt;/span>
= AWS S3 =

DreamFactory's AWS S3 connector provides a REST-based interface for interacting with S3 objects and buckets. Supporting all standard CRUD operations, you can easily manage your S3 data through a unified API. Because the S3 API is native to DreamFactory, you can integrate S3 actions alongside other API-driven tasks:

* Upload a newly registered user avatar to S3 while inserting registration data into a database
* Email a website visitor a link to a product PDF after writing their email to your CRM
* Create new S3 buckets as part of a DevOps workflow
* Apply DreamFactory's role-based access controls, rate limiting, and audit logging

-----

&lt;span id="use-cases">&lt;/span>
== Use Cases ==

* '''Application file storage''': User uploads, media assets, documents
* '''Static asset hosting''': Images, CSS, JavaScript for web applications
* '''Data lake integration''': Store and retrieve data files for analytics
* '''Backup storage''': Archive files from other systems
* '''Multi-tenant file isolation''': Per-customer folders with RBAC

-----

&lt;span id="prerequisites">&lt;/span>
== Prerequisites ==

Before configuring the S3 connector, you need:

# '''AWS Account''' with S3 access
# '''S3 Bucket''' created in your desired region
# '''IAM User or Role''' with S3 permissions
# '''Access Key ID and Secret Access Key''' for the IAM user

&lt;span id="minimum-iam-policy">&lt;/span>
=== Minimum IAM Policy ===

Create an IAM policy with these permissions:

&lt;syntaxhighlight lang="json">{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:GetObject",
        "s3:PutObject",
        "s3:DeleteObject",
        "s3:ListBucket"
      ],
      "Resource": [
        "arn:aws:s3:::your-bucket-name",
        "arn:aws:s3:::your-bucket-name/*"
      ]
    }
  ]
}&lt;/syntaxhighlight>

-----

&lt;span id="creating-an-aws-s3-service">&lt;/span>
== Creating an AWS S3 Service ==

&lt;span id="step-1-navigate-to-api-generation">&lt;/span>
=== Step 1: Navigate to API Generation ===

Log in to your DreamFactory instance using an administrator account and select the '''API Generation &amp;amp; Connections''' tab. Set your API Type to '''File'''.

&lt;span id="step-2-create-new-service">&lt;/span>
=== Step 2: Create New Service ===

Click the purple plus button to create a new file service, then search for and select '''AWS S3'''.

&lt;span id="step-3-configure-service-details">&lt;/span>
=== Step 3: Configure Service Details ===

{| class="wikitable"
|-
! Field
! Description
! Example
|-
| Name
| Service name (lowercase, alphanumeric, used in API URL)
| &lt;code>s3files&lt;/code>
|-
| Label
| Display name in admin console
| &lt;code>AWS S3 Storage&lt;/code>
|-
| Description
| Service description
| &lt;code>Production file storage on S3&lt;/code>
|}

&lt;span id="step-4-configure-aws-credentials">&lt;/span>
=== Step 4: Configure AWS Credentials ===

Scroll to the '''Config''' section and enter your AWS credentials:

{| class="wikitable"
|-
! Field
! Required
! Description
|-
| Access Key ID
| Yes
| AWS IAM access key
|-
| Secret Access Key
| Yes
| AWS IAM secret key
|-
| Region
| Yes
| AWS region (e.g., &lt;code>us-east-1&lt;/code>, &lt;code>eu-west-1&lt;/code>)
|-
| Bucket
| Yes
| S3 bucket name
|-
| Container
| No
| Subdirectory within bucket to use as root
|}

&lt;span id="step-5-save-and-test">&lt;/span>
=== Step 5: Save and Test ===

Click '''Save''' to create the service. Navigate to '''API Docs''' to view the generated endpoints and test operations.

-----

&lt;span id="configuration-options">&lt;/span>
== Configuration Options ==

&lt;span id="required-settings">&lt;/span>
=== Required Settings ===

{| class="wikitable"
|-
! Field
! Type
! Description
|-
| &lt;code>key&lt;/code>
| string
| AWS Access Key ID
|-
| &lt;code>secret&lt;/code>
| string
| AWS Secret Access Key
|-
| &lt;code>region&lt;/code>
| string
| AWS region code
|-
| &lt;code>bucket&lt;/code>
| string
| S3 bucket name
|}

&lt;span id="optional-settings">&lt;/span>
=== Optional Settings ===

{| class="wikitable"
|-
! Field
! Type
! Default
! Description
|-
| &lt;code>container&lt;/code>
| string
| -
| Subdirectory prefix for all operations
|-
| &lt;code>endpoint&lt;/code>
| string
| -
| Custom S3-compatible endpoint URL
|-
| &lt;code>use_path_style_endpoint&lt;/code>
| boolean
| false
| Use path-style URLs (required for MinIO, LocalStack)
|-
| &lt;code>cache_enabled&lt;/code>
| boolean
| false
| Enable response caching
|-
| &lt;code>cache_ttl&lt;/code>
| integer
| 0
| Cache time-to-live in seconds
|}

&lt;span id="s3-compatible-storage">&lt;/span>
=== S3-Compatible Storage ===

DreamFactory's S3 connector works with S3-compatible services by setting a custom endpoint:

{| class="wikitable"
|-
! Service
! Endpoint Example
|-
| MinIO
| &lt;code>http://minio.example.com:9000&lt;/code>
|-
| DigitalOcean Spaces
| &lt;code>https://nyc3.digitaloceanspaces.com&lt;/code>
|-
| Backblaze B2
| &lt;code>https://s3.us-west-002.backblazeb2.com&lt;/code>
|-
| Wasabi
| &lt;code>https://s3.wasabisys.com&lt;/code>
|}

Set &lt;code>use_path_style_endpoint&lt;/code> to &lt;code>true&lt;/code> for MinIO and similar services.

-----

&lt;span id="api-endpoints">&lt;/span>
== API Endpoints ==

{| class="wikitable"
|-
! Method
! Endpoint
! Description
|-
| &lt;code>GET&lt;/code>
| &lt;code>/api/v2/{service_name}/&lt;/code>
| List bucket root
|-
| &lt;code>GET&lt;/code>
| &lt;code>/api/v2/{service_name}/{path}/&lt;/code>
| List folder contents
|-
| &lt;code>GET&lt;/code>
| &lt;code>/api/v2/{service_name}/{path}&lt;/code>
| Download file
|-
| &lt;code>POST&lt;/code>
| &lt;code>/api/v2/{service_name}/&lt;/code>
| Create folder or upload file
|-
| &lt;code>POST&lt;/code>
| &lt;code>/api/v2/{service_name}/{path}/&lt;/code>
| Create subfolder or upload file
|-
| &lt;code>PUT&lt;/code>
| &lt;code>/api/v2/{service_name}/{path}&lt;/code>
| Replace file contents
|-
| &lt;code>DELETE&lt;/code>
| &lt;code>/api/v2/{service_name}/{path}&lt;/code>
| Delete file or folder
|}

-----

&lt;span id="api-examples">&lt;/span>
== API Examples ==

&lt;span id="list-bucket-contents">&lt;/span>
=== List Bucket Contents ===

&lt;syntaxhighlight lang="bash">curl -X GET "https://example.com/api/v2/s3files/" \
  -H "X-DreamFactory-API-Key: YOUR_API_KEY"&lt;/syntaxhighlight>
'''Response:'''

&lt;syntaxhighlight lang="json">{
  "resource": [
    {
      "path": "images/",
      "type": "folder",
      "name": "images",
      "last_modified": "2026-02-10T14:30:00Z"
    },
    {
      "path": "document.pdf",
      "type": "file",
      "name": "document.pdf",
      "content_type": "application/pdf",
      "content_length": 102400,
      "last_modified": "2026-02-09T10:15:00Z"
    }
  ]
}&lt;/syntaxhighlight>
&lt;span id="upload-a-file">&lt;/span>
=== Upload a File ===

&lt;syntaxhighlight lang="bash">curl -X POST "https://example.com/api/v2/s3files/uploads/report.pdf" \
  -H "X-DreamFactory-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/pdf" \
  --data-binary @report.pdf&lt;/syntaxhighlight>
'''Response:'''

&lt;syntaxhighlight lang="json">{
  "name": "report.pdf",
  "path": "uploads/report.pdf",
  "content_type": "application/pdf",
  "content_length": 102400
}&lt;/syntaxhighlight>
&lt;span id="download-a-file">&lt;/span>
=== Download a File ===

&lt;syntaxhighlight lang="bash">curl -X GET "https://example.com/api/v2/s3files/uploads/report.pdf" \
  -H "X-DreamFactory-API-Key: YOUR_API_KEY" \
  -o report.pdf&lt;/syntaxhighlight>
&lt;span id="create-a-folder">&lt;/span>
=== Create a Folder ===

S3 doesn't have true folders, but DreamFactory creates a placeholder object:

&lt;syntaxhighlight lang="bash">curl -X POST "https://example.com/api/v2/s3files/" \
  -H "X-DreamFactory-API-Key: YOUR_API_KEY" \
  -H "X-Folder-Name: documents"&lt;/syntaxhighlight>
&lt;span id="delete-a-file">&lt;/span>
=== Delete a File ===

&lt;syntaxhighlight lang="bash">curl -X DELETE "https://example.com/api/v2/s3files/uploads/old-report.pdf" \
  -H "X-DreamFactory-API-Key: YOUR_API_KEY"&lt;/syntaxhighlight>
&lt;span id="delete-a-folder">&lt;/span>
=== Delete a Folder ===

Delete all objects with a prefix:

&lt;syntaxhighlight lang="bash">curl -X DELETE "https://example.com/api/v2/s3files/old-folder/?force=true" \
  -H "X-DreamFactory-API-Key: YOUR_API_KEY"&lt;/syntaxhighlight>
&lt;span id="get-file-metadata">&lt;/span>
=== Get File Metadata ===

&lt;syntaxhighlight lang="bash">curl -X GET "https://example.com/api/v2/s3files/uploads/report.pdf?include_properties=true" \
  -H "X-DreamFactory-API-Key: YOUR_API_KEY"&lt;/syntaxhighlight>
'''Response:'''

&lt;syntaxhighlight lang="json">{
  "path": "uploads/report.pdf",
  "name": "report.pdf",
  "type": "file",
  "content_type": "application/pdf",
  "content_length": 102400,
  "last_modified": "2026-02-10T15:45:00Z"
}&lt;/syntaxhighlight>

-----

&lt;span id="pre-signed-urls">&lt;/span>
== Pre-Signed URLs ==

For large file uploads or direct client-to-S3 access, use pre-signed URLs:

&lt;syntaxhighlight lang="bash">curl -X GET "https://example.com/api/v2/s3files/uploads/large-file.zip?url=true&amp;expires=3600" \
  -H "X-DreamFactory-API-Key: YOUR_API_KEY"&lt;/syntaxhighlight>
'''Response:'''

&lt;syntaxhighlight lang="json">{
  "url": "https://bucket.s3.amazonaws.com/uploads/large-file.zip?X-Amz-Algorithm=..."
}&lt;/syntaxhighlight>
The &lt;code>expires&lt;/code> parameter sets the URL validity in seconds (default: 3600).

-----

&lt;span id="file-upload-limits">&lt;/span>
== File Upload Limits ==

Upload size limits are controlled by your web server, PHP configuration, and S3:

&lt;span id="server-configuration">&lt;/span>
=== Server Configuration ===

See [[Local_File_Storage#File Upload Limits|Local File Storage - File Upload Limits]] for Nginx and PHP settings.

&lt;span id="s3-limits">&lt;/span>
=== S3 Limits ===

{| class="wikitable"
|-
! Limit
! Value
|-
| Maximum object size
| 5 TB
|-
| Maximum single PUT
| 5 GB
|-
| Multipart upload threshold
| 100 MB (recommended)
|}

For files larger than 100 MB, consider using pre-signed URLs for direct upload.

-----

&lt;span id="common-errors">&lt;/span>
== Common Errors ==

{| class="wikitable"
|-
! Error Code
! Message
! Cause
! Solution
|-
| 400
| Bad Request
| Invalid parameters
| Check path and request format
|-
| 401
| Unauthorized
| Invalid API key
| Verify DreamFactory API key
|-
| 403
| Access Denied
| AWS permissions issue
| Check IAM policy and bucket policy
|-
| 404
| Not Found
| Object does not exist
| Verify the S3 key exists
|-
| 409
| Conflict
| Object already exists
| Use PUT to overwrite
|-
| 413
| Payload Too Large
| File exceeds limits
| Increase server limits or use pre-signed URL
|-
| 503
| Service Unavailable
| S3 unreachable
| Check network connectivity and AWS status
|}

&lt;span id="troubleshooting-aws-errors">&lt;/span>
=== Troubleshooting AWS Errors ===

'''Access Denied (403)''': 1. Verify IAM user has correct permissions 2. Check bucket policy allows access 3. Confirm region matches bucket location 4. Verify Access Key ID and Secret are correct

'''Bucket Not Found''': 1. Confirm bucket name spelling 2. Verify bucket exists in specified region 3. Check bucket hasn't been deleted

-----

&lt;span id="security-best-practices">&lt;/span>
== Security Best Practices ==

&lt;span id="iam-configuration">&lt;/span>
=== IAM Configuration ===

# '''Use dedicated IAM user''' for DreamFactory
# '''Minimal permissions''' - only grant required actions
# '''Restrict to specific bucket''' - don't use wildcard resources
# '''Rotate credentials''' regularly

&lt;span id="bucket-configuration">&lt;/span>
=== Bucket Configuration ===

# '''Block public access''' unless specifically required
# '''Enable versioning''' for critical data
# '''Enable server-side encryption''' (SSE-S3 or SSE-KMS)
# '''Enable access logging''' for audit trails

&lt;span id="dreamfactory-rbac">&lt;/span>
=== DreamFactory RBAC ===

Layer DreamFactory's RBAC on top of AWS permissions:

{| class="wikitable"
|-
! Scenario
! Configuration
|-
| Read-only access
| Allow GET only
|-
| Upload-only
| Allow POST to specific paths
|-
| User isolation
| Use filters to restrict by user ID folder
|}

-----

&lt;span id="cost-optimization">&lt;/span>
== Cost Optimization ==

&lt;span id="request-pricing">&lt;/span>
=== Request Pricing ===

S3 charges per request. Optimize by: - Enabling caching in DreamFactory - Batching operations where possible - Using LIST sparingly (costs more than GET)

&lt;span id="data-transfer">&lt;/span>
=== Data Transfer ===

* '''Within region''': Free between S3 and EC2
* '''Internet egress''': Charged per GB
* '''CloudFront''': Can reduce costs for high-traffic reads

-----

&lt;span id="next-steps">&lt;/span>
== Next Steps ==

* '''[[File_Services_Overview|File Services Overview]]''': Compare all file storage options
* '''[[Local_File_Storage|Local File Storage]]''': Store files on the server
* '''[[Security/Role_Based_Access|Role-Based Access Control]]''': Configure fine-grained permissions

[[Category:Aws_S3]]
[[Category:File_Storage]]
[[Category:Rest_Api]]
[[Category:API]]
[[Category:Difficulty_Intermediate]]

[[Category:API]]
Return to [Aws S3](/Aws_S3).

Retrieved from "[https://wiki.dreamfactory.com/Aws_S3](https://wiki.dreamfactory.com/Aws_S3)"