Integration GuideCommunity
Memberstack
+
AWS S3

AWS S3 File Uploader

Enable browser-to-S3 file uploads for your members. Complete guide for setting up S3, IAM, and API Gateway for secure file management.

20-30 min

Setup Time

Free Tier

Eligible

S3 + IAM + API Gateway

AWS Services

How It Works

Browser uploads go through API Gateway to S3. No server needed.

Browser

API Gateway

S3 Bucket

Phase 1

AWS Storage Setup

1

Create an S3 Bucket

  1. Go to AWS S3 Console
  2. Click Create bucket
  3. Enter a unique bucket name
  4. Uncheck Block all public access (acknowledge the warning)
  5. Click Create bucket
Create S3 Bucket
S3 bucket creation screen
2

Enable Versioning

  1. Open your bucket
  2. Go to Properties tab
  3. Find Bucket Versioning and click Edit
  4. Select Enable and save
Enable Versioning
Enable bucket versioning
3

Add Bucket Policy

Go to Permissions tab → Bucket policyEdit

Bucket Policy JSON
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicReadGetObject",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::YOUR-BUCKET-NAME/*"
    }
  ]
}
Add Bucket Policy
Bucket policy editor
4

Create IAM Policy

  1. Go to IAM ConsolePolicies
  2. Click Create policyJSON tab
  3. Paste the policy below
IAM Policy JSON
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": ["s3:PutObject", "s3:DeleteObject"],
      "Resource": "arn:aws:s3:::YOUR-BUCKET-NAME/*"
    }
  ]
}
Create IAM Policy
IAM policy creation
5

Create IAM Role

  1. Go to RolesCreate role
  2. Select AWS serviceAPI Gateway
  3. Attach your S3 policy
  4. Name: S3UploadRole
Create IAM Role
IAM role creation
Attach Policy
Attach the S3 upload policy

Phase 2

API Gateway Setup

6

Create REST API

  1. Go to API Gateway Console
  2. Click Create API
  3. Choose REST API (not HTTP API)
  4. Name: S3FileUploadAPI
Create API Gateway
Create new REST API
Choose REST API
Choose REST API (not HTTP API)
7

Create Resource Path

  1. Click Create Resource
  2. Resource path: {folder}
  3. Create child resource: {filename}
Create Resource Path
Create resource path structure
8

Create PUT Method

  1. Select {filename} resource
  2. Click Create MethodPUT
  3. Integration type: AWS Service
  4. AWS Service: S3
  5. HTTP method: PUT
  6. Path override: YOUR-BUCKET/{folder}/{filename}
  7. Execution role: Paste your IAM role ARN
Integration Request
Configure integration request
9

Configure Method Response

  1. Click Method Response
  2. Expand 200 response
  3. Add header: Access-Control-Allow-Origin
Method Response
Configure 200 response headers
10

Create DELETE Method

Repeat the same steps as PUT, but:

  • Method: DELETE
  • Integration HTTP method: DELETE

Phase 3

CORS & Deploy

11

Configure Binary Media Types

  1. Go to API Settings
  2. Find Binary Media Types
  3. Add these types:
image/pngimage/jpegimage/gifimage/webpapplication/pdfapplication/octet-stream
Binary Media Types
Add binary media types
12

Enable CORS

  1. Select your resource
  2. Click Enable CORS
  3. Check PUT, DELETE, OPTIONS
  4. Add header: Content-Type
Enable CORS
Enable CORS for methods
13

Configure Gateway Responses

  1. Go to Gateway responses
  2. Edit DEFAULT 4XX
  3. Add header: Access-Control-Allow-Origin: '*'
  4. Repeat for DEFAULT 5XX
Gateway Responses
Configure gateway responses
14

Deploy the API

  1. Click Deploy API
  2. Stage: New Stage → name it prod
  3. Copy the Invoke URL
Deploy API
Deploy to production stage

Your API URL will look like: https://xxxxx.execute-api.region.amazonaws.com/prod

Troubleshooting

CORS error: Check Gateway Responses have CORS headers
403 Forbidden: Verify IAM role ARN and bucket policy
Binary files corrupted: Add correct Binary Media Types
OPTIONS failing: Enable CORS on all methods

Security Notes

• Files are publicly readable via their S3 URL

• Use unique folder names (member IDs) for organization

• Consider adding request validation for production

• Monitor usage with CloudWatch

Try Memberstack for free

100% free, unlimited trial — upgrade only when you're ready to launch. No credit card required.