2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Security Hubの新規コントロールのSSM.7に対処するため、SSMドキュメントのパブリック共有をブロックを一括で全リージョン適用してみた

Last updated at Posted at 2025-07-18

こんにちは、CSCの平木です!

Security Hubを運用している界隈では少しざわつきましたが、
先日、Security Hubの新規コントロールにSSM.7が追加されました。

こちらはCriticalで検知されるため、
一括で適用できるコマンドを調べてみました。

早速コマンド

下記コマンドをCloudShellなど任意のシェル環境から実行いただければ全リージョンで一括で適用できます。

for region in $(aws ec2 describe-regions --query "Regions[].RegionName" --output text)
do
  if aws ssm update-service-setting \
    --setting-id /ssm/documents/console/public-sharing-permission \
    --setting-value Disable \
    --region ${region} 2>/dev/null; then
    echo "✅ 処理完了: ${region}"
  else
    echo "⚠️ スキップ: ${region}"
  fi
done

おわりに

今回はSSM.7に対処するための全リージョンにおける一括設定を調べてみました。

手動の設定方法はこちらが参考になります。

CloudFormationでの設定方法は見当たらなかったのでSatckSetsを活用したマルチアカウントでの設定は執筆時点では難しそうかと思いました。(もしあったらすみません)
Terraformではaws_ssm_service_settingのリソースタイプがあるのでTerraform管理しているユーザーはこちらで実行してみるとよいです。

この記事がどなたかの役に立つと嬉しいです。

2
0
0

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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?