title: Serverless Lambda SQS access denied error
body: <p>I have a node application running through <code>serverless-framework</code>.</p>
  
  <p>The application writes messages to the SQS and code is</p>
  
  <pre><code>const AWS = require('aws-sdk');
  const config = require('../../configs/constants').config;
  
  const sqs = new AWS.SQS({apiVersion: '2012-11-05'});
  
  module.exports.sendMessage = (service, message) =&gt; {
      const params = {
          MessageBody: JSON.stringify(message),
          QueueUrl: config.SQS_QUEUE_URL_ANALYTICS
      };
  
      return new Promise((resolve, reject) =&gt; {
          sqs.sendMessage(params, (err, data) =&gt; {
              if (err) {
                  console.error('Error creating SQS Message: ', err);
                  reject(err);
              } else {
                  console.log('SQS Message created successfully: ', data);
                  resolve(data);
              }
          });
      });
  };
  </code></pre>
  
  <p>The permission given to the user is</p>
  
  <pre><code>{
      "Version": "2012-10-17",
      "Statement": [
          {
              "Sid": "VisualEditor0",
              "Effect": "Allow",
              "Action": [
                  "sqs:ListQueues",
                  "sqs:*"
              ],
              "Resource": "*"
          },
          {
              "Sid": "VisualEditor1",
              "Effect": "Allow",
              "Action": "sqs:*",
              "Resource": "arn:aws:sqs:ap-south-1:881210447458:Staging-Analytics-Log-Data-Process"
          }
      ]
  }
  </code></pre>
  
  <p>When the lambda function is executed, it gives an error</p>
  
  <pre><code>ERROR Error creating SQS Message: { AccessDenied: Access to the resource https://sqs.ap-south-1.amazonaws.com/ is denied.
  </code></pre>
  
  <p>What other credentials are required for SQS to run?</p>