【AWS】IAM ~ Service-Linked Roles ~

■ はじめに

Amazon MSK の 環境構築で、エラーの原因が、
AWS IAM の、Service-Linked Roles(サービスリンクロール)を
作っていなかったのだが、そもそも Service-Linked Roles の
存在を知らなかったので調べてみる
(全然まだ理解していないので、徐々に書き溜めていく)

【1】Service-Linked Roles(サービスリンクロール)

* AWSのサービス(例えば、RDS, MSK など)に紐づけられたロール
 => 1AWSサービスに対して、1 Service-Linked Role

【2】公式ドキュメント

https://docs.aws.amazon.com/ja_jp/IAM/latest/UserGuide/using-service-linked-roles.html

【3】AWS CLI

例1:AWSServiceRoleForECRPullThroughCache

https://docs.aws.amazon.com/ja_jp/AmazonECR/latest/userguide/slr-pullthroughcache.html

# AWSServiceRoleForECRPullThroughCache が存在するか
aws iam get-role --role-name AWSServiceRoleForECRPullThroughCache

# Service-Linked Role「pullthroughcache.ecr.amazonaws.com」作成
aws iam create-service-linked-role --region us-west-2 --aws-service-name pullthroughcache.ecr.amazonaws.com

# 再度、AWSServiceRoleForECRPullThroughCache が存在するかを確認
aws iam get-role --role-name AWSServiceRoleForECRPullThroughCache

参考文献

https://dev.classmethod.jp/articles/aws-iam-service-linked-role/
https://zenn.dev/devcamp/articles/672342f72ea71e
https://dev.classmethod.jp/articles/iam-service-linked-roles-cloudformtion/
https://dev.classmethod.jp/articles/rds-aws-service-role-e/

関連記事

IAM ~ 入門編 ~
https://dk521123.hatenablog.com/entry/2017/02/26/231046
IAM ~ 基本編 ~
https://dk521123.hatenablog.com/entry/2022/07/03/000000
IAM ~ クロスアカウント ~
https://dk521123.hatenablog.com/entry/2022/05/23/000000
Amazon MSK (Managed Streaming for apache Kafka)
https://dk521123.hatenablog.com/entry/2023/04/21/000000