Where to locate an aws_iam_instance_profile in aws console?
Asked Answered
T

3

10

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?

Tensor answered 8/7, 2019 at 9:2 Comment(0)
M
1

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.

Motion answered 8/7, 2019 at 9:27 Comment(4)
It does not exist in Roles. It is aws_iam_instance_profile, not aws_iam_roleTensor
An instance profile is basically just a role that is applied to an instance. Can you not find server-role in IAM > Roles? docs.aws.amazon.com/IAM/latest/UserGuide/… Alternatively, you can easily delete the instance profile via AWS CLI: aws iam delete-instance-profileMotion
I see. I was searching by the name so there was no hit.Tensor
Yeah I've got an instance profile which I can see on the CLI but not in the consoleMarilynnmarimba
R
6

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'
Relax answered 13/7, 2022 at 12:12 Comment(2)
This is more accurate than the accepted answer. An instance profile doesn't show up in the console, but it does exist under the hood and can be found via the CLI. If you manually are deleting resources that are conflicting with some sort of IaC (terraform) this will still cause conflict in the case of the same name being in use by what your IaC is trying to create and what you already have created.Actino
bang on. I faced this issue when I removed the role before terminating the instance. It broke all my code and was unable to find it on the console. By removing it with aws cli, It went fineWalachia
M
1

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.

Motion answered 8/7, 2019 at 9:27 Comment(4)
It does not exist in Roles. It is aws_iam_instance_profile, not aws_iam_roleTensor
An instance profile is basically just a role that is applied to an instance. Can you not find server-role in IAM > Roles? docs.aws.amazon.com/IAM/latest/UserGuide/… Alternatively, you can easily delete the instance profile via AWS CLI: aws iam delete-instance-profileMotion
I see. I was searching by the name so there was no hit.Tensor
Yeah I've got an instance profile which I can see on the CLI but not in the consoleMarilynnmarimba
R
0

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

Ramachandra answered 3/6 at 3:32 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Sight

© 2022 - 2024 — McMap. All rights reserved.