fireproofsocks

fireproofsocks

Using ExAws with ElasticMQ

I was wondering if there were any examples floating around for how to use ElasticMQ with Elixir’s ExAws and ExAws.SQS modules. There was one related post I found here: Use Broadway with ElasticMQ in docker but the usage was constrained to Broadway. Although I may end up using Broadway, I’d like to know how to manually insert and remove messages from queues in a local (i.e. Dockerized) instance of ElasticMQ.

Generally, I’d like to execute commands like this against the local ElasticMQ instance:

"123/my_q"
|> ExAws.SQS.create_queue()
|> ExAws.request()

This generates errors, however, depending on how I have my configuration set up, e.g.

03:03:50.385 erl_level=warning application=ex_aws domain=elixir file=lib/ex_aws/request.ex function=request_and_retry/7 line=80 mfa=ExAws.Request.request_and_retry/7 module=ExAws.Request pid=<0.487.0> [warning] ExAws: HTTP ERROR: :timeout for URL: "https:/" ATTEMPT: 1

or

You tried to access the AWS EC2 instance meta, but it could not be reached.
This happens most often when trying to access it from your local computer,
which happens when environment variables are not set correctly prompting
ExAws to fallback to the Instance Meta.

This is the configuration I have tried:

config :ex_aws,
  access_key_id: "x",
  security_token: "x",
  secret_access_key: "x",
  host: "localhost",
  port: "9324",
  scheme: "http://",
  region: "elasticmq"

I have not tried supplying a configuration file to the ElasticMQ instance.

If anyone has any pointers on how to access this service I would appreciate them!

First Post!

joaodubas

joaodubas

To access the elasticmq instace, I used the following configuration:

config :ex_aws,
  access_key_id: [{:system, "AWS_ACCESS_KEY_ID"}, :instance_role],
  secret_access_key: [{:system, "AWS_SECRET_ACCESS_KEY"}, :instance_role],
  region: "elasticmq"

config :ex_aws, :sqs,
  scheme: "http://",
  host: System.get_env("AWS_DOMAIN", "localhost"),
  port: 9324,
  region: "elasticmq"

Where Next?

Popular in Questions Top

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
Kurisu
For example for a current url like http://localhost:4000/cosmetic/products?_utf8=✓&amp;query=perfume&amp;page=2, I would like to get: ...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lists...
New
Lily
In templates/appointment/index.html.eex: &lt;%= for appointment &lt;- @appointments do %&gt; &lt;tr&gt; &lt;td&gt;&lt;%= appoi...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
beno
I will often find my self writing things similar to: case some_value do nil -&gt; something() "" -&gt; something() _ -&gt; somethi...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
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
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
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
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
AstonJ
Please see the new poll here: Which code editor or IDE do you use? (Poll) (2022 Edition) It’s been a while since we first asked this, I...
208 31142 143
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

We're in Beta

About us Mission Statement