AWS SDK 또는 CLI로 ListInstanceProfilesForRole with a CLI 사용하기

AWS SDK 또는 CLI로 ListInstanceProfilesForRole with a CLI 사용하기

다음 코드 예시는 ListInstanceProfilesForRole with a CLI을(를) 사용하는 방법을 보여줘요.

출처: 문서

본문

AWS CLI

IAM 역할의 인스턴스 프로파일을 나열하려면

다음 list-instance-profiles-for-role 명령은 Test-Role 역할과 연결된 인스턴스 프로파일을 나열해요.

aws iam list-instance-profiles-for-role \
    --role-name
Test-Role

출력:

{

    "InstanceProfiles": [

{

            "InstanceProfileId": "AIDGPMS9RO4H3FEXAMPLE",
            "Roles": [

{

                    "AssumeRolePolicyDocument": "<URL-encoded-JSON>",
                    "RoleId": "AIDACKCEVSQ6C2EXAMPLE",
                    "CreateDate": "2013-06-07T20:42:15Z",
                    "RoleName": "Test-Role",
                    "Path": "/",
                    "Arn": "arn:aws:iam::123456789012:role/Test-Role"
                }
            ],
            "CreateDate": "2013-06-07T21:05:24Z",
            "InstanceProfileName": "ExampleInstanceProfile",
            "Path": "/",
            "Arn": "arn:aws:iam::123456789012:instance-profile/ExampleInstanceProfile"
        }
    ]
}

더 자세한 내용은 AWS IAM 사용자 가이드의 '인스턴스 프로파일 사용' 문서를 참고하세요.

API 상세 내용은 AWS CLI Command Reference의 ListInstanceProfilesForRole 문서를 참고하세요.

Tools for PowerShell V4

예시 1: 이 예시는 ec2instancerole 역할과 연결된 인스턴스 프로파일의 상세 정보를 반환해요.

Get-IAMInstanceProfileForRole -RoleName ec2instancerole

출력:

      Arn                 : arn:aws:iam::123456789012:instance-profile/ec2instancerole
      CreateDate          : 2/17/2015 2:49:04 PM
      InstanceProfileId   : HH36PTZQJUR32EXAMPLE1
      InstanceProfileName : ec2instancerole
      Path                : /
      Roles               :
{
ec2instancerole}

API 상세 내용은 AWS Tools for PowerShell Cmdlet Reference (V4)의 ListInstanceProfilesForRole 문서를 참고하세요.

Tools for PowerShell V5

예시 1: 이 예시는 ec2instancerole 역할과 연결된 인스턴스 프로파일의 상세 정보를 반환해요.

Get-IAMInstanceProfileForRole -RoleName ec2instancerole

출력:

      Arn                 : arn:aws:iam::123456789012:instance-profile/ec2instancerole
      CreateDate          : 2/17/2015 2:49:04 PM
      InstanceProfileId   : HH36PTZQJUR32EXAMPLE1
      InstanceProfileName : ec2instancerole
      Path                : /
      Roles               :
{
ec2instancerole}

API 상세 내용은 AWS Tools for PowerShell Cmdlet Reference (V5)의 ListInstanceProfilesForRole 문서를 참고하세요.

더 알아보기 (Learn more)