1
1

More than 3 years have passed since last update.

Amazon GuardDutyを各リージョンで一括 有効/停止/削除

Last updated at Posted at 2021-08-15

一括有効化

for REGION in `aws ec2 describe-regions | jq -r ".Regions[] | .RegionName"`; do
  aws --region ${REGION} guardduty create-detector --enable
done

一括停止

for REGION in `aws ec2 describe-regions | jq -r ".Regions[] | .RegionName"`; do
  DETECTOR=`aws --region ${REGION} guardduty list-detectors | jq -r ".DetectorIds | .[]"`
  aws --region ${REGION} guardduty update-detector --detector-id ${DETECTOR} --no-enable
done

一括削除

for REGION in `aws ec2 describe-regions | jq -r ".Regions[] | .RegionName"`; do
  DETECTOR=`aws --region ${REGION} guardduty list-detectors | jq -r ".DetectorIds | .[]"`
  aws --region ${REGION} guardduty delete-detector --detector-id ${DETECTOR}
done
1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1