title: Access to the resource https://sqs.us-east-1.amazonaws.com/ is denied
body: <p>There are many references to this error, but,</p>
  
  <p>Below is the execution role created for lambda(<code>AWS::Serverless::Function</code>):</p>
  
  <pre><code>{
    "permissionsBoundary": {
      "permissionsBoundaryArn": "arn:aws:iam::111222333444:policy/some-permission-boundary",
      "permissionsBoundaryType": "Policy"
    },
    "roleName": “some-role-WebhookSampleFunctionRol-6Z7GFHJYHO0T",
    "policies": [
      {
        "document": {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Effect": "Allow",
              "Action": [
                "logs:CreateLogGroup",
                "logs:CreateLogStream",
                "logs:PutLogEvents"
              ],
              "Resource": "*"
            }
          ]
        },
        "name": "AWSLambdaBasicExecutionRole",
        "id": "ANDDDDDC42545SKXIK",
        "type": "managed",
        "arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
      }
    ],
    "trustedEntities": [
      "lambda.amazonaws.com"
    ]
  }
  </code></pre>
  
  <hr>
  
  <p>where <code>some-permission-boundary</code> is</p>
  
  <pre><code>{
      "Version": "2012-10-17",
      "Statement": [
          {
              "Action": [
                  "logs:CreateLogGroup",
                  "logs:CreateLogStream",
                  "logs:PutLogEvents"
              ],
              "Resource": [
                  "arn:aws:logs:us-east-1:111222333444:log-group:*"
              ],
              "Effect": "Allow",
          },
          {
              "Action": [
                  "sqs:*"
              ],
              "Resource": [
                  "arn:aws:sqs:us-east-1:*:*"
              ],
              "Effect": "Allow",
          }
      ]
  }
  </code></pre>
  
  <hr>
  
  <p>lambda performs below operation:</p>
  
  <pre><code>async function sendToQueue(message) {
    const params = {
      MessageBody: JSON.stringify(message),
      QueueUrl: process.env.queueUrl
    };
    return new Promise((resolve, reject) =&gt;
      sqs.sendMessage(params, (error, data) =&gt; error ? reject(error) : resolve())
    );
  }
  </code></pre>
  
  <hr>
  
  <p>that gives error:</p>
  
  <pre><code>"errorMessage": "Access to the resource https://sqs.us-east-1.amazonaws.com/ is denied.",
      "errorType": "AccessDenied",
  </code></pre>
  
  <hr>
  
  <p>We gave <code>sqs:*</code> actions to any queue across accounts in <code>some-permission-boundary</code></p>
  
  <hr>
  
  <p>Why lambda is not able to send message to queue?</p>