AWS文件開發套件範例
搭配使用 GetInstanceProfile 與 CLI
下列程式碼範例示範如何使用 GetInstanceProfile。
- CLI
-
- AWS CLI
-
若要取得有關執行個體設定檔的資訊
下列
get-instance-profile命令會取得名為ExampleInstanceProfile之執行個體設定檔的相關資訊。aws iam get-instance-profile \ --instance-profile-nameExampleInstanceProfile輸出:
{ "InstanceProfile": { "InstanceProfileId": "AID2MAB8DPLSRHEXAMPLE", "Roles": [ { "AssumeRolePolicyDocument": "<URL-encoded-JSON>", "RoleId": "AIDGPMS9RO4H3FEXAMPLE", "CreateDate": "2013-01-09T06:33:26Z", "RoleName": "Test-Role", "Path": "/", "Arn": "arn:aws:iam::336924118301:role/Test-Role" } ], "CreateDate": "2013-06-12T23:52:02Z", "InstanceProfileName": "ExampleInstanceProfile", "Path": "/", "Arn": "arn:aws:iam::336924118301:instance-profile/ExampleInstanceProfile" } }如需詳細資訊,請參閱《AWS IAM 使用者指南》中的使用執行個體設定檔。
-
如需 API 詳細資訊,請參閱 AWS CLI Command Reference 中的 GetInstanceProfile
。
-
- PowerShell
-
- Tools for PowerShell V4
-
範例 1:此範例會傳回在目前的 AWS 帳戶中定義之名為
ec2instancerole的執行個體設定檔的詳細資訊。Get-IAMInstanceProfile -InstanceProfileName 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 參考 (V4)》中的 GetInstanceProfile。
-
- Tools for PowerShell V5
-
範例 1:此範例會傳回在目前的 AWS 帳戶中定義之名為
ec2instancerole的執行個體設定檔的詳細資訊。Get-IAMInstanceProfile -InstanceProfileName 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 參考 (V5)》中的 GetInstanceProfile。
-
GetGroupPolicy
GetLoginProfile