A memorandum for myself
Gemfile
gem "aws-sdk-s3", require: false
config/environments/development.rb
config.active_storage.service = :local
#Changed to below
config.active_storage.service = :amazon
config/storage.yml
amazon:
service: S3
access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
region: ap-northeast-1
bucket:Bucket name
Terminal
#After Catalina
% vim ~/.zshrc
[insert mode]
export AWS_ACCESS_KEY_ID="Access key ID"
export AWS_SECRET_ACCESS_KEY="Secret access key"
[:Save as wq]
#Command to reflect
% source ~/.zshrc
config/environments/production.rb
config.active_storage.service = :local
#Changed to below
config.active_storage.service = :amazon
Terminal
heroku config:set AWS_ACCESS_KEY_ID="Access key ID"
heroku config:set AWS_SECRET_ACCESS_KEY="Secret access key"
Terminal
% heroku config
push and reflect
You don't have to make each bucket because you can reuse it.
✔︎
Recommended Posts