7
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWSでRoleを削除しようとしたときに、 Cannot delete entity, must remove roles from instance profile first エラーになったときの対処

Posted at

あるRoleがInstance profileに関連しているとそのRoleは削除できません。しかし、instance profileは管理コンソールからは削除できないためコマンドラインから削除します。

Roleが使われているInstance profileの確認

aws iam list-instance-profiles-for-role --role-name {ロール名}

この出力から、InstanceProfileName をメモしておきます。

Instance profileからロールを削除する

aws iam remove-role-from-instance-profile \
  --instance-profile-name {インスタンスプロフィール名} \
  --role-name {ロール名}

Instance profileそのものを削除する

aws iam delete-instance-profile \
  --instance-profile-name {インスタンスプロフィール名}
7
3
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
7
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?