Skip to content

feat(forwarder): add SQS support as event source for S3 notifications#1064

Merged
LorisFriedel merged 5 commits intomasterfrom
loris.friedel/sqs-event-source-support-OBSPLTF-895
Feb 13, 2026
Merged

feat(forwarder): add SQS support as event source for S3 notifications#1064
LorisFriedel merged 5 commits intomasterfrom
loris.friedel/sqs-event-source-support-OBSPLTF-895

Conversation

@LorisFriedel
Copy link
Member

@LorisFriedel LorisFriedel commented Feb 11, 2026

Summary

  • Add SQS event source support so S3 notifications delivered via SQS queues (S3 -> SQS -> Lambda and S3 -> SNS -> SQS -> Lambda) are correctly parsed and forwarded to Datadog
  • SQS records are detected by eventSource: "aws:sqs", unwrapped (direct S3 or SNS-wrapped S3), and delegated to the existing S3EventHandler with fresh per-record metadata
  • Add required SQS IAM permissions (sqs:ReceiveMessage, sqs:DeleteMessage, sqs:GetQueueAttributes) to the CloudFormation template

Changes

File Change
steps/enums.py Add SQS to AwsEventType enum
steps/parsing.py Add SQS detection in parse_event_type(), sqs_handler, _extract_inner_event_from_sqs, _contains_s3_records
template.yaml Add SQS IAM permissions to ForwarderRolePolicy0
tests/test_parsing.py Add 9 unit tests (event type detection + parsing)
tests/events/sqs_s3.json New fixture: S3 -> SQS event
tests/events/sqs_sns_s3.json New fixture: S3 -> SNS -> SQS event

OBSPLTF-945

Support S3 event notifications delivered via SQS queues (S3 -> SQS -> Lambda
and S3 -> SNS -> SQS -> Lambda). The forwarder detects SQS event records,
unwraps the inner S3 event from the SQS body, and delegates to the existing
S3EventHandler. Each SQS record gets fresh metadata to avoid cross-contamination
across batch items.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@LorisFriedel LorisFriedel requested a review from a team as a code owner February 11, 2026 22:19
@github-actions github-actions bot added the aws label Feb 11, 2026
@ge0Aja ge0Aja self-assigned this Feb 12, 2026
Copy link
Contributor

@ge0Aja ge0Aja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, needs a lint check (we're using py3.13) for the moment since cf-lint is not supported in py3.14

LorisFriedel and others added 4 commits February 12, 2026 17:19
Add SqsQueueArnList parameter to optionally restrict SQS IAM
permissions to specific queue ARNs, following the same pattern
used for S3 bucket restrictions (S3BucketArnList/SetS3BucketArns).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
If an SQS message body is valid JSON but not a dict (e.g. a string,
number, or array), _contains_s3_records() would raise AttributeError
on .get(), crashing the entire batch. Add an isinstance check to
gracefully skip non-object bodies like we already do for malformed JSON.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@LorisFriedel LorisFriedel merged commit cbfd512 into master Feb 13, 2026
10 checks passed
@LorisFriedel LorisFriedel deleted the loris.friedel/sqs-event-source-support-OBSPLTF-895 branch February 13, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants