> ## Documentation Index
> Fetch the complete documentation index at: https://getconvoy.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Amazon SQS

Convoy supports ingesting events from SQS queues. This is currently only supported in [outgoing projects](../../product-manual/organizations-and-projects#outgoing-project).

## Connecting to your SQS queue

To ingest events using Amazon SQS, follow the steps outlined below:

<Steps>
  <Step title="Create an IAM User for authenticating with the SQS Queue and attach the AmazonSQSFullAccess policy to the user">
    <Frame>
      <img src="https://mintcdn.com/convoy/Ckv6F6QCAG1QB-UF/images/create-sqs-user.png?fit=max&auto=format&n=Ckv6F6QCAG1QB-UF&q=85&s=ef66b1c02352134f8c99d0fde0aa4308" alt="create IAM user" width="2058" height="1628" data-path="images/create-sqs-user.png" />
    </Frame>
  </Step>

  <Step>
    <Frame>
      <img src="https://mintcdn.com/convoy/Ckv6F6QCAG1QB-UF/images/attach-sqs-policy.png?fit=max&auto=format&n=Ckv6F6QCAG1QB-UF&q=85&s=a0af16004f71df0fa1b2489a57295261" alt="attach AmazonSQSFullAccess policy" width="2072" height="1762" data-path="images/attach-sqs-policy.png" />
    </Frame>
  </Step>

  <Step title="Under the security credentials tab for the IAM user, generate a new Access Key">
    > **Take note of the Access Key and Secret Key generated**

    <Frame>
      <img src="https://mintcdn.com/convoy/Ckv6F6QCAG1QB-UF/images/generate-access-key.png?fit=max&auto=format&n=Ckv6F6QCAG1QB-UF&q=85&s=9fea7f563c1985c6cf7b7076f4f1366c" alt="generate a new access key" width="2584" height="1760" data-path="images/generate-access-key.png" />
    </Frame>
  </Step>

  <Step>
    <Frame>
      <img src="https://mintcdn.com/convoy/Ckv6F6QCAG1QB-UF/images/cli-access-key.png?fit=max&auto=format&n=Ckv6F6QCAG1QB-UF&q=85&s=f971a030e11b2b16c48fe27d3b2b847b" alt="create CLI access key" width="1890" height="1676" data-path="images/cli-access-key.png" />
    </Frame>
  </Step>

  <Step title="Create a SQS Queue and specify the ARN of the IAM user under the access policy">
    <Frame>
      <img src="https://mintcdn.com/convoy/Ckv6F6QCAG1QB-UF/images/create-sqs-queue.png?fit=max&auto=format&n=Ckv6F6QCAG1QB-UF&q=85&s=03854d6f912f58b3a47e742e9eddfd21" alt="create sqs queue" width="2262" height="1668" data-path="images/create-sqs-queue.png" />
    </Frame>
  </Step>

  <Step>
    <Frame>
      <img src="https://mintcdn.com/convoy/Ckv6F6QCAG1QB-UF/images/access-policy-iam-user.png?fit=max&auto=format&n=Ckv6F6QCAG1QB-UF&q=85&s=41a0d54d4b29ab6577c51aeee90c5eeb" alt="add the IAM user under access policy" width="2504" height="1626" data-path="images/access-policy-iam-user.png" />
    </Frame>
  </Step>

  <Step title="Going back to Convoy">
    Supply your `Access Key`, `Secret Key`, `Queue Name` and `Default Region`.
  </Step>
</Steps>

## Ingestion Options

There are two ways to ingest events into Convoy from your SQS queue:

* Format the payload using the structure below as a guide and write it to your queue.
  ```json5 reference payload theme={null}
   {
      "event_type": "string, required",
      "data": "object, required",
      "custom_headers": { // optional
          "x-convoy-message-type": "single",
          "sample-header": "sample-value"
      },
      "idempotency_key": "string, optional",
      "owner_id": "string, optional", // if included, the event is sent to all endpoints with the owner-id
      "endpoint_id": "string, optional" // if included, the event is sent to a single endpoint
   }
  ```
  > If `x-convoy-message-type` set to **broadcast**, the event will be sent to all endpoints in the project, ignoring both the `endpoint_id` and `owner_id` values.

For a full list of reference payloads, see [our guide on ingesting events](../../product-manual/events-and-event-deliveries#ingesting-events)

* Send your arbitrarily formatted event payloads to your queue and use Convoy’s transform functions to mutate them at the point of ingestion.
  ```js transform function theme={null}
  function transform(payload) {
      return {
          "endpoint_id": "",
          "owner_id": "",
          "event_type": "sample",
          "data": payload, // payload contains arbitrary message data read from your queue
          "custom_headers": {
              "sample-header": "sample-value"
          },
          "idempotency_key": ""
      }
  }
  ```

## Things to note

* Messages are read of the topic one-by-one by each worker reading off the queue.
* Acknowledgements are done per message.
* Ingestion is rate-limited (50 per second), and this can be configured by setting the `CONVOY_INGEST_RATE` environment variable.
