Liam_or
Local storage vs something like Amazon S3 for files?
Would it be more effective to store fixed media assets (like lessons, videos, or images that I’ve created and aren’t expected to grow dynamically) directly on the server’s local storage instead of using a third-party service like Amazon S3?
I’m not talking about static content served directly, but rather files that are read on client request, rendered, and sent dynamically via LiveView. Since the media is pre-created by me and doesn’t change often or grow due to user input, could storing and serving the content directly from the server simplify the process and potentially improve performance by avoiding the S3 → server → client flow? Also, phoenix is easily distributed, so I can use that to my advantage if I want to have the media closer to the client in future.
Trending in Discussions
Other Trending Topics
Latest Phoenix Threads
Chat & Discussions>Discussions
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security










Most Liked
benwilson512
It is the same whether using LiveView or otherwise. You gave records in your database usually that track what items exist and where on S3 they are stored. You then can use those records to also track authorization and access rules. If someone is allowed access to those records you use a library to generate a signed link. At that point it’s just a normal link and you put it in an img tag or whatever the normal HTML thing is.
D4no0
If you simply want to let the user download the file/files it is as simple as creating a phoenix controller that will serve the binary, then generate a link in your liveviews, this is not only completely flexible (it’s extremely trivial also to make this work with s3), but you get the full benefit of filtering from your application who can access that dynamic link.
This is up to you how you want to implement it, with a phoenix controller implementing temporary URLs is trivial, but you will need to keep track of them in a database most probably, alternatively you could use a signed token in the link with an expiration time + filename and validate it upon reception.
D4no0
Why not? I would generally encourage to go with the local storage by default and only switch to s3 only if you need specific features it offers, like for example navigating over the files from their interface or having automatic backups.
The performance is obviously better as you are not doing network calls, but you will have to figure out how to backup your files(if you need it) and this can vary extremely depending on how you deploy your application.
Last Post!
Liam_or
Thanks for the info guys. Really appreciate it!