Skip to content

Support multiple functions per AWS event ARN, merge SNS filter policies #1464

Description

@ellen-goc

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

  • AWS_EVENT_MAPPING accepts both a single function name (string, existing format) and a list of function names for a given ARN
  • All functions listed for an ARN are registered as event consumers during zappa deploy/zappa update
  • SNSEventSource.update() retrieves existing filter policy attributes and merges the new policy on top rather than replacing it
  • pytest tests/test_handler.py tests/test_utilities.py passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions