Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Gunakan ListInstanceProfilesForRole
dengan CLI
Contoh kode berikut menunjukkan cara menggunakanListInstanceProfilesForRole
.
- CLI
-
- AWS CLI
-
Untuk membuat daftar profil instance untuk peran IAM
list-instance-profiles-for-role
Perintah berikut mencantumkan profil instance yang terkait dengan peran tersebutTest-Role
.aws iam list-instance-profiles-for-role \ --role-name
Test-Role
Output:
{ "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" } ] }
Untuk informasi lebih lanjut, lihat Menggunakan profil instance dalam AWS Panduan Pengguna IAM.
-
Untuk detail API, lihat ListInstanceProfilesForRole
di Referensi AWS CLI Perintah.
-
- PowerShell
-
- Alat untuk PowerShell V4
-
Contoh 1: Contoh ini mengembalikan rincian profil instance yang terkait dengan peran
ec2instancerole
.Get-IAMInstanceProfileForRole -RoleName ec2instancerole
Output:
Arn : arn:aws:iam::123456789012:instance-profile/ec2instancerole CreateDate : 2/17/2015 2:49:04 PM InstanceProfileId : HH36PTZQJUR32EXAMPLE1 InstanceProfileName : ec2instancerole Path : / Roles : {ec2instancerole}
-
Untuk detail API, lihat ListInstanceProfilesForRoledi Referensi Alat AWS untuk PowerShell Cmdlet (V4).
-
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mengembalikan rincian profil instance yang terkait dengan peran
ec2instancerole
.Get-IAMInstanceProfileForRole -RoleName ec2instancerole
Output:
Arn : arn:aws:iam::123456789012:instance-profile/ec2instancerole CreateDate : 2/17/2015 2:49:04 PM InstanceProfileId : HH36PTZQJUR32EXAMPLE1 InstanceProfileName : ec2instancerole Path : / Roles : {ec2instancerole}
-
Untuk detail API, lihat ListInstanceProfilesForRoledi Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-
Untuk daftar lengkap panduan pengembang AWS SDK dan contoh kode, lihatMenggunakan layanan ini dengan AWS SDK. Topik ini juga mencakup informasi tentang memulai dan detail tentang versi SDK sebelumnya.