Create EventBridge rule and Test

Create EventBridge rule: S3 Raw → SQS

  1. Open EventBridge and select: Amazon EventBridge. On the left menu, select: Rules → Click: Create rule. image27.png image28.png image29.png image30.png
  2. Define rule detail: image31.png
    FieldValue
    Namedocuflow-dev-ingestion-s3-object-created-rule
    DescriptionRoute S3 Raw ObjectCreated events to DocuFlow processing SQS queue.
    Event busdefault
    Rule typeRule with an event pattern
  3. Build event pattern:
    • In the Event source section, select: Other. image32.png
    • Scroll down to the JSON box and paste this pattern:
      {
        "source": ["aws.s3"],
        "detail-type": ["Object Created"],
        "detail": {
          "bucket": {
            "name": ["docuflow-dev-raw-[accountId]-ap-southeast-1"]
          },
          "object": {
            "key": [
              {
                "prefix": "raw/"
              }
            ]
          }
        }
      }
      
      image33.png
    • Then click Next.
  4. Select target:
    • On the Select target(s) screen, choose:
      FieldSelection
      Target typeAWS service
      Select a targetSQS queue
      Queuedocuflow-dev-ingestion-processing-queue
      InputMatched event
  • image34.png image35.png
  1. Review Role name: docuflow-dev-ingestion-eventbridge-sqs-role, Configure tags and click Review and create. image36.png image37.png image38.png image39.png

Test S3 Raw → EventBridge → SQS

Step 1: Upload a test file to the correct prefix raw/

  • Go to S3 bucket: docuflow-dev-raw-[accountId]-ap-southeast-1
  • Click Create folder sequentially: raw
  • Inside the raw folder, create: user-demo
  • Inside the user-demo folder, create: doc-manual-001 image40.png image41.png image42.png
  • Inside the doc-manual-001 folder, click Upload and upload a PDF/JPG/PNG file. Name the file: original.pdf image43.png image44.png image45.png image46.png Step 2: Poll message in SQS
  • Go to Amazon SQS → Queues → docuflow-dev-ingestion-processing-queue image47.png image48.png
  • Click poll message. After messages appear, check one message. image49.png image50.png
  • Click View details. Open the Body section.
  • Check if it contains a JSON similar to what EventBridge routes to SQS:
    {
      "source": "aws.s3",
      "detail-type": "Object Created",
      "detail": {
        "bucket": {
          "name": "docuflow-dev-raw-[accountId]-ap-southeast-1"
        },
        "object": {
          "key": "raw/user-demo/doc-manual-001/original.pdf"
        }
      }
    }
    

image51.png