AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.4.0 published on Wednesday, May 4, 2022 by Pulumi

BucketNotification

Manages a S3 Bucket Notification Configuration. For additional information, see the Configuring S3 Event Notifications section in the Amazon S3 Developer Guide.

NOTE: S3 Buckets only support a single notification configuration. Declaring multiple aws.s3.BucketNotification resources to the same S3 Bucket will cause a perpetual difference in configuration. See the example “Trigger multiple Lambda functions” for an option.

Example Usage

Add notification configuration to SNS Topic

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var bucket = new Aws.S3.BucketV2("bucket", new Aws.S3.BucketV2Args
        {
        });
        var topic = new Aws.Sns.Topic("topic", new Aws.Sns.TopicArgs
        {
            Policy = bucket.Arn.Apply(arn => @$"{{
    ""Version"":""2012-10-17"",
    ""Statement"":[{{
        ""Effect"": ""Allow"",
        ""Principal"": {{ ""Service"": ""s3.amazonaws.com"" }},
        ""Action"": ""SNS:Publish"",
        ""Resource"": ""arn:aws:sns:*:*:s3-event-notification-topic"",
        ""Condition"":{{
            ""ArnLike"":{{""aws:SourceArn"":""{arn}""}}
        }}
    }}]
}}
"),
        });
        var bucketNotification = new Aws.S3.BucketNotification("bucketNotification", new Aws.S3.BucketNotificationArgs
        {
            Bucket = bucket.Id,
            Topics = 
            {
                new Aws.S3.Inputs.BucketNotificationTopicArgs
                {
                    TopicArn = topic.Arn,
                    Events = 
                    {
                        "s3:ObjectCreated:*",
                    },
                    FilterSuffix = ".log",
                },
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/sns"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		bucket, err := s3.NewBucketV2(ctx, "bucket", nil)
		if err != nil {
			return err
		}
		topic, err := sns.NewTopic(ctx, "topic", &sns.TopicArgs{
			Policy: bucket.Arn.ApplyT(func(arn string) (string, error) {
				return fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "    \"Version\":\"2012-10-17\",\n", "    \"Statement\":[{\n", "        \"Effect\": \"Allow\",\n", "        \"Principal\": { \"Service\": \"s3.amazonaws.com\" },\n", "        \"Action\": \"SNS:Publish\",\n", "        \"Resource\": \"arn:aws:sns:*:*:s3-event-notification-topic\",\n", "        \"Condition\":{\n", "            \"ArnLike\":{\"aws:SourceArn\":\"", arn, "\"}\n", "        }\n", "    }]\n", "}\n"), nil
			}).(pulumi.StringOutput),
		})
		if err != nil {
			return err
		}
		_, err = s3.NewBucketNotification(ctx, "bucketNotification", &s3.BucketNotificationArgs{
			Bucket: bucket.ID(),
			Topics: s3.BucketNotificationTopicArray{
				&s3.BucketNotificationTopicArgs{
					TopicArn: topic.Arn,
					Events: pulumi.StringArray{
						pulumi.String("s3:ObjectCreated:*"),
					},
					FilterSuffix: pulumi.String(".log"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var bucket = new BucketV2("bucket");

        var topic = new Topic("topic", TopicArgs.builder()        
            .policy(bucket.getArn().apply(arn -> """
{
    "Version":"2012-10-17",
    "Statement":[{
        "Effect": "Allow",
        "Principal": { "Service": "s3.amazonaws.com" },
        "Action": "SNS:Publish",
        "Resource": "arn:aws:sns:*:*:s3-event-notification-topic",
        "Condition":{
            "ArnLike":{"aws:SourceArn":"%s"}
        }
    }]
}
", arn)))
            .build());

        var bucketNotification = new BucketNotification("bucketNotification", BucketNotificationArgs.builder()        
            .bucket(bucket.getId())
            .topics(BucketNotificationTopic.builder()
                .topicArn(topic.getArn())
                .events("s3:ObjectCreated:*")
                .filterSuffix(".log")
                .build())
            .build());

        }
}
import pulumi
import pulumi_aws as aws

bucket = aws.s3.BucketV2("bucket")
topic = aws.sns.Topic("topic", policy=bucket.arn.apply(lambda arn: f"""{{
    "Version":"2012-10-17",
    "Statement":[{{
        "Effect": "Allow",
        "Principal": {{ "Service": "s3.amazonaws.com" }},
        "Action": "SNS:Publish",
        "Resource": "arn:aws:sns:*:*:s3-event-notification-topic",
        "Condition":{{
            "ArnLike":{{"aws:SourceArn":"{arn}"}}
        }}
    }}]
}}
"""))
bucket_notification = aws.s3.BucketNotification("bucketNotification",
    bucket=bucket.id,
    topics=[aws.s3.BucketNotificationTopicArgs(
        topic_arn=topic.arn,
        events=["s3:ObjectCreated:*"],
        filter_suffix=".log",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const bucket = new aws.s3.BucketV2("bucket", {});
const topic = new aws.sns.Topic("topic", {policy: pulumi.interpolate`{
    "Version":"2012-10-17",
    "Statement":[{
        "Effect": "Allow",
        "Principal": { "Service": "s3.amazonaws.com" },
        "Action": "SNS:Publish",
        "Resource": "arn:aws:sns:*:*:s3-event-notification-topic",
        "Condition":{
            "ArnLike":{"aws:SourceArn":"${bucket.arn}"}
        }
    }]
}
`});
const bucketNotification = new aws.s3.BucketNotification("bucketNotification", {
    bucket: bucket.id,
    topics: [{
        topicArn: topic.arn,
        events: ["s3:ObjectCreated:*"],
        filterSuffix: ".log",
    }],
});
resources:
  topic:
    type: aws:sns:Topic
    properties:
      policy: |
        {
            "Version":"2012-10-17",
            "Statement":[{
                "Effect": "Allow",
                "Principal": { "Service": "s3.amazonaws.com" },
                "Action": "SNS:Publish",
                "Resource": "arn:aws:sns:*:*:s3-event-notification-topic",
                "Condition":{
                    "ArnLike":{"aws:SourceArn":"${bucket.arn}"}
                }
            }]
        }        
  bucket:
    type: aws:s3:BucketV2
  bucketNotification:
    type: aws:s3:BucketNotification
    properties:
      bucket: ${bucket.id}
      topics:
        - topicArn: ${topic.arn}
          events:
            - s3:ObjectCreated:*
          filterSuffix: .log

Add notification configuration to SQS Queue

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var bucket = new Aws.S3.BucketV2("bucket", new Aws.S3.BucketV2Args
        {
        });
        var queue = new Aws.Sqs.Queue("queue", new Aws.Sqs.QueueArgs
        {
            Policy = bucket.Arn.Apply(arn => @$"{{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {{
      ""Effect"": ""Allow"",
      ""Principal"": ""*"",
      ""Action"": ""sqs:SendMessage"",
	  ""Resource"": ""arn:aws:sqs:*:*:s3-event-notification-queue"",
      ""Condition"": {{
        ""ArnEquals"": {{ ""aws:SourceArn"": ""{arn}"" }}
      }}
    }}
  ]
}}
"),
        });
        var bucketNotification = new Aws.S3.BucketNotification("bucketNotification", new Aws.S3.BucketNotificationArgs
        {
            Bucket = bucket.Id,
            Queues = 
            {
                new Aws.S3.Inputs.BucketNotificationQueueArgs
                {
                    QueueArn = queue.Arn,
                    Events = 
                    {
                        "s3:ObjectCreated:*",
                    },
                    FilterSuffix = ".log",
                },
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/sqs"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		bucket, err := s3.NewBucketV2(ctx, "bucket", nil)
		if err != nil {
			return err
		}
		queue, err := sqs.NewQueue(ctx, "queue", &sqs.QueueArgs{
			Policy: bucket.Arn.ApplyT(func(arn string) (string, error) {
				return fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "  \"Version\": \"2012-10-17\",\n", "  \"Statement\": [\n", "    {\n", "      \"Effect\": \"Allow\",\n", "      \"Principal\": \"*\",\n", "      \"Action\": \"sqs:SendMessage\",\n", "	  \"Resource\": \"arn:aws:sqs:*:*:s3-event-notification-queue\",\n", "      \"Condition\": {\n", "        \"ArnEquals\": { \"aws:SourceArn\": \"", arn, "\" }\n", "      }\n", "    }\n", "  ]\n", "}\n"), nil
			}).(pulumi.StringOutput),
		})
		if err != nil {
			return err
		}
		_, err = s3.NewBucketNotification(ctx, "bucketNotification", &s3.BucketNotificationArgs{
			Bucket: bucket.ID(),
			Queues: s3.BucketNotificationQueueArray{
				&s3.BucketNotificationQueueArgs{
					QueueArn: queue.Arn,
					Events: pulumi.StringArray{
						pulumi.String("s3:ObjectCreated:*"),
					},
					FilterSuffix: pulumi.String(".log"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var bucket = new BucketV2("bucket");

        var queue = new Queue("queue", QueueArgs.builder()        
            .policy(bucket.getArn().apply(arn -> """
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": "*",
      "Action": "sqs:SendMessage",
	  "Resource": "arn:aws:sqs:*:*:s3-event-notification-queue",
      "Condition": {
        "ArnEquals": { "aws:SourceArn": "%s" }
      }
    }
  ]
}
", arn)))
            .build());

        var bucketNotification = new BucketNotification("bucketNotification", BucketNotificationArgs.builder()        
            .bucket(bucket.getId())
            .queues(BucketNotificationQueue.builder()
                .queueArn(queue.getArn())
                .events("s3:ObjectCreated:*")
                .filterSuffix(".log")
                .build())
            .build());

        }
}
import pulumi
import pulumi_aws as aws

bucket = aws.s3.BucketV2("bucket")
queue = aws.sqs.Queue("queue", policy=bucket.arn.apply(lambda arn: f"""{{
  "Version": "2012-10-17",
  "Statement": [
    {{
      "Effect": "Allow",
      "Principal": "*",
      "Action": "sqs:SendMessage",
	  "Resource": "arn:aws:sqs:*:*:s3-event-notification-queue",
      "Condition": {{
        "ArnEquals": {{ "aws:SourceArn": "{arn}" }}
      }}
    }}
  ]
}}
"""))
bucket_notification = aws.s3.BucketNotification("bucketNotification",
    bucket=bucket.id,
    queues=[aws.s3.BucketNotificationQueueArgs(
        queue_arn=queue.arn,
        events=["s3:ObjectCreated:*"],
        filter_suffix=".log",
    )])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const bucket = new aws.s3.BucketV2("bucket", {});
const queue = new aws.sqs.Queue("queue", {policy: pulumi.interpolate`{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": "*",
      "Action": "sqs:SendMessage",
	  "Resource": "arn:aws:sqs:*:*:s3-event-notification-queue",
      "Condition": {
        "ArnEquals": { "aws:SourceArn": "${bucket.arn}" }
      }
    }
  ]
}
`});
const bucketNotification = new aws.s3.BucketNotification("bucketNotification", {
    bucket: bucket.id,
    queues: [{
        queueArn: queue.arn,
        events: ["s3:ObjectCreated:*"],
        filterSuffix: ".log",
    }],
});
resources:
  queue:
    type: aws:sqs:Queue
    properties:
      policy: |
        {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Effect": "Allow",
              "Principal": "*",
              "Action": "sqs:SendMessage",
        	  "Resource": "arn:aws:sqs:*:*:s3-event-notification-queue",
              "Condition": {
                "ArnEquals": { "aws:SourceArn": "${bucket.arn}" }
              }
            }
          ]
        }        
  bucket:
    type: aws:s3:BucketV2
  bucketNotification:
    type: aws:s3:BucketNotification
    properties:
      bucket: ${bucket.id}
      queues:
        - queueArn: ${queue.arn}
          events:
            - s3:ObjectCreated:*
          filterSuffix: .log

Add notification configuration to Lambda Function

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var iamForLambda = new Aws.Iam.Role("iamForLambda", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = @"{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Action"": ""sts:AssumeRole"",
      ""Principal"": {
        ""Service"": ""lambda.amazonaws.com""
      },
      ""Effect"": ""Allow""
    }
  ]
}
",
        });
        var func = new Aws.Lambda.Function("func", new Aws.Lambda.FunctionArgs
        {
            Code = new FileArchive("your-function.zip"),
            Role = iamForLambda.Arn,
            Handler = "exports.example",
            Runtime = "go1.x",
        });
        var bucket = new Aws.S3.BucketV2("bucket", new Aws.S3.BucketV2Args
        {
        });
        var allowBucket = new Aws.Lambda.Permission("allowBucket", new Aws.Lambda.PermissionArgs
        {
            Action = "lambda:InvokeFunction",
            Function = func.Arn,
            Principal = "s3.amazonaws.com",
            SourceArn = bucket.Arn,
        });
        var bucketNotification = new Aws.S3.BucketNotification("bucketNotification", new Aws.S3.BucketNotificationArgs
        {
            Bucket = bucket.Id,
            LambdaFunctions = 
            {
                new Aws.S3.Inputs.BucketNotificationLambdaFunctionArgs
                {
                    LambdaFunctionArn = func.Arn,
                    Events = 
                    {
                        "s3:ObjectCreated:*",
                    },
                    FilterPrefix = "AWSLogs/",
                    FilterSuffix = ".log",
                },
            },
        }, new CustomResourceOptions
        {
            DependsOn = 
            {
                allowBucket,
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iam"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/lambda"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		iamForLambda, err := iam.NewRole(ctx, "iamForLambda", &iam.RoleArgs{
			AssumeRolePolicy: pulumi.Any(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "  \"Version\": \"2012-10-17\",\n", "  \"Statement\": [\n", "    {\n", "      \"Action\": \"sts:AssumeRole\",\n", "      \"Principal\": {\n", "        \"Service\": \"lambda.amazonaws.com\"\n", "      },\n", "      \"Effect\": \"Allow\"\n", "    }\n", "  ]\n", "}\n")),
		})
		if err != nil {
			return err
		}
		_, err = lambda.NewFunction(ctx, "func", &lambda.FunctionArgs{
			Code:    pulumi.NewFileArchive("your-function.zip"),
			Role:    iamForLambda.Arn,
			Handler: pulumi.String("exports.example"),
			Runtime: pulumi.String("go1.x"),
		})
		if err != nil {
			return err
		}
		bucket, err := s3.NewBucketV2(ctx, "bucket", nil)
		if err != nil {
			return err
		}
		allowBucket, err := lambda.NewPermission(ctx, "allowBucket", &lambda.PermissionArgs{
			Action:    pulumi.String("lambda:InvokeFunction"),
			Function:  _func.Arn,
			Principal: pulumi.String("s3.amazonaws.com"),
			SourceArn: bucket.Arn,
		})
		if err != nil {
			return err
		}
		_, err = s3.NewBucketNotification(ctx, "bucketNotification", &s3.BucketNotificationArgs{
			Bucket: bucket.ID(),
			LambdaFunctions: s3.BucketNotificationLambdaFunctionArray{
				&s3.BucketNotificationLambdaFunctionArgs{
					LambdaFunctionArn: _func.Arn,
					Events: pulumi.StringArray{
						pulumi.String("s3:ObjectCreated:*"),
					},
					FilterPrefix: pulumi.String("AWSLogs/"),
					FilterSuffix: pulumi.String(".log"),
				},
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			allowBucket,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var iamForLambda = new Role("iamForLambda", RoleArgs.builder()        
            .assumeRolePolicy("""
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "lambda.amazonaws.com"
      },
      "Effect": "Allow"
    }
  ]
}
            """)
            .build());

        var func = new Function("func", FunctionArgs.builder()        
            .code(new FileArchive("your-function.zip"))
            .role(iamForLambda.getArn())
            .handler("exports.example")
            .runtime("go1.x")
            .build());

        var bucket = new BucketV2("bucket");

        var allowBucket = new Permission("allowBucket", PermissionArgs.builder()        
            .action("lambda:InvokeFunction")
            .function(func.getArn())
            .principal("s3.amazonaws.com")
            .sourceArn(bucket.getArn())
            .build());

        var bucketNotification = new BucketNotification("bucketNotification", BucketNotificationArgs.builder()        
            .bucket(bucket.getId())
            .lambdaFunctions(BucketNotificationLambdaFunction.builder()
                .lambdaFunctionArn(func.getArn())
                .events("s3:ObjectCreated:*")
                .filterPrefix("AWSLogs/")
                .filterSuffix(".log")
                .build())
            .build());

        }
}
import pulumi
import pulumi_aws as aws

iam_for_lambda = aws.iam.Role("iamForLambda", assume_role_policy="""{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "lambda.amazonaws.com"
      },
      "Effect": "Allow"
    }
  ]
}
""")
func = aws.lambda_.Function("func",
    code=pulumi.FileArchive("your-function.zip"),
    role=iam_for_lambda.arn,
    handler="exports.example",
    runtime="go1.x")
bucket = aws.s3.BucketV2("bucket")
allow_bucket = aws.lambda_.Permission("allowBucket",
    action="lambda:InvokeFunction",
    function=func.arn,
    principal="s3.amazonaws.com",
    source_arn=bucket.arn)
bucket_notification = aws.s3.BucketNotification("bucketNotification",
    bucket=bucket.id,
    lambda_functions=[aws.s3.BucketNotificationLambdaFunctionArgs(
        lambda_function_arn=func.arn,
        events=["s3:ObjectCreated:*"],
        filter_prefix="AWSLogs/",
        filter_suffix=".log",
    )],
    opts=pulumi.ResourceOptions(depends_on=[allow_bucket]))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const iamForLambda = new aws.iam.Role("iamForLambda", {assumeRolePolicy: `{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "lambda.amazonaws.com"
      },
      "Effect": "Allow"
    }
  ]
}
`});
const func = new aws.lambda.Function("func", {
    code: new pulumi.asset.FileArchive("your-function.zip"),
    role: iamForLambda.arn,
    handler: "exports.example",
    runtime: "go1.x",
});
const bucket = new aws.s3.BucketV2("bucket", {});
const allowBucket = new aws.lambda.Permission("allowBucket", {
    action: "lambda:InvokeFunction",
    "function": func.arn,
    principal: "s3.amazonaws.com",
    sourceArn: bucket.arn,
});
const bucketNotification = new aws.s3.BucketNotification("bucketNotification", {
    bucket: bucket.id,
    lambdaFunctions: [{
        lambdaFunctionArn: func.arn,
        events: ["s3:ObjectCreated:*"],
        filterPrefix: "AWSLogs/",
        filterSuffix: ".log",
    }],
}, {
    dependsOn: [allowBucket],
});
resources:
  iamForLambda:
    type: aws:iam:Role
    properties:
      assumeRolePolicy: |
        {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Principal": {
                "Service": "lambda.amazonaws.com"
              },
              "Effect": "Allow"
            }
          ]
        }        
  allowBucket:
    type: aws:lambda:Permission
    properties:
      action: lambda:InvokeFunction
      function: ${func.arn}
      principal: s3.amazonaws.com
      sourceArn: ${bucket.arn}
  func:
    type: aws:lambda:Function
    properties:
      code:
        Fn::FileArchive: your-function.zip
      role: ${iamForLambda.arn}
      handler: exports.example
      runtime: go1.x
  bucket:
    type: aws:s3:BucketV2
  bucketNotification:
    type: aws:s3:BucketNotification
    properties:
      bucket: ${bucket.id}
      lambdaFunctions:
        - lambdaFunctionArn: ${func.arn}
          events:
            - s3:ObjectCreated:*
          filterPrefix: AWSLogs/
          filterSuffix: .log
    options:
      dependson:
        - ${allowBucket}

Trigger multiple Lambda functions

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var iamForLambda = new Aws.Iam.Role("iamForLambda", new Aws.Iam.RoleArgs
        {
            AssumeRolePolicy = @"{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Action"": ""sts:AssumeRole"",
      ""Principal"": {
        ""Service"": ""lambda.amazonaws.com""
      },
      ""Effect"": ""Allow""
    }
  ]
}
",
        });
        var func1 = new Aws.Lambda.Function("func1", new Aws.Lambda.FunctionArgs
        {
            Code = new FileArchive("your-function1.zip"),
            Role = iamForLambda.Arn,
            Handler = "exports.example",
            Runtime = "go1.x",
        });
        var bucket = new Aws.S3.BucketV2("bucket", new Aws.S3.BucketV2Args
        {
        });
        var allowBucket1 = new Aws.Lambda.Permission("allowBucket1", new Aws.Lambda.PermissionArgs
        {
            Action = "lambda:InvokeFunction",
            Function = func1.Arn,
            Principal = "s3.amazonaws.com",
            SourceArn = bucket.Arn,
        });
        var func2 = new Aws.Lambda.Function("func2", new Aws.Lambda.FunctionArgs
        {
            Code = new FileArchive("your-function2.zip"),
            Role = iamForLambda.Arn,
            Handler = "exports.example",
        });
        var allowBucket2 = new Aws.Lambda.Permission("allowBucket2", new Aws.Lambda.PermissionArgs
        {
            Action = "lambda:InvokeFunction",
            Function = func2.Arn,
            Principal = "s3.amazonaws.com",
            SourceArn = bucket.Arn,
        });
        var bucketNotification = new Aws.S3.BucketNotification("bucketNotification", new Aws.S3.BucketNotificationArgs
        {
            Bucket = bucket.Id,
            LambdaFunctions = 
            {
                new Aws.S3.Inputs.BucketNotificationLambdaFunctionArgs
                {
                    LambdaFunctionArn = func1.Arn,
                    Events = 
                    {
                        "s3:ObjectCreated:*",
                    },
                    FilterPrefix = "AWSLogs/",
                    FilterSuffix = ".log",
                },
                new Aws.S3.Inputs.BucketNotificationLambdaFunctionArgs
                {
                    LambdaFunctionArn = func2.Arn,
                    Events = 
                    {
                        "s3:ObjectCreated:*",
                    },
                    FilterPrefix = "OtherLogs/",
                    FilterSuffix = ".log",
                },
            },
        }, new CustomResourceOptions
        {
            DependsOn = 
            {
                allowBucket1,
                allowBucket2,
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iam"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/lambda"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		iamForLambda, err := iam.NewRole(ctx, "iamForLambda", &iam.RoleArgs{
			AssumeRolePolicy: pulumi.Any(fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "  \"Version\": \"2012-10-17\",\n", "  \"Statement\": [\n", "    {\n", "      \"Action\": \"sts:AssumeRole\",\n", "      \"Principal\": {\n", "        \"Service\": \"lambda.amazonaws.com\"\n", "      },\n", "      \"Effect\": \"Allow\"\n", "    }\n", "  ]\n", "}\n")),
		})
		if err != nil {
			return err
		}
		func1, err := lambda.NewFunction(ctx, "func1", &lambda.FunctionArgs{
			Code:    pulumi.NewFileArchive("your-function1.zip"),
			Role:    iamForLambda.Arn,
			Handler: pulumi.String("exports.example"),
			Runtime: pulumi.String("go1.x"),
		})
		if err != nil {
			return err
		}
		bucket, err := s3.NewBucketV2(ctx, "bucket", nil)
		if err != nil {
			return err
		}
		allowBucket1, err := lambda.NewPermission(ctx, "allowBucket1", &lambda.PermissionArgs{
			Action:    pulumi.String("lambda:InvokeFunction"),
			Function:  func1.Arn,
			Principal: pulumi.String("s3.amazonaws.com"),
			SourceArn: bucket.Arn,
		})
		if err != nil {
			return err
		}
		func2, err := lambda.NewFunction(ctx, "func2", &lambda.FunctionArgs{
			Code:    pulumi.NewFileArchive("your-function2.zip"),
			Role:    iamForLambda.Arn,
			Handler: pulumi.String("exports.example"),
		})
		if err != nil {
			return err
		}
		allowBucket2, err := lambda.NewPermission(ctx, "allowBucket2", &lambda.PermissionArgs{
			Action:    pulumi.String("lambda:InvokeFunction"),
			Function:  func2.Arn,
			Principal: pulumi.String("s3.amazonaws.com"),
			SourceArn: bucket.Arn,
		})
		if err != nil {
			return err
		}
		_, err = s3.NewBucketNotification(ctx, "bucketNotification", &s3.BucketNotificationArgs{
			Bucket: bucket.ID(),
			LambdaFunctions: s3.BucketNotificationLambdaFunctionArray{
				&s3.BucketNotificationLambdaFunctionArgs{
					LambdaFunctionArn: func1.Arn,
					Events: pulumi.StringArray{
						pulumi.String("s3:ObjectCreated:*"),
					},
					FilterPrefix: pulumi.String("AWSLogs/"),
					FilterSuffix: pulumi.String(".log"),
				},
				&s3.BucketNotificationLambdaFunctionArgs{
					LambdaFunctionArn: func2.Arn,
					Events: pulumi.StringArray{
						pulumi.String("s3:ObjectCreated:*"),
					},
					FilterPrefix: pulumi.String("OtherLogs/"),
					FilterSuffix: pulumi.String(".log"),
				},
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			allowBucket1,
			allowBucket2,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var iamForLambda = new Role("iamForLambda", RoleArgs.builder()        
            .assumeRolePolicy("""
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "lambda.amazonaws.com"
      },
      "Effect": "Allow"
    }
  ]
}
            """)
            .build());

        var func1 = new Function("func1", FunctionArgs.builder()        
            .code(new FileArchive("your-function1.zip"))
            .role(iamForLambda.getArn())
            .handler("exports.example")
            .runtime("go1.x")
            .build());

        var bucket = new BucketV2("bucket");

        var allowBucket1 = new Permission("allowBucket1", PermissionArgs.builder()        
            .action("lambda:InvokeFunction")
            .function(func1.getArn())
            .principal("s3.amazonaws.com")
            .sourceArn(bucket.getArn())
            .build());

        var func2 = new Function("func2", FunctionArgs.builder()        
            .code(new FileArchive("your-function2.zip"))
            .role(iamForLambda.getArn())
            .handler("exports.example")
            .build());

        var allowBucket2 = new Permission("allowBucket2", PermissionArgs.builder()        
            .action("lambda:InvokeFunction")
            .function(func2.getArn())
            .principal("s3.amazonaws.com")
            .sourceArn(bucket.getArn())
            .build());

        var bucketNotification = new BucketNotification("bucketNotification", BucketNotificationArgs.builder()        
            .bucket(bucket.getId())
            .lambdaFunctions(            
                BucketNotificationLambdaFunction.builder()
                    .lambdaFunctionArn(func1.getArn())
                    .events("s3:ObjectCreated:*")
                    .filterPrefix("AWSLogs/")
                    .filterSuffix(".log")
                    .build(),
                BucketNotificationLambdaFunction.builder()
                    .lambdaFunctionArn(func2.getArn())
                    .events("s3:ObjectCreated:*")
                    .filterPrefix("OtherLogs/")
                    .filterSuffix(".log")
                    .build())
            .build());

        }
}
import pulumi
import pulumi_aws as aws

iam_for_lambda = aws.iam.Role("iamForLambda", assume_role_policy="""{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "lambda.amazonaws.com"
      },
      "Effect": "Allow"
    }
  ]
}
""")
func1 = aws.lambda_.Function("func1",
    code=pulumi.FileArchive("your-function1.zip"),
    role=iam_for_lambda.arn,
    handler="exports.example",
    runtime="go1.x")
bucket = aws.s3.BucketV2("bucket")
allow_bucket1 = aws.lambda_.Permission("allowBucket1",
    action="lambda:InvokeFunction",
    function=func1.arn,
    principal="s3.amazonaws.com",
    source_arn=bucket.arn)
func2 = aws.lambda_.Function("func2",
    code=pulumi.FileArchive("your-function2.zip"),
    role=iam_for_lambda.arn,
    handler="exports.example")
allow_bucket2 = aws.lambda_.Permission("allowBucket2",
    action="lambda:InvokeFunction",
    function=func2.arn,
    principal="s3.amazonaws.com",
    source_arn=bucket.arn)
bucket_notification = aws.s3.BucketNotification("bucketNotification",
    bucket=bucket.id,
    lambda_functions=[
        aws.s3.BucketNotificationLambdaFunctionArgs(
            lambda_function_arn=func1.arn,
            events=["s3:ObjectCreated:*"],
            filter_prefix="AWSLogs/",
            filter_suffix=".log",
        ),
        aws.s3.BucketNotificationLambdaFunctionArgs(
            lambda_function_arn=func2.arn,
            events=["s3:ObjectCreated:*"],
            filter_prefix="OtherLogs/",
            filter_suffix=".log",
        ),
    ],
    opts=pulumi.ResourceOptions(depends_on=[
            allow_bucket1,
            allow_bucket2,
        ]))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const iamForLambda = new aws.iam.Role("iamForLambda", {assumeRolePolicy: `{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": "sts:AssumeRole",
      "Principal": {
        "Service": "lambda.amazonaws.com"
      },
      "Effect": "Allow"
    }
  ]
}
`});
const func1 = new aws.lambda.Function("func1", {
    code: new pulumi.asset.FileArchive("your-function1.zip"),
    role: iamForLambda.arn,
    handler: "exports.example",
    runtime: "go1.x",
});
const bucket = new aws.s3.BucketV2("bucket", {});
const allowBucket1 = new aws.lambda.Permission("allowBucket1", {
    action: "lambda:InvokeFunction",
    "function": func1.arn,
    principal: "s3.amazonaws.com",
    sourceArn: bucket.arn,
});
const func2 = new aws.lambda.Function("func2", {
    code: new pulumi.asset.FileArchive("your-function2.zip"),
    role: iamForLambda.arn,
    handler: "exports.example",
});
const allowBucket2 = new aws.lambda.Permission("allowBucket2", {
    action: "lambda:InvokeFunction",
    "function": func2.arn,
    principal: "s3.amazonaws.com",
    sourceArn: bucket.arn,
});
const bucketNotification = new aws.s3.BucketNotification("bucketNotification", {
    bucket: bucket.id,
    lambdaFunctions: [
        {
            lambdaFunctionArn: func1.arn,
            events: ["s3:ObjectCreated:*"],
            filterPrefix: "AWSLogs/",
            filterSuffix: ".log",
        },
        {
            lambdaFunctionArn: func2.arn,
            events: ["s3:ObjectCreated:*"],
            filterPrefix: "OtherLogs/",
            filterSuffix: ".log",
        },
    ],
}, {
    dependsOn: [
        allowBucket1,
        allowBucket2,
    ],
});
resources:
  iamForLambda:
    type: aws:iam:Role
    properties:
      assumeRolePolicy: |
        {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Principal": {
                "Service": "lambda.amazonaws.com"
              },
              "Effect": "Allow"
            }
          ]
        }        
  allowBucket1:
    type: aws:lambda:Permission
    properties:
      action: lambda:InvokeFunction
      function: ${func1.arn}
      principal: s3.amazonaws.com
      sourceArn: ${bucket.arn}
  func1:
    type: aws:lambda:Function
    properties:
      code:
        Fn::FileArchive: your-function1.zip
      role: ${iamForLambda.arn}
      handler: exports.example
      runtime: go1.x
  allowBucket2:
    type: aws:lambda:Permission
    properties:
      action: lambda:InvokeFunction
      function: ${func2.arn}
      principal: s3.amazonaws.com
      sourceArn: ${bucket.arn}
  func2:
    type: aws:lambda:Function
    properties:
      code:
        Fn::FileArchive: your-function2.zip
      role: ${iamForLambda.arn}
      handler: exports.example
  bucket:
    type: aws:s3:BucketV2
  bucketNotification:
    type: aws:s3:BucketNotification
    properties:
      bucket: ${bucket.id}
      lambdaFunctions:
        - lambdaFunctionArn: ${func1.arn}
          events:
            - s3:ObjectCreated:*
          filterPrefix: AWSLogs/
          filterSuffix: .log
        - lambdaFunctionArn: ${func2.arn}
          events:
            - s3:ObjectCreated:*
          filterPrefix: OtherLogs/
          filterSuffix: .log
    options:
      dependson:
        - ${allowBucket1}
        - ${allowBucket2}

Add multiple notification configurations to SQS Queue

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var bucket = new Aws.S3.BucketV2("bucket", new Aws.S3.BucketV2Args
        {
        });
        var queue = new Aws.Sqs.Queue("queue", new Aws.Sqs.QueueArgs
        {
            Policy = bucket.Arn.Apply(arn => @$"{{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {{
      ""Effect"": ""Allow"",
      ""Principal"": ""*"",
      ""Action"": ""sqs:SendMessage"",
	  ""Resource"": ""arn:aws:sqs:*:*:s3-event-notification-queue"",
      ""Condition"": {{
        ""ArnEquals"": {{ ""aws:SourceArn"": ""{arn}"" }}
      }}
    }}
  ]
}}
"),
        });
        var bucketNotification = new Aws.S3.BucketNotification("bucketNotification", new Aws.S3.BucketNotificationArgs
        {
            Bucket = bucket.Id,
            Queues = 
            {
                new Aws.S3.Inputs.BucketNotificationQueueArgs
                {
                    Id = "image-upload-event",
                    QueueArn = queue.Arn,
                    Events = 
                    {
                        "s3:ObjectCreated:*",
                    },
                    FilterPrefix = "images/",
                },
                new Aws.S3.Inputs.BucketNotificationQueueArgs
                {
                    Id = "video-upload-event",
                    QueueArn = queue.Arn,
                    Events = 
                    {
                        "s3:ObjectCreated:*",
                    },
                    FilterPrefix = "videos/",
                },
            },
        });
    }

}
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/sqs"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		bucket, err := s3.NewBucketV2(ctx, "bucket", nil)
		if err != nil {
			return err
		}
		queue, err := sqs.NewQueue(ctx, "queue", &sqs.QueueArgs{
			Policy: bucket.Arn.ApplyT(func(arn string) (string, error) {
				return fmt.Sprintf("%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v%v", "{\n", "  \"Version\": \"2012-10-17\",\n", "  \"Statement\": [\n", "    {\n", "      \"Effect\": \"Allow\",\n", "      \"Principal\": \"*\",\n", "      \"Action\": \"sqs:SendMessage\",\n", "	  \"Resource\": \"arn:aws:sqs:*:*:s3-event-notification-queue\",\n", "      \"Condition\": {\n", "        \"ArnEquals\": { \"aws:SourceArn\": \"", arn, "\" }\n", "      }\n", "    }\n", "  ]\n", "}\n"), nil
			}).(pulumi.StringOutput),
		})
		if err != nil {
			return err
		}
		_, err = s3.NewBucketNotification(ctx, "bucketNotification", &s3.BucketNotificationArgs{
			Bucket: bucket.ID(),
			Queues: s3.BucketNotificationQueueArray{
				&s3.BucketNotificationQueueArgs{
					Id:       pulumi.String("image-upload-event"),
					QueueArn: queue.Arn,
					Events: pulumi.StringArray{
						pulumi.String("s3:ObjectCreated:*"),
					},
					FilterPrefix: pulumi.String("images/"),
				},
				&s3.BucketNotificationQueueArgs{
					Id:       pulumi.String("video-upload-event"),
					QueueArn: queue.Arn,
					Events: pulumi.StringArray{
						pulumi.String("s3:ObjectCreated:*"),
					},
					FilterPrefix: pulumi.String("videos/"),
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var bucket = new BucketV2("bucket");

        var queue = new Queue("queue", QueueArgs.builder()        
            .policy(bucket.getArn().apply(arn -> """
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": "*",
      "Action": "sqs:SendMessage",
	  "Resource": "arn:aws:sqs:*:*:s3-event-notification-queue",
      "Condition": {
        "ArnEquals": { "aws:SourceArn": "%s" }
      }
    }
  ]
}
", arn)))
            .build());

        var bucketNotification = new BucketNotification("bucketNotification", BucketNotificationArgs.builder()        
            .bucket(bucket.getId())
            .queues(            
                BucketNotificationQueue.builder()
                    .id("image-upload-event")
                    .queueArn(queue.getArn())
                    .events("s3:ObjectCreated:*")
                    .filterPrefix("images/")
                    .build(),
                BucketNotificationQueue.builder()
                    .id("video-upload-event")
                    .queueArn(queue.getArn())
                    .events("s3:ObjectCreated:*")
                    .filterPrefix("videos/")
                    .build())
            .build());

        }
}
import pulumi
import pulumi_aws as aws

bucket = aws.s3.BucketV2("bucket")
queue = aws.sqs.Queue("queue", policy=bucket.arn.apply(lambda arn: f"""{{
  "Version": "2012-10-17",
  "Statement": [
    {{
      "Effect": "Allow",
      "Principal": "*",
      "Action": "sqs:SendMessage",
	  "Resource": "arn:aws:sqs:*:*:s3-event-notification-queue",
      "Condition": {{
        "ArnEquals": {{ "aws:SourceArn": "{arn}" }}
      }}
    }}
  ]
}}
"""))
bucket_notification = aws.s3.BucketNotification("bucketNotification",
    bucket=bucket.id,
    queues=[
        aws.s3.BucketNotificationQueueArgs(
            id="image-upload-event",
            queue_arn=queue.arn,
            events=["s3:ObjectCreated:*"],
            filter_prefix="images/",
        ),
        aws.s3.BucketNotificationQueueArgs(
            id="video-upload-event",
            queue_arn=queue.arn,
            events=["s3:ObjectCreated:*"],
            filter_prefix="videos/",
        ),
    ])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const bucket = new aws.s3.BucketV2("bucket", {});
const queue = new aws.sqs.Queue("queue", {policy: pulumi.interpolate`{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": "*",
      "Action": "sqs:SendMessage",
	  "Resource": "arn:aws:sqs:*:*:s3-event-notification-queue",
      "Condition": {
        "ArnEquals": { "aws:SourceArn": "${bucket.arn}" }
      }
    }
  ]
}
`});
const bucketNotification = new aws.s3.BucketNotification("bucketNotification", {
    bucket: bucket.id,
    queues: [
        {
            id: "image-upload-event",
            queueArn: queue.arn,
            events: ["s3:ObjectCreated:*"],
            filterPrefix: "images/",
        },
        {
            id: "video-upload-event",
            queueArn: queue.arn,
            events: ["s3:ObjectCreated:*"],
            filterPrefix: "videos/",
        },
    ],
});
resources:
  queue:
    type: aws:sqs:Queue
    properties:
      policy: |
        {
          "Version": "2012-10-17",
          "Statement": [
            {
              "Effect": "Allow",
              "Principal": "*",
              "Action": "sqs:SendMessage",
        	  "Resource": "arn:aws:sqs:*:*:s3-event-notification-queue",
              "Condition": {
                "ArnEquals": { "aws:SourceArn": "${bucket.arn}" }
              }
            }
          ]
        }        
  bucket:
    type: aws:s3:BucketV2
  bucketNotification:
    type: aws:s3:BucketNotification
    properties:
      bucket: ${bucket.id}
      queues:
        - id: image-upload-event
          queueArn: ${queue.arn}
          events:
            - s3:ObjectCreated:*
          filterPrefix: images/
        - id: video-upload-event
          queueArn: ${queue.arn}
          events:
            - s3:ObjectCreated:*
          filterPrefix: videos/

Create a BucketNotification Resource

new BucketNotification(name: string, args: BucketNotificationArgs, opts?: CustomResourceOptions);
@overload
def BucketNotification(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       bucket: Optional[str] = None,
                       eventbridge: Optional[bool] = None,
                       lambda_functions: Optional[Sequence[BucketNotificationLambdaFunctionArgs]] = None,
                       queues: Optional[Sequence[BucketNotificationQueueArgs]] = None,
                       topics: Optional[Sequence[BucketNotificationTopicArgs]] = None)
@overload
def BucketNotification(resource_name: str,
                       args: BucketNotificationArgs,
                       opts: Optional[ResourceOptions] = None)
func NewBucketNotification(ctx *Context, name string, args BucketNotificationArgs, opts ...ResourceOption) (*BucketNotification, error)
public BucketNotification(string name, BucketNotificationArgs args, CustomResourceOptions? opts = null)
public BucketNotification(String name, BucketNotificationArgs args)
public BucketNotification(String name, BucketNotificationArgs args, CustomResourceOptions options)
type: aws:s3:BucketNotification
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args BucketNotificationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args BucketNotificationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args BucketNotificationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args BucketNotificationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args BucketNotificationArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

BucketNotification Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The BucketNotification resource accepts the following input properties:

Bucket string

Name of the bucket for notification configuration.

Eventbridge bool

Whether to enable Amazon EventBridge notifications.

LambdaFunctions List<BucketNotificationLambdaFunctionArgs>

Used to configure notifications to a Lambda Function. See below.

Queues List<BucketNotificationQueueArgs>

Notification configuration to SQS Queue. See below.

Topics List<BucketNotificationTopicArgs>

Notification configuration to SNS Topic. See below.

Bucket string

Name of the bucket for notification configuration.

Eventbridge bool

Whether to enable Amazon EventBridge notifications.

LambdaFunctions []BucketNotificationLambdaFunctionArgs

Used to configure notifications to a Lambda Function. See below.

Queues []BucketNotificationQueueArgs

Notification configuration to SQS Queue. See below.

Topics []BucketNotificationTopicArgs

Notification configuration to SNS Topic. See below.

bucket String

Name of the bucket for notification configuration.

eventbridge Boolean

Whether to enable Amazon EventBridge notifications.

lambdaFunctions ListNotificationLambdaFunctionArgs>

Used to configure notifications to a Lambda Function. See below.

queues ListNotificationQueueArgs>

Notification configuration to SQS Queue. See below.

topics ListNotificationTopicArgs>

Notification configuration to SNS Topic. See below.

bucket string

Name of the bucket for notification configuration.

eventbridge boolean

Whether to enable Amazon EventBridge notifications.

lambdaFunctions BucketNotificationLambdaFunctionArgs[]

Used to configure notifications to a Lambda Function. See below.

queues BucketNotificationQueueArgs[]

Notification configuration to SQS Queue. See below.

topics BucketNotificationTopicArgs[]

Notification configuration to SNS Topic. See below.

bucket str

Name of the bucket for notification configuration.

eventbridge bool

Whether to enable Amazon EventBridge notifications.

lambda_functions Sequence[BucketNotificationLambdaFunctionArgs]

Used to configure notifications to a Lambda Function. See below.

queues Sequence[BucketNotificationQueueArgs]

Notification configuration to SQS Queue. See below.

topics Sequence[BucketNotificationTopicArgs]

Notification configuration to SNS Topic. See below.

bucket String

Name of the bucket for notification configuration.

eventbridge Boolean

Whether to enable Amazon EventBridge notifications.

lambdaFunctions List

Used to configure notifications to a Lambda Function. See below.

queues List

Notification configuration to SQS Queue. See below.

topics List

Notification configuration to SNS Topic. See below.

Outputs

All input properties are implicitly available as output properties. Additionally, the BucketNotification resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing BucketNotification Resource

Get an existing BucketNotification resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: BucketNotificationState, opts?: CustomResourceOptions): BucketNotification
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        bucket: Optional[str] = None,
        eventbridge: Optional[bool] = None,
        lambda_functions: Optional[Sequence[BucketNotificationLambdaFunctionArgs]] = None,
        queues: Optional[Sequence[BucketNotificationQueueArgs]] = None,
        topics: Optional[Sequence[BucketNotificationTopicArgs]] = None) -> BucketNotification
func GetBucketNotification(ctx *Context, name string, id IDInput, state *BucketNotificationState, opts ...ResourceOption) (*BucketNotification, error)
public static BucketNotification Get(string name, Input<string> id, BucketNotificationState? state, CustomResourceOptions? opts = null)
public static BucketNotification get(String name, Output<String> id, BucketNotificationState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Bucket string

Name of the bucket for notification configuration.

Eventbridge bool

Whether to enable Amazon EventBridge notifications.

LambdaFunctions List<BucketNotificationLambdaFunctionArgs>

Used to configure notifications to a Lambda Function. See below.

Queues List<BucketNotificationQueueArgs>

Notification configuration to SQS Queue. See below.

Topics List<BucketNotificationTopicArgs>

Notification configuration to SNS Topic. See below.

Bucket string

Name of the bucket for notification configuration.

Eventbridge bool

Whether to enable Amazon EventBridge notifications.

LambdaFunctions []BucketNotificationLambdaFunctionArgs

Used to configure notifications to a Lambda Function. See below.

Queues []BucketNotificationQueueArgs

Notification configuration to SQS Queue. See below.

Topics []BucketNotificationTopicArgs

Notification configuration to SNS Topic. See below.

bucket String

Name of the bucket for notification configuration.

eventbridge Boolean

Whether to enable Amazon EventBridge notifications.

lambdaFunctions ListNotificationLambdaFunctionArgs>

Used to configure notifications to a Lambda Function. See below.

queues ListNotificationQueueArgs>

Notification configuration to SQS Queue. See below.

topics ListNotificationTopicArgs>

Notification configuration to SNS Topic. See below.

bucket string

Name of the bucket for notification configuration.

eventbridge boolean

Whether to enable Amazon EventBridge notifications.

lambdaFunctions BucketNotificationLambdaFunctionArgs[]

Used to configure notifications to a Lambda Function. See below.

queues BucketNotificationQueueArgs[]

Notification configuration to SQS Queue. See below.

topics BucketNotificationTopicArgs[]

Notification configuration to SNS Topic. See below.

bucket str

Name of the bucket for notification configuration.

eventbridge bool

Whether to enable Amazon EventBridge notifications.

lambda_functions Sequence[BucketNotificationLambdaFunctionArgs]

Used to configure notifications to a Lambda Function. See below.

queues Sequence[BucketNotificationQueueArgs]

Notification configuration to SQS Queue. See below.

topics Sequence[BucketNotificationTopicArgs]

Notification configuration to SNS Topic. See below.

bucket String

Name of the bucket for notification configuration.

eventbridge Boolean

Whether to enable Amazon EventBridge notifications.

lambdaFunctions List

Used to configure notifications to a Lambda Function. See below.

queues List

Notification configuration to SQS Queue. See below.

topics List

Notification configuration to SNS Topic. See below.

Supporting Types

BucketNotificationLambdaFunction

Events List<string>

Event for which to send notifications.

FilterPrefix string

Object key name prefix.

FilterSuffix string

Object key name suffix.

Id string

Unique identifier for each of the notification configurations.

LambdaFunctionArn string

Lambda function ARN.

Events []string

Event for which to send notifications.

FilterPrefix string

Object key name prefix.

FilterSuffix string

Object key name suffix.

Id string

Unique identifier for each of the notification configurations.

LambdaFunctionArn string

Lambda function ARN.

events List

Event for which to send notifications.

filterPrefix String

Object key name prefix.

filterSuffix String

Object key name suffix.

id String

Unique identifier for each of the notification configurations.

lambdaFunctionArn String

Lambda function ARN.

events string[]

Event for which to send notifications.

filterPrefix string

Object key name prefix.

filterSuffix string

Object key name suffix.

id string

Unique identifier for each of the notification configurations.

lambdaFunctionArn string

Lambda function ARN.

events Sequence[str]

Event for which to send notifications.

filter_prefix str

Object key name prefix.

filter_suffix str

Object key name suffix.

id str

Unique identifier for each of the notification configurations.

lambda_function_arn str

Lambda function ARN.

events List

Event for which to send notifications.

filterPrefix String

Object key name prefix.

filterSuffix String

Object key name suffix.

id String

Unique identifier for each of the notification configurations.

lambdaFunctionArn String

Lambda function ARN.

BucketNotificationQueue

Events List<string>

Event for which to send notifications.

QueueArn string

SQS queue ARN.

FilterPrefix string

Object key name prefix.

FilterSuffix string

Object key name suffix.

Id string

Unique identifier for each of the notification configurations.

Events []string

Event for which to send notifications.

QueueArn string

SQS queue ARN.

FilterPrefix string

Object key name prefix.

FilterSuffix string

Object key name suffix.

Id string

Unique identifier for each of the notification configurations.

events List

Event for which to send notifications.

queueArn String

SQS queue ARN.

filterPrefix String

Object key name prefix.

filterSuffix String

Object key name suffix.

id String

Unique identifier for each of the notification configurations.

events string[]

Event for which to send notifications.

queueArn string

SQS queue ARN.

filterPrefix string

Object key name prefix.

filterSuffix string

Object key name suffix.

id string

Unique identifier for each of the notification configurations.

events Sequence[str]

Event for which to send notifications.

queue_arn str

SQS queue ARN.

filter_prefix str

Object key name prefix.

filter_suffix str

Object key name suffix.

id str

Unique identifier for each of the notification configurations.

events List

Event for which to send notifications.

queueArn String

SQS queue ARN.

filterPrefix String

Object key name prefix.

filterSuffix String

Object key name suffix.

id String

Unique identifier for each of the notification configurations.

BucketNotificationTopic

Events List<string>

Event for which to send notifications.

TopicArn string

SNS topic ARN.

FilterPrefix string

Object key name prefix.

FilterSuffix string

Object key name suffix.

Id string

Unique identifier for each of the notification configurations.

Events []string

Event for which to send notifications.

TopicArn string

SNS topic ARN.

FilterPrefix string

Object key name prefix.

FilterSuffix string

Object key name suffix.

Id string

Unique identifier for each of the notification configurations.

events List

Event for which to send notifications.

topicArn String

SNS topic ARN.

filterPrefix String

Object key name prefix.

filterSuffix String

Object key name suffix.

id String

Unique identifier for each of the notification configurations.

events string[]

Event for which to send notifications.

topicArn string

SNS topic ARN.

filterPrefix string

Object key name prefix.

filterSuffix string

Object key name suffix.

id string

Unique identifier for each of the notification configurations.

events Sequence[str]

Event for which to send notifications.

topic_arn str

SNS topic ARN.

filter_prefix str

Object key name prefix.

filter_suffix str

Object key name suffix.

id str

Unique identifier for each of the notification configurations.

events List

Event for which to send notifications.

topicArn String

SNS topic ARN.

filterPrefix String

Object key name prefix.

filterSuffix String

Object key name suffix.

id String

Unique identifier for each of the notification configurations.

Import

S3 bucket notification can be imported using the bucket, e.g.,

 $ pulumi import aws:s3/bucketNotification:BucketNotification bucket_notification bucket-name

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.