romenigld

romenigld

Amazon AWS S3 Public bucket

Hello guys I am doing the course Liveview course of the pragprog and I would like to know how to put the Amazon AWS S3 bucket to be public.

I created the bucket and put the ‘CORS’ on the ‘Permissions’.
But I can’t put this new bucket on public.
Someone could help me with this please?

My application is complaining for this:

[error] GenServer #PID<0.713.0> terminating
** (FunctionClauseError) no function clause matching in RldLiveViewStudioWeb.DesksLive.error_to_string/1
    (rld_live_view_studio 0.1.0) lib/rld_live_view_studio_web/live/desks_live.ex:74: RldLiveViewStudioWeb.DesksLive.error_to_string(:external_client_failure)
    (rld_live_view_studio 0.1.0) lib/rld_live_view_studio_web/live/desks_live.html.heex:49: anonymous fn/3 in RldLiveViewStudioWeb.DesksLive.render/1
    (phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:398: Phoenix.LiveView.Diff.traverse/7
    (phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:544: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/7
    (elixir 1.14.3) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
    (phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:396: Phoenix.LiveView.Diff.traverse/7
    (phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:571: anonymous fn/3 in Phoenix.LiveView.Diff.traverse_comprehension/5
    (elixir 1.14.3) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:484: Phoenix.LiveView.Diff.traverse/7
    (phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:571: anonymous fn/3 in Phoenix.LiveView.Diff.traverse_comprehension/5
    (elixir 1.14.3) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.14.3) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (elixir 1.14.3) lib/enum.ex:1780: Enum."-map_reduce/3-lists^mapfoldl/2-0-"/3
    (phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:450: Phoenix.LiveView.Diff.traverse/7
    (phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:544: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/7
    (elixir 1.14.3) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
    (phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:373: Phoenix.LiveView.Diff.traverse/7
    (phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:544: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/7
    (elixir 1.14.3) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
    (phoenix_live_view 0.18.18) lib/phoenix_live_view/diff.ex:373: Phoenix.LiveView.Diff.traverse/7
Last message: %Phoenix.Socket.Message{topic: "lv:phx-F5alJ2XuJWOBaQGj", event: "progress", payload: %{"entry_ref" => "0", "event" => nil, "progress" => %{"error" => "failed"}, "ref" => "phx-F5alJ5A-iS4F6QMC"}, ref: "11", join_ref: "4"}
State: %{components: {%{}, %{}, 1}, join_ref: "4", serializer: Phoenix.Socket.V2.JSONSerializer, socket: #Phoenix.LiveView.Socket<id: "phx-F5alJ2XuJWOBaQGj", endpoint: RldLiveViewStudioWeb.Endpoint, view: RldLiveViewStudioWeb.DesksLive, parent_pid: nil, root_pid: #PID<0.713.0>, router: RldLiveViewStudioWeb.Router, assigns: %{__changed__: %{}, flash: %{}, form: %Phoenix.HTML.Form{source: #Ecto.Changeset<action: :validate, changes: %{name: "Wally"}, errors: [], data: #RldLiveViewStudio.Desks.Desk<>, valid?: true>, impl: Phoenix.HTML.FormData.Ecto.Changeset, id: "desk", name: "desk", data: %RldLiveViewStudio.Desks.Desk{__meta__: #Ecto.Schema.Metadata<:built, "desks">, id: nil, name: nil, photo_locations: [], inserted_at: nil, updated_at: nil}, hidden: [], params: %{"name" => "Wally"}, errors: [], options: [method: "post"], index: nil, action: nil}, live_action: nil, streams: %{__changed__: MapSet.new([]), desks: %Phoenix.LiveView.LiveStream{name: :desks, dom_id: #Function<3.113057034/1 in Phoenix.LiveView.LiveStream.new/3>, inserts: [], deletes: []}}, uploads: %{__phoenix_refs_to_names__: %{"phx-F5alJ5A-iS4F6QMC" => :photos}, photos: #Phoenix.LiveView.UploadConfig<name: :photos, max_entries: 3, max_file_size: 10000000, entries: [%Phoenix.LiveView.UploadEntry{progress: 0, preflighted?: true, upload_config: :photos, upload_ref: "phx-F5alJ5A-iS4F6QMC", ref: "0", uuid: "82a6de32-406d-49cd-97e7-fc524021a170", valid?: true, done?: false, cancelled?: false, client_name: "bingo01.jpg", client_relative_path: "", client_size: 47293, client_type: "image/jpeg", client_last_modified: 1679089898580}], accept: ".png,.jpeg,.jpg", ref: "phx-F5alJ5A-iS4F6QMC", errors: [], auto_upload?: false, progress_event: nil, ...>}}, transport_pid: #PID<0.707.0>, ...>, topic: "lv:phx-F5alJ2XuJWOBaQGj", upload_names: %{photos: {"phx-F5alJ5A-iS4F6QMC", nil}}, upload_pids: %{}}

But I changed the name of the @s3_bucketto use an old bucket I have then it work’s!
But I would like to know how to deal with a new bucket.
for others apps.

Most Liked

PrincetonPoh

PrincetonPoh

After setting it to public, you can update the bucket policy to allow read and write access.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Allow",
            "Effect": "Allow",
            "Principal": {
                "AWS": "arn:aws:iam::<user_iam_id>:user/<bucketname>"
            },
            "Action": "s3:*",
            "Resource": [
                "arn:aws:s3:::<bucketname>/*",
                "arn:aws:s3:::<bucketname>"
            ]
        },
        {
            "Sid": "AllowAllRead",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": [
                "arn:aws:s3:::<bucketname>/*",
                "arn:aws:s3:::<bucketname>"
            ]
        }
    ]
}

Where Next?

Popular in Questions Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
gonzofish
I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing somet...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
beno
I will often find my self writing things similar to: case some_value do nil -&gt; something() "" -&gt; something() _ -&gt; someth...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
jc00ke
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217 Let’s say I have a map with required and optional k...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

Other popular topics Top

lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
Jim
As a follow up to my earlier question: I have the code compiling and running but not getting a successful login from the rest server. ...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New

We're in Beta

About us Mission Statement