AWS SDK 또는 CLI로 ListInstanceProfiles with a CLI 사용하기
AWS SDK 또는 CLI로 ListInstanceProfiles with a CLI 사용하기
다음 코드 예시는 ListInstanceProfiles with a CLI을(를) 사용하는 방법을 보여줘요.
출처: 문서
본문
AWS CLI
계정의 인스턴스 프로파일을 나열하려면
다음 list-instance-profiles 명령은 현재 계정과 연결된 인스턴스 프로파일을 나열해요.
aws iam list-instance-profiles
출력:
{
"InstanceProfiles": [
{
"Path": "/",
"InstanceProfileName": "example-dev-role",
"InstanceProfileId": "AIPAIXEU4NUHUPEXAMPLE",
"Arn": "arn:aws:iam::123456789012:instance-profile/example-dev-role",
"CreateDate": "2023-09-21T18:17:41+00:00",
"Roles": [
{
"Path": "/",
"RoleName": "example-dev-role",
"RoleId": "AROAJ52OTH4H7LEXAMPLE",
"Arn": "arn:aws:iam::123456789012:role/example-dev-role",
"CreateDate": "2023-09-21T18:17:40+00:00",
"AssumeRolePolicyDocument":
{
"Version":"2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal":
{
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
}
]
},
{
"Path": "/",
"InstanceProfileName": "example-s3-role",
"InstanceProfileId": "AIPAJVJVNRIQFREXAMPLE",
"Arn": "arn:aws:iam::123456789012:instance-profile/example-s3-role",
"CreateDate": "2023-09-21T18:18:50+00:00",
"Roles": [
{
"Path": "/",
"RoleName": "example-s3-role",
"RoleId": "AROAINUBC5O7XLEXAMPLE",
"Arn": "arn:aws:iam::123456789012:role/example-s3-role",
"CreateDate": "2023-09-21T18:18:49+00:00",
"AssumeRolePolicyDocument":
{
"Version":"2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal":
{
"Service": "ec2.amazonaws.com"
},
"Action": "sts:AssumeRole"
}
]
}
}
]
}
]
}
더 자세한 내용은 AWS IAM 사용자 가이드의 '인스턴스 프로파일 사용' 문서를 참고하세요.
API 상세 내용은 AWS CLI Command Reference의 ListInstanceProfiles 문서를 참고하세요.
Tools for PowerShell V4
예시 1: 이 예시는 현재 AWS 계정에 정의된 인스턴스 프로파일 모음을 반환해요.
Get-IAMInstanceProfileList
출력:
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)의 ListInstanceProfiles 문서를 참고하세요.
Tools for PowerShell V5
예시 1: 이 예시는 현재 AWS 계정에 정의된 인스턴스 프로파일 모음을 반환해요.
Get-IAMInstanceProfileList
출력:
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)의 ListInstanceProfiles 문서를 참고하세요.