Ruby on Rails #21 Active Storage With Amazon S3 Cloud Storage
aws s3 for file storage:
github.com/corsego/20-active_...
ActiveStorage docs:
edgeguides.rubyonrails.org/ac...
How to use Credentials in Ruby on Rails 6? TLDR:
blog.corsego.com/ruby-on-rail...
0:00 The Problem
02:01 Install AWS S3 cloud storage
05:19 AWS IAM
08:35 Local storage = S3
09:13 gem aws-sdk-s3
11:05 Production
15:42 Summary
Пікірлер: 34
You're videos are so great for a newbie coder like me! I'm building my first app and was able to follow along easily! Many thanks!
Clear and concise. Thank you so much!
Your channel is actually amazing. I've been hitting my head for days on it. Following your video, i made it work in less than an hour. Huge thanks
Great video! Very easy to understand and follow!
I just have to say that every time I get stuck with something, I come to your channel to see if you have a video. It never fails that you've already covered the question that I have! I'm grateful that you walked us through the S3 bucket creation . Everyone else glosses over those details like I should already know which settings should be selected.
Very nice and helpful video, Thank a lot :)
Great video serie!!
Great video my friend, i'm a rails lover
loved it!!!! thankuu, subbed!
thanks for the video!
Thanks!
Perfect!
@SupeRails
2 жыл бұрын
Hello Evgenii! Glad that you found the video useful!
Epic.
thx
Hello. I followed your video, however Heroku doesnt take amazon as storage service. It take local configuration. My production.rb has config.active_storage.service = :amazon and i have my credentials set up ok. do you have an idea what is the problem?
do you have video that explain to delete orphaned image file after upload
perfect¡¡
@SupeRails
2 жыл бұрын
Thanks! If you have any ideas for upcoming episodes - please share them!
What if we want to save our images in a specific folder/directory inside the bucket ? how we would go about that in rails ? thanks in advance.
@SupeRails
2 жыл бұрын
Good question. I haven't researched it before. The easy way - different buckets for different info. It wouldn't really increase your aws cost. You can override where a file is saved like "has_one_attached :avatar, service: :s3"
I'm having a problem, when i do rails credentials:edit it opens an empty yml file but when I do credentials:show it shows me the default aws stuff so it isn't opening correct file. Can someone help me?
Good tutorial ! But i keep getting an error in uploading in the xml response. "The request signature we calculated does not match the signature you provided. Check your key and signing method." "SignatureDoesNotMatch" seems like a key/secret error but i have changed it to newer ones and the issue persists atm
@SupeRails
3 жыл бұрын
Did you update CORS?
@anastaciomegalordepatricio8342
3 жыл бұрын
@@SupeRails yes i've added on my bucket -> Security a json for it. [ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "GET", "HEAD" ], "AllowedOrigins": [ "*" ], "ExposeHeaders": [], "MaxAgeSeconds": 3000 } ]
@anastaciomegalordepatricio8342
3 жыл бұрын
also i didn't deploy to heroku, i wanted to try in ENV=Development first. I followed along all your steps and somehow got a different outcome so far
@SupeRails
3 жыл бұрын
stackoverflow.com/a/62137151/5695646
@anastaciomegalordepatricio8342
3 жыл бұрын
@@SupeRails so i found out my issue and it was whit the CORS. Notice on the reply here i wasn't allowing any "POST","PUT" or "Delete" methods and they are needed. Ill leave my CORS file in here hope it helps. [ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "GET", "HEAD", "POST", "PUT", "DELETE" ], "AllowedOrigins": [ "*" ], "ExposeHeaders": [] } ]
Hero without cape
first of all thank you for your great video but what if i want to upload photos in subdirectories at AWS, for example: photos/user_id/profile_photo.jpeg how to do this using active storage?
@SupeRails
2 жыл бұрын
That's a tough one. Instead of sub-directories, I would maybe just use different AWS buckets... Anyway, did you find an answer? Now I'm curious!
@barkbark5645
2 жыл бұрын
@@SupeRails You can't do it. I remember this being an issue when Active Storage first came out. Then someone from Rails Core, or Basecamp, said they will not do anything to make it work with folders. Also, thanks for the video.