Requirements

S3

Bucket, credentials and lifecycle rules for file uploads on S3 or an S3-compatible store.

This document describes how to set up S3-compatible storage for file uploads and media storage in the application.

Overview

The application uses Amazon S3 (or S3-compatible storage) to store user uploads, media files, and other assets. S3 provides reliable, scalable object storage with high availability.

Environment Configuration

Once you have followed the steps below, you will add the following credentials to your .env file:

AWS_ACCESS_KEY_ID=rapid-response
AWS_SECRET_ACCESS_KEY="$(openssl rand -hex 24)"
AWS_S3_BUCKET_NAME=rapid-response

If using S3-comaptible storage not on AWS, you will also need to provide the following:

AWS_S3_ENDPOINT_URL="https://storage.example.com"

Storage Providers

This guide covers AWS S3, but the application also supports S3-compatible alternatives including:

  • Minio - Self-hosted or cloud
  • Wasabi - Cost-effective cloud storage
  • DigitalOcean Spaces - Simplified cloud storage

For alternative providers, follow the AWS S3 setup steps and use the provider-specific endpoint URL configuration documented at the end of this guide.

Prerequisites

  • An AWS account (or account with alternative S3-compatible provider)
  • A valid payment method
  • Understanding of your storage requirements

The easy way

  1. Set up AWS account.
  2. Create a user with S3Admin permissions.
  3. Create credentials for this user.
  4. Download the credentials.
  5. Install s3-credentials.
  6. Run the following:
s3-credentials create my-org-rr-`openssl rand -hex 4` --create-bucket

The output will look something like this:

Created bucket: my-org-rr-77378dc3
Created  user: 's3.read-write.my-org-rr-77378dc3' with permissions boundary: 'arn:aws:iam::aws:policy/AmazonS3FullAccess'
Attached policy s3.read-write.my-org-rr-77378dc3 to user s3.read-write.my-org-rr-77378dc3
Created access key for user: s3.read-write.my-org-rr-77378dc3
{
    "UserName": "s3.read-write.my-org-rr-77378dc3",
    "AccessKeyId": "AKXXXXXXXXXXXXXXXXXX",
    "Status": "Active",
    "SecretAccessKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
    "CreateDate": "2025-10-10 21:00:00+00:00"
}

Step 1: Sign Up for AWS

If you don't already have an AWS account:

  1. Navigate to aws.amazon.com
  2. Click Create an AWS Account
  3. Enter your email address and choose an AWS account name
  4. Provide contact information and payment details
  5. Verify your identity via phone
  6. Select a support plan (Basic/Free is sufficient for most users)
  7. Complete the registration

Step 2: Create an S3 Bucket

  1. Log in to the AWS Management Console
  2. Navigate to Services > S3 (or search for "S3" in the search bar)
  3. Click Create bucket

Configure Bucket Settings

General Configuration:

  • Bucket name - Choose a globally unique name (e.g., myapp-production-media)
    • Must be lowercase, 3-63 characters
    • Can contain letters, numbers, and hyphens
    • Cannot contain spaces or uppercase letters
    • Note: Bucket names cannot be changed after creation
  • AWS Region - Choose the region closest to your users/servers (e.g., us-east-1, us-west-2)

Object Ownership:

  • Select ACLs disabled (recommended)

Block Public Access settings:

  • Keep all four checkboxes checked (block all public access)
  • The application will use signed URLs for secure access
  • Only uncheck if you specifically need public read access to all objects

Bucket Versioning (Optional):

  • Enable if you want to keep multiple versions of objects
  • Useful for backup and recovery
  • Adds storage costs for each version

Default encryption:

  • Enable Server-side encryption with Amazon S3 managed keys (SSE-S3)
  • This is free and recommended

Advanced settings:

  • Leave as default unless you have specific requirements
  1. Click Create bucket

Step 3: Create an IAM User

For security, create a dedicated IAM user with limited permissions for your application:

  1. Navigate to Services > IAM (Identity and Access Management)
  2. Click Users in the left sidebar
  3. Click Create user
  4. Enter a username (e.g., myapp-s3-user)
  5. Click Next

Attach Permissions

  1. Select Attach policies directly
  2. Click Create policy
  3. This will open a new tab

In the new tab:

  1. Click the JSON tab
  2. Replace the content with the following policy (replace YOUR-BUCKET-NAME with your actual bucket name):
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "s3:GetObject",
        "s3:DeleteObject",
        "s3:ListBucket"
      ],
      "Resource": [
        "arn:aws:s3:::YOUR-BUCKET-NAME",
        "arn:aws:s3:::YOUR-BUCKET-NAME/*"
      ]
    }
  ]
}
  1. Click Next
  2. Enter a policy name (e.g., myapp-s3-access)
  3. Click Create policy

Return to the user creation tab:

  1. Refresh the policy list
  2. Search for and select your newly created policy
  3. Click Next
  4. Review and click Create user

Step 5: Generate Access Keys

  1. Click on your newly created user
  2. Navigate to the Security credentials tab
  3. Scroll down to Access keys
  4. Click Create access key
  5. Select Application running outside AWS
  6. Click Next
  7. (Optional) Add a description tag
  8. Click Create access key
  9. Important: Copy both the Access key ID and Secret access key
    • The secret key is only shown once
    • Download the CSV file as a backup
  10. Click Done

Security Warning: Never commit these credentials to version control or expose them in client-side code.

Step 6: Configure Environment Variables

Add the following credentials to your .env file:

For AWS S3:

# AWS S3 Configuration
AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE
AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
AWS_S3_BUCKET_NAME=rr-media-199b6ed6fa7d9e9e

Replace with your actual credentials and bucket name.

For S3-Compatible Providers (Minio, Wasabi, DigitalOcean Spaces):

# S3-Compatible Storage Configuration
AWS_ACCESS_KEY_ID=your_access_key_id
AWS_SECRET_ACCESS_KEY=your_secret_access_key
AWS_S3_BUCKET_NAME=your-rr-media-199b6ed6fa7d9e9e
AWS_S3_ENDPOINT_URL=https://storage.subdomain.example.com

The AWS_S3_ENDPOINT_URL tells the application to use an alternative S3-compatible endpoint instead of AWS. Replace with your provider's endpoint:

  • Minio: https://minio.yourdomain.com or your Minio instance URL
  • Wasabi: https://s3.us-east-1.wasabisys.com (varies by region)
  • DigitalOcean Spaces: https://nyc3.digitaloceanspaces.com (varies by region)

Testing Your Configuration

Test via AWS Console

  1. Navigate to your S3 bucket in the AWS Console
  2. Click Upload
  3. Select a test file
  4. Click Upload
  5. Verify the file appears in your bucket

Test via Application

After configuring your environment variables, test file uploads through your application:

  1. Navigate to a page with file upload functionality
  2. Select and upload a test file
  3. Verify the upload completes successfully
  4. Check the S3 bucket to confirm the file was stored

Test via AWS CLI (Optional)

If you have the AWS CLI installed:

# Configure AWS CLI with your credentials
aws configure

# List bucket contents
aws s3 ls s3://your-bucket-name/

# Upload a test file
aws s3 cp test.txt s3://your-bucket-name/test.txt

# Download a file
aws s3 cp s3://your-bucket-name/test.txt downloaded.txt

Setting Up Lifecycle Rules (Optional)

Consider setting up lifecycle rules for call and mms media consistent with your organizations retention policy.

Additional Resources

Previous
Auth0