Last Updated: December 2, 2025
Purpose: Configure image storage for alumni photos in production.See Also: For full environment and deployment pipeline documentation, see:
- operations/DEPLOYMENT_PIPELINE.md — Deploy workflows, rollbacks
- operations/EXTERNAL_SERVICES_ENV_CONFIG.md — All external services
- operations/ENV_SETUP_IMPLEMENTATION_CHECKLIST.md — Full setup guide
bundle add aws-sdk-s3
# Add this to your existing storage.yml
amazon:
service: S3
access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
region: us-west-2 # Choose region closest to your users
bucket: alumni-lookup-<%= Rails.env %>
public: false
Add this line:
config.active_storage.service = :amazon
alumni-lookup-production[
{
"AllowedHeaders": ["*"],
"AllowedMethods": ["GET", "PUT", "POST", "DELETE", "HEAD"],
"AllowedOrigins": ["https://your-app-name.herokuapp.com"],
"ExposeHeaders": ["ETag"]
}
]
alumni-lookup-s3{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:DeleteObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::alumni-lookup-production",
"arn:aws:s3:::alumni-lookup-production/*"
]
}
]
}
# Edit encrypted credentials
EDITOR="code --wait" rails credentials:edit
# Add these lines:
aws:
access_key_id: AKIA... # Your AWS Access Key
secret_access_key: ... # Your AWS Secret Key
# Commit changes
git add .
git commit -m "Add S3 configuration for production photo storage"
# Deploy
git push heroku main
# Set master key (copy from config/master.key)
heroku config:set RAILS_MASTER_KEY=your_master_key_here
If you prefer Cloudinary for better image optimization:
bundle add cloudinary activestorage-cloudinary-service
# Add to config/storage.yml
cloudinary:
service: Cloudinary
cloud_name: <%= Rails.application.credentials.dig(:cloudinary, :cloud_name) %>
api_key: <%= Rails.application.credentials.dig(:cloudinary, :api_key) %>
api_secret: <%= Rails.application.credentials.dig(:cloudinary, :api_secret) %>
# In config/environments/production.rb
config.active_storage.service = :cloudinary
heroku config:set CLOUDINARY_URL=cloudinary://api_key:api_secret@cloud_name
For your alumni lookup app: Start with Cloudinary for the following reasons:
You can always migrate to S3 later if you outgrow Cloudinary’s free tier.