Search code examples
amazon-s3

Using a wildcard on S3 Event Notification prefix


I have a Lambda function that creates a thumbnail image for every image that gets uploaded to my bucket, it then places the Thumbnail inside another bucket. When I upload a user image (profile pic) I use the users ID and name as part of the key:

System-images/users/250/john_doe.jpg

Is there a way to use a wildcard in the prefix path? This is what I have so far but it doesn't work

S3 bucket properties


Solution

  • No, you can't -- it's a literal prefix.

    In your example, you could use either of these prefixes, depending on what else is in the bucket (if there are things sharing the common prefix that you don't want to match):

    System-images/
    System-images/users/