Search code examples
ruby-on-railsamazon-web-servicesdelayed-jobamazon-elastic-beanstalkamazon-sqs

how to disable sqs on elastic beanstalk


I have a rails app on AWS Elastic Beanstalk. I process background tasks using delayed_job. I set up an eb worker instance to handle this. It works but shows as failed (red) in the dashboard. I believe this is because of the following error that I get every few seconds:

error: AWS::SQS::Errors::AccessDenied: Access to the resource https://sqs.us-west-2.amazonaws.com/xxx...xxxx is denied

I tried to remove sqs by means of the following to no avail:

services:
  sysvinit:
    aws-sqsd:
      enabled: false
      ensureRunning: false 

How do I stop sqs? Ideally it would never be installed in the first place. If I can't modify the install configuration is there a way to prevent this error from affecting the status of my environment?


Solution

  • You are launching a worker tier environment. That is why SQS is being created for your environment. You should launch a "Web Server" environment if you do not want to launch a worker environment. Worker Tier environment in Elastic Beanstalk allows you to poll messages from an SQS queue periodically.

    Read more about worker tier environments here: http://aws.amazon.com/blogs/aws/background-task-handling-for-aws-elastic-beanstalk/

    Read more about environment tiers here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features-managing-env-tiers.html

    If you want to use a Worker Tier environment with SQS enabled you can get rid of the AccessDenied exception by giving access to the IAM instance profile to access SQS as explained here: https://stackoverflow.com/a/24880344/161628