Created
July 6, 2017 09:55
-
-
Save pacohope/e5b1919cf23cf1966f565315c39214e7 to your computer and use it in GitHub Desktop.
Set SNS notifications for all Glacier vaults
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Set notifications for all my vaults on the same SNS topic. | |
# Set Variables up top. The rest flows through. | |
# See Also: http://docs.aws.amazon.com/amazonglacier/latest/dev/configuring-notifications-console.html | |
# Set these four | |
REGION="eu-west-1" | |
PROFILE="MYPROFILE" | |
ACCT="111111111111" | |
TOPIC="glacier-sns" | |
# Ideally nothing else changes. | |
SNS="arn:aws:sns:${REGION}:${ACCT}:${TOPIC}" | |
SUB="SNSTopic=${SNS},Events=ArchiveRetrievalCompleted,InventoryRetrievalCompleted" | |
VAULTLIST=$(aws glacier --profile ${PROFILE} --region ${REGION} \ | |
list-vaults --account-id ${ACCT} | jq -r '.VaultList[].VaultName') | |
for VAULT in ${VAULTLIST} | |
do | |
aws glacier --profile ${PROFILE} --region ${REGION} \ | |
set-vault-notifications \ | |
--account-id ${ACCT} --vault-name $VAULT \ | |
--vault-notification-config "${SUB}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment