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

Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
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
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
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
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
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
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
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
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New

We're in Beta

About us Mission Statement