오브젝트스토리지

송용근 에반젤리스트

iwinv Object Storage - cURL

 

해당 메뉴얼은 AWS S3에서 제공하는 cURL를 이용하여 iwinv Object Storage를 사용하는 방법을 설명합니다.

 

 

 cURL 사용하기



테스트 OS : Ubuntu 18.04 LTS

 

[인증키 확인]

Endpoint : console.iwinv.kr -> 오브젝트 스토리지 -> 스토리지 관리 -> 인증키 관리 -> API {IDC} Endpoint 

User_Id : console.iwinv.kr -> 오브젝트 스토리지 -> 스토리지 관리 -> 인증키 관리 -> User ID

Access_Key : console.iwinv.kr -> 오브젝트 스토리지 -> 스토리지 관리 -> 인증키 관리 -> Access Key ID

Secret_Key : console.iwinv.kr -> 오브젝트 스토리지 -> 스토리지 관리 -> 인증키 관리 -> Secret Key ID

Token : [토큰 키 생성]으로 생성된 X-Auth-Token 값 

 

 

# 예제코드


 

토큰 키 생성  

# curl -i -g -X GET "Endpoint/auth/" -H "X-Auth-User: User_id:Access_key" -H "X-Auth-Key: Secret_key
HTTP/1.1 204 No Content
X-Storage-Url: http://kridc.object.iwinv.krt/swift/v1/AUTH_5b688a1aa8e8a5d7d604e2806c9a2abab64f3fcf73adc6d06151a47c1f817224
X-Storage-Token: AUTH_rgwtk55000000356236383861316161386538613564376436303465323830366339613261626162363466336663663733616463366430363135316134376331663831373232343a4b494d5a304b52514439553239375146374248333a5799f31657becf4e75e85e7a8d6103960f10dee2c3365b6cd357a03fc1a87acd3ec766
X-Auth-Token: AUTH_rgwtk55000000356236383861316161386538613564376436303465323830366339613261626162363466336663663733616463366430363135316134376331663831373232343a4b494d5a304b52514439553239375146374248333a5799f31657becf4e75e85e7a8d6103960f10dee2c3365b6cd357a03fc1a87acd3ec766
X-Trans-Id: tx000000000000000007bda-005ee723ce-1461cdd-default
X-Openstack-Request-Id: tx000000000000000007bda-005ee723ce-1461cdd-default
Content-Type: application/json; charset=utf-8
Date: Mon, 15 Jun 2020 07:31:26 GMT

 

 

버킷 생성

# curl -i -X PUT Endpoint/swift/v1/User_Id/Bukcet_Name -H "X-Auth-Token: Token"
HTTP/1.1 201 Created
Content-Length: 0
X-Trans-Id: tx000000000000000008528-005ee82787-1461cdd-default
X-Openstack-Request-Id: tx000000000000000008528-005ee82787-1461cdd-default
Accept-Ranges: bytes
Content-Type: text/plain; charset=utf-8
Date: Tue, 16 Jun 2020 01:59:35 GMT

 

 

버킷 삭제

# curl -i -X DELETE Endpoint/swift/v1/User_Id/Bucket_Name -H "X-Auth-Token: Token"
HTTP/1.1 204 No Content
X-Trans-Id: tx000000000000000008529-005ee82857-1461cdd-default
X-Openstack-Request-Id: tx000000000000000008529-005ee82857-1461cdd-default
Accept-Ranges: bytes
Content-Type: text/plain; charset=utf-8
Date: Tue, 16 Jun 2020 02:03:03 GMT

 

버킷 리스트 확인

# curl -i -X GET Endpoint/swift/v1/User_Id/ -H "X-Auth-Token: Token"
HTTP/1.1 200 OK
X-Timestamp: 1592273237.04130
X-Account-Container-Count: 2
X-Account-Object-Count: 0
X-Account-Bytes-Used: 0
X-Account-Bytes-Used-Actual: 0
X-Account-Storage-Policy-Default-Placement-Container-Count: 2
X-Account-Storage-Policy-Default-Placement-Object-Count: 0
X-Account-Storage-Policy-Default-Placement-Bytes-Used: 0
X-Account-Storage-Policy-Default-Placement-Bytes-Used-Actual: 0
X-Account-Storage-Policy-Temporary-Container-Count: 0
X-Account-Storage-Policy-Temporary-Object-Count: 0
X-Account-Storage-Policy-Temporary-Bytes-Used: 0
X-Account-Storage-Policy-Temporary-Bytes-Used-Actual: 0
Accept-Ranges: bytes
X-Trans-Id: tx00000000000000000853b-005ee82955-1461cdd-default
X-Openstack-Request-Id: tx00000000000000000853b-005ee82955-1461cdd-default
Content-Type: text/plain; charset=utf-8
Content-Length: 12
Date: Tue, 16 Jun 2020 02:07:17 GMT

iwinv
iwinv2

 

  

오브젝트 업로드

# curl -i -X PUT -T Object_Name Endpoint/swift/v1/User_Id/Bucket_Name/ -H "X-Auth-Token: Token"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0HTTP/1.1 100 CONTINUE

100 5 0 0 100 5 0 24 --:--:-- --:--:-- --:--:-- 24HTTP/1.1 201 Created
etag: d8e8fca2dc0f896fd7cb4cb0031ba249
Last-Modified: Tue, 16 Jun 2020 06:15:28 GMT
X-Trans-Id: tx000000000000000000033-005ee86380-150fda5-default
X-Openstack-Request-Id: tx000000000000000000033-005ee86380-150fda5-default
Content-Type: text/plain; charset=utf-8
Content-Length: 0
Date: Tue, 16 Jun 2020 06:15:28 GMT

100 5 0 0 100 5 0 20 --:--:-- --:--:-- --:--:-- 20

 

 

오브젝트 다운로드

curl -s -S -X GET Endpoint/swift/v1/User_Id/Bucket_Name/Object_Name "X-Auth-Token: Token" -o File_Name

 

 

오브젝트 리스트 확인 

# curl -i -X GET Endpoint/swift/v1/User_Id/Bucket_Name -H "X-Auth-Token: Token"
HTTP/1.1 200 OK
X-Timestamp: 1592273237.04130
X-Account-Container-Count: 2
X-Account-Object-Count: 0
X-Account-Bytes-Used: 0
X-Account-Bytes-Used-Actual: 0
X-Account-Storage-Policy-Default-Placement-Container-Count: 2
X-Account-Storage-Policy-Default-Placement-Object-Count: 0
X-Account-Storage-Policy-Default-Placement-Bytes-Used: 0
X-Account-Storage-Policy-Default-Placement-Bytes-Used-Actual: 0
X-Account-Storage-Policy-Temporary-Container-Count: 0
X-Account-Storage-Policy-Temporary-Object-Count: 0
X-Account-Storage-Policy-Temporary-Bytes-Used: 0
X-Account-Storage-Policy-Temporary-Bytes-Used-Actual: 0
Accept-Ranges: bytes
X-Trans-Id: tx00000000000000000853b-005ee82955-1461cdd-default
X-Openstack-Request-Id: tx00000000000000000853b-005ee82955-1461cdd-default
Content-Type: text/plain; charset=utf-8
Content-Length: 12
Date: Tue, 16 Jun 2020 02:07:17 GMT

test.txt
sample.jpg

 

 

오브젝트 삭제

curl -i -X DELETE Endpoint/swift/v1/User_Id/Bucket_Name/Object_Name  -H "X-Auth-Token: Token
HTTP/1.1 204 No Content
X-Trans-Id: tx000000000000000008529-005ee82857-1461cdd-default
X-Openstack-Request-Id: tx000000000000000008529-005ee82857-1461cdd-default
Accept-Ranges: bytes
Content-Type: text/plain; charset=utf-8
Date: Tue, 16 Jun 2020 02:03:03 GMT