Anthony Kong
Anthony Kong

Reputation: 40624

Where to locate an aws_iam_instance_profile in aws console?

Because of a timeout issue, terraform failed to create an ec2 instance.

In order to recover from it I have manually removed the ec2 instance from aws console as well as the terraform state file.

However now it tried to recreate

  + aws_iam_instance_profile.server
      id:                                        <computed>
      arn:                                       <computed>
      create_date:                               <computed>
      name:                                      "server-profile"
      path:                                      "/"
      role:                                      "server-role"
      roles.#:                                   <computed>
      unique_id:                                 <computed>

Therefore I want to locate it in the aws console and remove it. However I don't know where to find it.

Where can I locate aws_iam_instance_profile.server?

Upvotes: 12

Views: 15849

Answers (3)

I have use this https://docs.aws.amazon.com/cli/latest/reference/iam/list-instance-profiles-for-role.html It happend like this INSTANCEPROFILES arn:aws:iam::542049112079:instance-profile/ec2SessionManager 2024-06-03T03:13:33+00:00 AIPAX4NFFCAH3Y4KVYYEE ec2SessionManager / ROLES arn:aws:iam::542049112079:role/aws_ec2_session_manager_role 2024-06-03T03:12:16+00:00 / AROAX4NFFCAH7UUOIBPIY aws_ec2_session_manager_role ASSUMEROLEPOLICYDOCUMENT 2012-10-17 STATEMENT sts:AssumeRole Allow PRINCIPAL ec2.amazonaws.com can see with aws cli

Upvotes: 0

Evandro Pomatti
Evandro Pomatti

Reputation: 15094

I couldn't find the instance profile in the IAM section in the console as described by Slushysnowman.

This solved my issue:

aws iam delete-instance-profile --instance-profile-name 'your-profile-name'

Upvotes: 9

Slushysnowman
Slushysnowman

Reputation: 498

Go to IAM in the console and then Roles.

You should be able to find the role there, once you delete that, the instance profile should also be gone.

Upvotes: 2

Related Questions