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

srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
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
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics 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
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
vac
Hi, I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New

We're in Beta

About us Mission Statement