2022-01-20 Cloud►AWS SNS - 配信ステータスのログ全リージョン・全トピック有効化 Security Hub - SNS.2 AWS CLI SHELL123456789101112131415161718192021222324252627282930313233343536373839404142#!/usr/bin/env bashAccountID=************SuccessSampleRate=100IAMRoleForSuccessful=SNSSuccessFeedbackIAMRoleForFailed=SNSFailureFeedbackif [ "$AWS_PROFILE" = "" ]; then echo "No AWS_PROFILE set" exit 1fifor region in $(aws ec2 describe-regions --region ap-northeast-1 | jq -r .Regions[].RegionName); do for arn in $(aws sns --region ${region} list-topics | jq -r .Topics[].TopicArn); do echo "* ${region} - ${arn}" aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name ApplicationSuccessFeedbackSampleRate --attribute-value ${SuccessSampleRate} aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name FirehoseSuccessFeedbackSampleRate --attribute-value ${SuccessSampleRate} aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name HTTPSuccessFeedbackSampleRate --attribute-value ${SuccessSampleRate} aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name LambdaSuccessFeedbackSampleRate --attribute-value ${SuccessSampleRate} aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name SQSSuccessFeedbackSampleRate --attribute-value ${SuccessSampleRate} aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name ApplicationFailureFeedbackRoleArn --attribute-value "arn:aws:iam::${AccountID}:role/${IAMRoleForFailed}" aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name FirehoseFailureFeedbackRoleArn --attribute-value "arn:aws:iam::${AccountID}:role/${IAMRoleForFailed}" aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name HTTPFailureFeedbackRoleArn --attribute-value "arn:aws:iam::${AccountID}:role/${IAMRoleForFailed}" aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name LambdaFailureFeedbackRoleArn --attribute-value "arn:aws:iam::${AccountID}:role/${IAMRoleForFailed}" aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name SQSFailureFeedbackRoleArn --attribute-value "arn:aws:iam::${AccountID}:role/${IAMRoleForFailed}" aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name ApplicationSuccessFeedbackRoleArn --attribute-value "arn:aws:iam::${AccountID}:role/${IAMRoleForSuccessful}" aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name FirehoseSuccessFeedbackRoleArn --attribute-value "arn:aws:iam::${AccountID}:role/${IAMRoleForSuccessful}" aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name HTTPSuccessFeedbackRoleArn --attribute-value "arn:aws:iam::${AccountID}:role/${IAMRoleForSuccessful}" aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name LambdaSuccessFeedbackRoleArn --attribute-value "arn:aws:iam::${AccountID}:role/${IAMRoleForSuccessful}" aws sns set-topic-attributes --region ${region} --topic-arn ${arn} --attribute-name SQSSuccessFeedbackRoleArn --attribute-value "arn:aws:iam::${AccountID}:role/${IAMRoleForSuccessful}" donedone 次の記事 AWS - CloudFront / Global Accelerator 前の記事 AWS - S3 ストレージクラス