0
0

More than 1 year has passed since last update.

AWSCloudFormation is not authorized to perform: eks:TagResource エラーの回避

Posted at

概要

  • AWS CloudFormationでEKS Clusterリソースを作成する際、EKSへのタグ付けに失敗した。
  • cloudformationのcreate-stack実行時に付与したRoleに、eks:TagResourceのポリシーが不足していたことが原因だった。

発生事象

  • CFnからEKS Clusterを作成するため、以下のコマンドを実行。
aws cloudformation create-stack --stack-name ${STACK_NAME} \
--role-arn arn:aws:iam::${ACCOUNT_ID}:role/<RoleName>\
--template-body file://01_template/${TEMPLATE_FILE} \
--parameters file://02_parameter/${PARAMETER_FILE}
  • CFnの以下のエラーが発生していた。

Resource handler returned message: "User: arn:aws:sts::xxxxx:assumed-role//AWSCloudFormation is not authorized to perform: eks:TagResource on resource: arn:aws:eks:ap-northeast-1:xxxxx:cluster/ (Service: Eks, Status Code: 403, Request ID: xxxxx)" (RequestToken: xxxxx, HandlerErrorCode: AccessDenied)

原因・対処

  • EKSに任意のタグをつけたかったので、CFnのTemplateファイルでTagsを使用していたが、EKS Clusterへのタグ付与には以下のポリシーが必要だった。

eks:TagResource

  • 上記ポリシーをcreate-stackオプションの--role-arn arn:aws:iam::${ACCOUNT_ID}:role/<RoleName>\で指定したRoleに追加して、再度実行したところ正常にEKS Cluster作成が完了した。
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