Why do I get the error "Configuration is ambiguously defined" when creating an Amazon S3 event notification to trigger my Lambda function?
Last updated: 2021-01-11
I'm trying to create an Amazon Simple Storage Service (Amazon S3) bucket event notification to trigger my AWS Lambda function. Why am I getting the error "Configuration is ambiguously defined. Cannot have overlapping suffixes in two rules if the prefixes are overlapping for the same event type."?
The Configuration is ambiguously defined error occurs when a notification's event information and its prefix or suffix overlap with an S3 bucket's notification configuration.
The error can occur when you're doing one of the following:
- Recreating an S3 event notification that you recently deleted.
- Creating S3 event notifications for multiple overlapping events using overlapping prefixes or suffixes.
Note: Amazon S3 event notification configurations allow overlapping events with non-overlapping prefixes or suffixes. The configurations also allow non-overlapping events with overlapping prefixes or suffixes.
For more information and examples, see How to enable event notifications and Configuring notifications with object key name filtering.
Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you’re using the most recent AWS CLI version.
Do either of the following:
- Review the current notification configuration on your S3 bucket by running the AWS CLI command get-bucket-notification-configuration.
- Review your existing notification events in the Amazon S3 console. For more information, see Enabling and configuring event notifications.
Then, do one of the following:
Remove an overlapping event
In the Amazon S3 console, delete an existing event notification that overlaps with the new one that you're trying to create.
Update the notification configuration JSON file on your S3 bucket by running the AWS CLI command put-bucket-notification-configuration.
Reconfigure the new notification
For example, to specify that overlapping event objects, such as uploaded images, use a different S3 bucket folder (prefix) depending on the image file type (suffix):
Redesign for your use case
If you can't reconfigure your S3 event notification to avoid the overlap, try redesigning your architecture to work around it. For example:
- Configure an event notification to trigger a routing Lambda function that triggers other Lambda functions based on the S3 event.
- Configure an event notification to publish events to an Amazon Simple Notification Service (Amazon SNS) topic or Amazon Simple Queue Service (Amazon SQS) queue.
Note: Make sure that the topic or queue push events to multiple subscribed Lambda functions. Design the subscribed functions with logic to decide whether to process the events they receive. For more information, see Fanout S3 event notifications to multiple endpoints.
- Enable object-level logging of Amazon S3 actions to AWS CloudTrail, then use an Amazon CloudWatch Events rule to trigger your Lambda function based on the Amazon S3 event pattern. For more information, see Tutorial: Log Amazon S3 object-level operations using CloudWatch Events.