Use GetVaultNotifications with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use GetVaultNotifications with an AWS SDK or CLI

The following code examples show how to use GetVaultNotifications.

CLI
AWS CLI

The following command gets a description of the notification configuration for a vault named my-vault:

aws glacier get-vault-notifications --account-id - --vault-name my-vault

Output:

{ "vaultNotificationConfig": { "Events": [ "InventoryRetrievalCompleted", "ArchiveRetrievalCompleted" ], "SNSTopic": "arn:aws:sns:us-west-2:0123456789012:my-vault" } }

If no notifications have been configured for the vault, an error is returned. Amazon Glacier requires an account ID argument when performing operations, but you can use a hyphen to specify the in-use account.

Python
SDK for Python (Boto3)
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

class GlacierWrapper: """Encapsulates Amazon S3 Glacier API operations.""" def __init__(self, glacier_resource): """ :param glacier_resource: A Boto3 Amazon S3 Glacier resource. """ self.glacier_resource = glacier_resource @staticmethod def get_notification(vault): """ Gets the currently notification configuration for a vault. :param vault: The vault to query. :return: The notification configuration for the specified vault. """ try: notification = vault.Notification() logger.info( "Vault %s notifies %s on %s events.", vault.name, notification.sns_topic, notification.events, ) except ClientError: logger.exception("Couldn't get notification data for %s.", vault.name) raise else: return notification