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

AWS Control Towerでランディングゾーン設定中の謎エラーを解消した

Posted at

マルチアカウント環境の構築中にAWS Control Towerを有効化しようとしたら、2つの謎エラーに阻まれたので解消法を共有します。

  • 「アカウント数の制限到達」エラー(上限に達していないはずなのに)
  • CloudFormationのデプロイ失敗(KMSキーポリシー関連)

アカウント数制限エラー

Control Towerを有効化するときにログアーカイブアカウントと監査アカウントがつくられるのですが、ログアーカイブアカウントだけつくられず、「アカウント数が制限に到達した」というエラーが出ました。

AWS Control Tower failed to set up your landing zone completely: AWS Control Tower cannot create an account because you have reached the limit on the number of accounts in your organization.

スクリーンショット 2025-08-21 16.51.09.png

Service Quotasを確認するとDefault maximum number of accountsが10になっていて、実際のアカウント数は明らかにそれ以下でした(管理アカウントを含めても3つ)。

スクリーンショット 2025-08-22 15.27.02.png

結局原因はわからなかったのですが(もやもやする)、Service Quotaを15に引き上げることで解決しました。Control Towerが内部的に予約するアカウント枠みたいなのがあったりするのでしょうか...?

スクリーンショット 2025-09-02 8.51.08.png

CloudFormationのデプロイ失敗(KMSキーポリシー関連)

アカウント数制限のエラーが解消できた!と思ったら、今度はCloudFormationのデプロイエラーが起こりました。

AWS Control Tower failed to set up your landing zone completely: AWS Control Tower failed to deploy stack(s): arn:aws:cloudformation:ap-northeast-1:XXXXXXXX:stack/AWSControlTowerBP-BASELINE-CLOUDTRAIL-MASTER/4787d990-8144-11f0-ad99-0625194a54fd. To continue, review the failed stack(s) and try again.

スクリーンショット 2025-09-02 8.56.29.png

CloudFormationのコンソール画面を開いたら以下のようになっていました。

スクリーンショット 2025-09-02 9.00.28.png

今回、CloudTrailとConfigの暗号化にKMSを使用する設定にしていたのですが、どうやらこれらのサービスがKMSキーにアクセスする権限が不足していました。

必要だった権限

  • Config: kms:Decrypt, kms:GenerateDataKey
  • CloudTrail: kms:GenerateDataKey*, kms:Decrypt

そのため、KMSポリシーに以下を追加しました。

{
  "Sid": "AllowConfigToUseKms",
  "Effect": "Allow",
  "Principal": { "Service": "config.amazonaws.com" },
  "Action": ["kms:Decrypt","kms:GenerateDataKey"],
  "Resource": "arn:aws:kms:ap-northeast-1:xxxxxxxxxxxx:key/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
},
{
  "Sid": "AllowCloudTrailToUseKms",
  "Effect": "Allow",
  "Principal": { "Service": "cloudtrail.amazonaws.com" },
  "Action": ["kms:GenerateDataKey*","kms:Decrypt"],
  "Resource": "arn:aws:kms:ap-northeast-1:xxxxxxxxxxxx:key/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "Condition": {
    "StringEquals": {
      "aws:SourceArn": "arn:aws:cloudtrail:ap-northeast-1:xxxxxxxxxxxx:trail/aws-controltower-BaselineCloudTrail"
    },
    "StringLike": {
      "kms:EncryptionContext:aws:cloudtrail:arn": "arn:aws:cloudtrail:*:xxxxxxxxxxxx:trail/*"
    }
  }
}

その後、失敗したCloudFormationのスタックAWSControlTowerBP-BASELINE-CLOUDTRAIL-MASTERを削除して、Control Towerのセットアップを再試行したらエラーがすべて解消しました!
 
スクリーンショット 2025-08-25 15.01.27.png

まとめ

アカウント数制限エラーの原因がわからず未だにもやもやしているので、ご存知の方がいらっしゃったら教えてください..!

参考

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