--- title: "Role Data" slug: "compute-vmetadata-roledata" tags: ["Metadata"] updated: 2026-09-17T09:10:13Z published: 2026-09-17T09:10:13Z canonical: "api-fin.ncloud-docs.com/compute-vmetadata-roledata" --- > ## Documentation Index > Fetch the complete documentation index at: https://api-fin.ncloud-docs.com/llms.txt > Use this file to discover all available pages before exploring further. # Role Data 서버 인스턴스에 부여된 역할 (Role)과 관련된 정보를 조회합니다. 역할 관련 조회 기능을 사용하기 위해서는 Sub Account를 통해 서버 인스턴스에 역할 (Role)을 부여해야 합니다. 역할 부여에 관한 자세한 내용은 Sub Account 사용 가이드의 [역할 관리](https://guide-fin.ncloud-docs.com/docs/subaccount-policy-role#%EC%97%AD%ED%95%A0%EA%B4%80%EB%A6%AC)를 참조해 주십시오. Role ID 조회와 임시 Access Key 발급 기능은 ncloud-sdk와 Object Storage CLI에서 환경 변수와 configure 파일에 모두 Access Key가 설정되어 있지 않은 경우에 이용할 수 있습니다. 참고 언어별 ncloud-sdk 목록 및 설치 방법, Ncloud CLI, Object Storage CLI 사용에 관한 자세한 내용은 다음을 참조해 주십시오. - **ncloud-sdk** - [ncloud-sdk-js](https://github.com/NaverCloudPlatform/ncloud-sdk-js) - [ncloud-sdk-java](https://github.com/NaverCloudPlatform/ncloud-sdk-java) - [ncloud-sdk-go](https://github.com/NaverCloudPlatform/ncloud-sdk-go-v2) - [ncloud-sdk-python](https://github.com/NaverCloudPlatform/ncloud-sdk-python) - **Ncloud CLI** - [CLI 사용 가이드](https://cli-fin.ncloud-docs.com/docs/home) - **Object Storage CLI** - [Object Storage CLI 사용 가이드](https://cli-fin.ncloud-docs.com/docs/guide-objectstorage) ## 요청 요청 형식을 설명합니다. 요청 형식은 다음과 같습니다. | 호출 경로 | 설명 | | --- | --- | | /{version}/meta-data/iam/ | 해당 버전에서 제공하는 역할 (Role) 관련 메타데이터 항목을 리스트로 조회 | | /{version}/meta-data/iam/info | 서버 인스턴스에 부여된 역할 (Role)의 상세 정보 조회 | | /{version}/meta-data/iam/security-credentials | 서버 인스턴스에 부여된 역할 (Role)의 ID 조회 - 출력 결과의 마지막에 개행 문자 (\n) 없음 - ncloud-sdk와 Object Storage CLI에서 내부적으로 Role ID를 획득하기 위해 사용 가능 | | /{version}/meta-data/iam/security-credentials/{roleId} | 서버 인스턴스에 부여된 역할 (Role)에 대한 임시 Access Key (STS) 발급 - 발급된 임시 Access Key는 Role에 설정된 정책 (Policy)에 따른 권한 획득 - 서브 계정의 Access Key와 마찬가지로 API, CLI, SDK에서 사용 가능 - 출력 결과의 마지막에 개행 문자 (\n) 없음 - ncloud-sdk와 Object Storage CLI에서 내부적으로 임시 Access Key를 획득하기 위해 사용 가능 | ## 예시 예시는 다음과 같습니다. ### Metadata v1 Metadata v1 예시는 다음과 같습니다. ``` # 항목 조회 [root@test-server ~]# curl http://169.254.169.254/latest/meta-data/iam/ info security-credentials # 역할 상세 정보 조회 [root@test-server ~]# curl http://169.254.169.254/latest/meta-data/iam/info { "roleId" : "***-***-***-***-***ec4", "roleName" : "test-role", "roleType" : "Server", "createTime" : "2024-05-04T08:24:35Z" } # Role ID 조회 [root@test-server ~]# curl http://169.254.169.254/latest/meta-data/iam/security-credentials ***-***-***-***-***ec4[root@test-server ~]# # 임시 Access Key 발급 [root@test-server ~]# curl http://169.254.169.254/latest/meta-data/iam/security-credentials/***-***-***-***-***ec4 { "Type" : "NCP-HMAC", "AccessKeyId" : "s_***976", "SecretAccessKey" : "***6ab", "Expiration" : "2024-05-22T11:50:45Z", "Token" : "", "LastUpdated" : "2024-04-21T23:50:45Z", "Code" : "Success" }[root@test-server ~]# ``` ### Metadata v2 Metadata v2 예시는 다음과 같습니다. 예시의 두 번째 이후 요청은 첫 번째 요청에서 생성한 토큰이 만료되지 않았다는 가정하에 해당 토큰을 사용한 예입니다. ``` # 항목 조회 [root@test-server ~]# TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-NCP-METADATA-TOKEN-TTL-SECONDS: 21600"` \ && curl -H "X-NCP-METADATA-TOKEN: $TOKEN" http://169.254.169.254/latest/meta-data/iam/ info security-credentials # 역할 상세 정보 조회 [root@test-server ~]# curl -H "X-NCP-METADATA-TOKEN: $TOKEN" http://169.254.169.254/latest/meta-data/iam/info { "roleId" : "***-***-***-***-***ec4", "roleName" : "test-role", "roleType" : "Server", "createTime" : "2024-05-04T08:24:35Z" } # Role ID 조회 [root@test-server ~]# curl -H "X-NCP-METADATA-TOKEN: $TOKEN" http://169.254.169.254/latest/meta-data/iam/security-credentials ***-***-***-***-***ec4[root@test-server ~]# # 임시 Access Key 발급 [root@test-server ~]# curl -H "X-NCP-METADATA-TOKEN: $TOKEN" http://169.254.169.254/latest/meta-data/iam/security-credentials/***-***-***-***-***ec4 { "Type" : "NCP-HMAC", "AccessKeyId" : "s_***976", "SecretAccessKey" : "***6ab", "Expiration" : "2024-05-22T11:50:45Z", "Token" : "", "LastUpdated" : "2024-04-21T23:50:45Z", "Code" : "Success" }[root@test-server ~]# ```