Christophe
Christophe

Reputation: 147

AWS put-bucket-notification-configuration won't let me use "Filter"

The command I use:

aws s3api put-bucket-notification-configuration --bucket bucket-name --notification-configuration file:///Users/chris/event_config.json

Works fine if I take out the "Filter" key. As soon as I add it in, I get:

Parameter validation failed:
Unknown parameter in NotificationConfiguration.LambdaFunctionConfigurations[0]: "Filter", must be one of: Id, LambdaFunctionArn, Events

Here's my JSON file:

{  
  "LambdaFunctionConfigurations": [
   {
     "LambdaFunctionArn": "arn:aws:lambda:us-east-1:000000000:function:name",
     "Events": [
        "s3:ObjectCreated:*"
     ],
     "Filter": {
       "Key": {
         "FilterRules": [
           {
             "Name": "prefix",
             "Value": "images/"
           }
         ]
       }
     }
   }
  ]
}

When I look at the command's docs (http://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-notification-configuration.html), I don't see any mistake. I've tried copy/pasting, carefully looking over, etc... Any help would be greatly appreciated!

Upvotes: 1

Views: 4716

Answers (1)

Michael - sqlbot
Michael - sqlbot

Reputation: 178956

You need to be running at least version 1.7.46 of aws-cli, released 2015-08-20.

This release adds Amazon S3 support for event notification filters and fixes some issues.

https://aws.amazon.com/releasenotes/CLI/3585202016507998

The aws-cli utility contains a lot of built-in intelligence and validation logic. New features often require the code in aws-cli to be updated, and Filter on S3 event notifications is a relatively recent feature.

See also: https://aws.amazon.com/blogs/aws/amazon-s3-update-delete-notifications-better-filters-bucket-metrics/

Upvotes: 2

Related Questions