Weitere AWS-SDK-Beispiele sind im GitHub-Repository Beispiele für AWS Doc SDKs
Verwendung von ListInstanceProfilesForRole mit einer CLI
Die folgenden Code-Beispiele zeigen, wie ListInstanceProfilesForRole verwendet wird.
- CLI
-
- AWS CLI
-
So listen Sie die Instance-Profile für eine IAM-Rolle auf
Mit dem folgenden Befehl
list-instance-profiles-for-rolewerden die Instance-Profile aufgelistet, die der RolleTest-Rolezugeordnet sind.aws iam list-instance-profiles-for-role \ --role-nameTest-RoleAusgabe:
{ "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" } ] }Weitere Informationen finden Sie unter Verwenden von Instance-Profilen im AWS-IAM-Benutzerhandbuch.
-
Weitere API-Informationen finden Sie unter ListInstanceProfilesForRole
in der AWS CLI-Befehlsreferenz.
-
- PowerShell
-
- Tools für PowerShell V4
-
Beispiel 1: In diesem Beispiel werden Details des Instance-Profils zurückgegeben, das der Rolle
ec2instancerolezugeordnet ist.Get-IAMInstanceProfileForRole -RoleName ec2instanceroleAusgabe:
Arn : arn:aws:iam::123456789012:instance-profile/ec2instancerole CreateDate : 2/17/2015 2:49:04 PM InstanceProfileId : HH36PTZQJUR32EXAMPLE1 InstanceProfileName : ec2instancerole Path : / Roles : {ec2instancerole}-
Weitere API-Informationen finden Sie unter ListInstanceProfilesForRole in der AWS -Tools für PowerShell-Cmdlet-Referenz (V4).
-
- Tools für PowerShell V5
-
Beispiel 1: In diesem Beispiel werden Details des Instance-Profils zurückgegeben, das der Rolle
ec2instancerolezugeordnet ist.Get-IAMInstanceProfileForRole -RoleName ec2instanceroleAusgabe:
Arn : arn:aws:iam::123456789012:instance-profile/ec2instancerole CreateDate : 2/17/2015 2:49:04 PM InstanceProfileId : HH36PTZQJUR32EXAMPLE1 InstanceProfileName : ec2instancerole Path : / Roles : {ec2instancerole}-
Weitere API-Informationen finden Sie unter ListInstanceProfilesForRole in der AWS -Tools für PowerShell-Cmdlet-Referenz (V5).
-