Overview
Two related improvements to Zappa's event-source handling that address limitations when multiple Lambda functions share trigger sources:
1. Multiple functions per AWS event ARN
Currently AWS_EVENT_MAPPING maps a single ARN to a single function. This means two functions listening to the same SQS queue, SNS topic, DynamoDB stream, or EventBridge rule require separate ARN entries and cannot share a trigger without duplicating infrastructure.
Proposed change: AWS_EVENT_MAPPING maps an ARN to a list of functions, with backward-compatible handling for the existing single-string format.
2. Merge (not overwrite) SNS filter policies
Currently SNSEventSource.update() overwrites the subscription's filter policy on each zappa update run. This discards any manually-added filter conditions from previous runs.
Proposed change: SNSEventSource.update() merges the new filter policy with the subscription's existing filter policy instead of replacing it entirely.
Related PR
A draft implementation exists at #1462 (currently conflicting with master; needs rebase before review).
Acceptance Criteria
Overview
Two related improvements to Zappa's event-source handling that address limitations when multiple Lambda functions share trigger sources:
1. Multiple functions per AWS event ARN
Currently
AWS_EVENT_MAPPINGmaps a single ARN to a single function. This means two functions listening to the same SQS queue, SNS topic, DynamoDB stream, or EventBridge rule require separate ARN entries and cannot share a trigger without duplicating infrastructure.Proposed change:
AWS_EVENT_MAPPINGmaps an ARN to a list of functions, with backward-compatible handling for the existing single-string format.2. Merge (not overwrite) SNS filter policies
Currently
SNSEventSource.update()overwrites the subscription's filter policy on eachzappa updaterun. This discards any manually-added filter conditions from previous runs.Proposed change:
SNSEventSource.update()merges the new filter policy with the subscription's existing filter policy instead of replacing it entirely.Related PR
A draft implementation exists at #1462 (currently conflicting with
master; needs rebase before review).Acceptance Criteria
AWS_EVENT_MAPPINGaccepts both a single function name (string, existing format) and a list of function names for a given ARNzappa deploy/zappa updateSNSEventSource.update()retrieves existing filter policy attributes and merges the new policy on top rather than replacing itpytest tests/test_handler.py tests/test_utilities.pypasses