GetBucketNotificationConfigurationCommand

This operation is not supported for directory buckets.

Returns the notification configuration of a bucket.

If notifications are not enabled on the bucket, the action returns an empty NotificationConfiguration element.

By default, you must be the bucket owner to read the notification configuration of a bucket. However, the bucket owner can use a bucket policy to grant permission to other users to read this configuration with the s3:GetBucketNotification permission.

When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.

When you use this API operation with an Object Lambda access point, provide the alias of the Object Lambda access point in place of the bucket name. If the Object Lambda access point alias in a request is not valid, the error code InvalidAccessPointAliasError is returned. For more information about InvalidAccessPointAliasError, see List of Error Codes .

For more information about setting and reading the notification configuration on a bucket, see Setting Up Notification of Bucket Events . For more information about bucket policies, see Using Bucket Policies .

The following action is related to GetBucketNotification:

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { S3Client, GetBucketNotificationConfigurationCommand } from "@aws-sdk/client-s3"; // ES Modules import
// const { S3Client, GetBucketNotificationConfigurationCommand } = require("@aws-sdk/client-s3"); // CommonJS import
const client = new S3Client(config);
const input = { // GetBucketNotificationConfigurationRequest
  Bucket: "STRING_VALUE", // required
  ExpectedBucketOwner: "STRING_VALUE",
};
const command = new GetBucketNotificationConfigurationCommand(input);
const response = await client.send(command);
// { // NotificationConfiguration
//   TopicConfigurations: [ // TopicConfigurationList
//     { // TopicConfiguration
//       Id: "STRING_VALUE",
//       TopicArn: "STRING_VALUE", // required
//       Events: [ // EventList // required
//         "s3:ReducedRedundancyLostObject" || "s3:ObjectCreated:*" || "s3:ObjectCreated:Put" || "s3:ObjectCreated:Post" || "s3:ObjectCreated:Copy" || "s3:ObjectCreated:CompleteMultipartUpload" || "s3:ObjectRemoved:*" || "s3:ObjectRemoved:Delete" || "s3:ObjectRemoved:DeleteMarkerCreated" || "s3:ObjectRestore:*" || "s3:ObjectRestore:Post" || "s3:ObjectRestore:Completed" || "s3:Replication:*" || "s3:Replication:OperationFailedReplication" || "s3:Replication:OperationNotTracked" || "s3:Replication:OperationMissedThreshold" || "s3:Replication:OperationReplicatedAfterThreshold" || "s3:ObjectRestore:Delete" || "s3:LifecycleTransition" || "s3:IntelligentTiering" || "s3:ObjectAcl:Put" || "s3:LifecycleExpiration:*" || "s3:LifecycleExpiration:Delete" || "s3:LifecycleExpiration:DeleteMarkerCreated" || "s3:ObjectTagging:*" || "s3:ObjectTagging:Put" || "s3:ObjectTagging:Delete",
//       ],
//       Filter: { // NotificationConfigurationFilter
//         Key: { // S3KeyFilter
//           FilterRules: [ // FilterRuleList
//             { // FilterRule
//               Name: "prefix" || "suffix",
//               Value: "STRING_VALUE",
//             },
//           ],
//         },
//       },
//     },
//   ],
//   QueueConfigurations: [ // QueueConfigurationList
//     { // QueueConfiguration
//       Id: "STRING_VALUE",
//       QueueArn: "STRING_VALUE", // required
//       Events: [ // required
//         "s3:ReducedRedundancyLostObject" || "s3:ObjectCreated:*" || "s3:ObjectCreated:Put" || "s3:ObjectCreated:Post" || "s3:ObjectCreated:Copy" || "s3:ObjectCreated:CompleteMultipartUpload" || "s3:ObjectRemoved:*" || "s3:ObjectRemoved:Delete" || "s3:ObjectRemoved:DeleteMarkerCreated" || "s3:ObjectRestore:*" || "s3:ObjectRestore:Post" || "s3:ObjectRestore:Completed" || "s3:Replication:*" || "s3:Replication:OperationFailedReplication" || "s3:Replication:OperationNotTracked" || "s3:Replication:OperationMissedThreshold" || "s3:Replication:OperationReplicatedAfterThreshold" || "s3:ObjectRestore:Delete" || "s3:LifecycleTransition" || "s3:IntelligentTiering" || "s3:ObjectAcl:Put" || "s3:LifecycleExpiration:*" || "s3:LifecycleExpiration:Delete" || "s3:LifecycleExpiration:DeleteMarkerCreated" || "s3:ObjectTagging:*" || "s3:ObjectTagging:Put" || "s3:ObjectTagging:Delete",
//       ],
//       Filter: {
//         Key: {
//           FilterRules: [
//             {
//               Name: "prefix" || "suffix",
//               Value: "STRING_VALUE",
//             },
//           ],
//         },
//       },
//     },
//   ],
//   LambdaFunctionConfigurations: [ // LambdaFunctionConfigurationList
//     { // LambdaFunctionConfiguration
//       Id: "STRING_VALUE",
//       LambdaFunctionArn: "STRING_VALUE", // required
//       Events: [ // required
//         "s3:ReducedRedundancyLostObject" || "s3:ObjectCreated:*" || "s3:ObjectCreated:Put" || "s3:ObjectCreated:Post" || "s3:ObjectCreated:Copy" || "s3:ObjectCreated:CompleteMultipartUpload" || "s3:ObjectRemoved:*" || "s3:ObjectRemoved:Delete" || "s3:ObjectRemoved:DeleteMarkerCreated" || "s3:ObjectRestore:*" || "s3:ObjectRestore:Post" || "s3:ObjectRestore:Completed" || "s3:Replication:*" || "s3:Replication:OperationFailedReplication" || "s3:Replication:OperationNotTracked" || "s3:Replication:OperationMissedThreshold" || "s3:Replication:OperationReplicatedAfterThreshold" || "s3:ObjectRestore:Delete" || "s3:LifecycleTransition" || "s3:IntelligentTiering" || "s3:ObjectAcl:Put" || "s3:LifecycleExpiration:*" || "s3:LifecycleExpiration:Delete" || "s3:LifecycleExpiration:DeleteMarkerCreated" || "s3:ObjectTagging:*" || "s3:ObjectTagging:Put" || "s3:ObjectTagging:Delete",
//       ],
//       Filter: {
//         Key: {
//           FilterRules: [
//             {
//               Name: "prefix" || "suffix",
//               Value: "STRING_VALUE",
//             },
//           ],
//         },
//       },
//     },
//   ],
//   EventBridgeConfiguration: {},
// };

GetBucketNotificationConfigurationCommand Input

Parameter
Type
Description
Bucket
Required
string | undefined

The name of the bucket for which to get the notification configuration.

When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.

When you use this API operation with an Object Lambda access point, provide the alias of the Object Lambda access point in place of the bucket name. If the Object Lambda access point alias in a request is not valid, the error code InvalidAccessPointAliasError is returned. For more information about InvalidAccessPointAliasError, see List of Error Codes .

Note: To supply the Multi-region Access Point (MRAP) to Bucket, you need to install the "aws-sdk/signature-v4-crt" package to your project dependencies. For more information, please go to https://github.com/aws/aws-sdk-js-v3#known-issues

ExpectedBucketOwner
string | undefined

The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code 403 Forbidden (access denied).

GetBucketNotificationConfigurationCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
EventBridgeConfiguration
EventBridgeConfiguration | undefined

Enables delivery of events to Amazon EventBridge.

LambdaFunctionConfigurations
LambdaFunctionConfiguration[] | undefined

Describes the Lambda functions to invoke and the events for which to invoke them.

QueueConfigurations
QueueConfiguration[] | undefined

The Amazon Simple Queue Service queues to publish messages to and the events for which to publish messages.

TopicConfigurations
TopicConfiguration[] | undefined

The topic to which notifications are sent and the events for which notifications are generated.

Throws

Name
Fault
Details
S3ServiceException
Base exception class for all service exceptions from S3 service.