Utilizar GetBucketNotification con una CLI - Ejemplos de código de AWS SDK

Hay más ejemplos de AWS SDK disponibles en el repositorio de GitHub de ejemplos de AWS SDK de documentos.

Utilizar GetBucketNotification con una CLI

Los siguientes ejemplos de código muestran cómo utilizar GetBucketNotification.

CLI
AWS CLI

El siguiente comando recupera la configuración de notificaciones de un bucket denominado amzn-s3-demo-bucket:

aws s3api get-bucket-notification --bucket amzn-s3-demo-bucket

Salida:

{ "TopicConfiguration": { "Topic": "arn:aws:sns:us-west-2:123456789012:my-notification-topic", "Id": "YmQzMmEwM2EjZWVlI0NGItNzVtZjI1MC00ZjgyLWZDBiZWNl", "Event": "s3:ObjectCreated:*", "Events": [ "s3:ObjectCreated:*" ] } }
  • Para obtener información sobre la API, consulte GetBucketNotification en la Referencia de comandos de la AWS CLI.

PowerShell
Herramientas para PowerShell V4

Ejemplo 1: en este ejemplo se recupera la configuración de notificaciones del bucket en cuestión

Get-S3BucketNotification -BucketName amzn-s3-demo-bucket | select -ExpandProperty TopicConfigurations

Salida:

Id Topic -- ----- mimo arn:aws:sns:eu-west-1:123456789012:topic-1
  • Para obtener información sobre la API, consulte GetBucketNotification en la Referencia de cmdlets de Herramientas de AWS para PowerShell (V4).

Herramientas para PowerShell V5

Ejemplo 1: en este ejemplo se recupera la configuración de notificaciones del bucket en cuestión

Get-S3BucketNotification -BucketName amzn-s3-demo-bucket | select -ExpandProperty TopicConfigurations

Salida:

Id Topic -- ----- mimo arn:aws:sns:eu-west-1:123456789012:topic-1
  • Para obtener información sobre la API, consulte GetBucketNotification en la Referencia de cmdlets de Herramientas de AWS para PowerShell (V5).