Using AWS S3 Buckets with Heroku and Rails

AWS Setup

Bucket Setup

  • Open the AWS S3 Console
  • Create a bucket, the name must be globally unique across all AWS buckets. Make sure to check name constrictions.
  • Set object ownership
  • Set or block public accessibility.
  • Choose your region and create.

File Uploads

  • Add gem 'aws-sdk', '~> 2' and gem 'image_processing', '~> 1.2'to your gemfile and bundle install.
  • Make sure you have a .env file to hide your S3_BUCKET, AWS_ACCESS_KEY_ID, and AWS_SECRET_ACCESS_KEY values.
  • Set Active Storage services in config/storage.yml.
example
To store files in your bucket during production add/edit this line in config/environments/production

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

The Android SDK is the Worst Thing on Earth

BandChain GuanYu Testnet#1: How to Join as a Validator

262: Dropbox: File Requests

How to prepare your Windows box for Ionic 3 development

Integration of LVM with Hadoop Cluster and providing Elasticity to DataNode Storage

An Experiment in Month Long Pairing

Cloudstate (Part 1): What is it?

How to link a custom Godaddy domain name to a Django app hosted on Pythonanywhere

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Megan

Megan

More from Medium

How Works Object Creation ?

Using Lambda with boto3, SNS and CloudWatch Events to start and stop EC2 intances

My Journey to installing Apache on CentOS 7

leetcode 290. Word Pattern