#!/usr/bin/env bash
# To use NIPA Cloud Space public API you need to authenticate against the Identity
# service named keystone, which returns a **Token** and **Service Catalog**.
# The catalog contains the endpoints for all services the user/project has
# access to - such as Compute Instance, Compute Image, Block Storage, Networking.
export OS_AUTH_URL=https://identity-api.nipa.cloud/
# Co-working project identity
export OS_PROJECT_ID=834995e704b44fa888b7xxxxxxxxxxxx
export OS_PROJECT_NAME="test_project"
export OS_USER_DOMAIN_NAME="nipacloud"
if [ -z "$OS_USER_DOMAIN_NAME" ]; then unset OS_USER_DOMAIN_NAME; fi
export OS_PROJECT_DOMAIN_ID="c6b00adf4ed04fc5a958121fadb0e401"
if [ -z "$OS_PROJECT_DOMAIN_ID" ]; then unset OS_PROJECT_DOMAIN_ID; fi
# unset v2.0 items in case set
unset OS_TENANT_ID
unset OS_TENANT_NAME
# performing the action as the **user**.
export OS_USERNAME="test_user@nipa.cloud"
echo "Please enter your NIPA Cloud Space user's password for project $OS_PROJECT_NAME as user $OS_USERNAME: "
read -sr OS_PASSWORD_INPUT
export OS_PASSWORD=$OS_PASSWORD_INPUT
# NIPA Cloud Space only have 1 region "NCP-TH"
export OS_REGION_NAME="NCP-TH"
# Don't leave a blank variable, unset it if it was empty
if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi
export OS_INTERFACE=public
export OS_IDENTITY_API_VERSION=3
@echo off
rem To use NIPA Cloud Space public API you need to authenticate against the Identity
rem service named keystone, which returns a **Token** and **Service Catalog**.
rem The catalog contains the endpoints for all services the user/project has
rem access to - such as Compute Instance, Compute Image, Block Storage, Networking.
set OS_AUTH_URL=https://identity-api.nipa.cloud/
rem Co-working project identity
set OS_PROJECT_ID=834995e704b44fa888b7xxxxxxxxxxxx
set OS_PROJECT_NAME=test_project
set OS_USER_DOMAIN_NAME=nipacloud
if "%OS_USER_DOMAIN_NAME%"=="" set OS_USER_DOMAIN_NAME=
set OS_PROJECT_DOMAIN_ID=c6b00adf4ed04fc5a958121fadb0e401
if "%OS_PROJECT_DOMAIN_ID%"=="" set OS_PROJECT_DOMAIN_ID=
rem unset v2.0 items in case set
set OS_TENANT_ID=
set OS_TENANT_NAME=
rem performing the action as the **user**.
set OS_USERNAME=test_user@nipa.cloud
echo Please enter your NIPA Cloud Space user's password for project %OS_PROJECT_NAME% as user %OS_USERNAME%:
set /p OS_PASSWORD_INPUT=
set OS_PASSWORD=%OS_PASSWORD_INPUT%
rem NIPA Cloud Space only have 1 region "NCP-TH"
set OS_REGION_NAME=NCP-TH
rem Don't leave a blank variable, unset it if it was empty
if "%OS_REGION_NAME%"=="" set OS_REGION_NAME=
set OS_INTERFACE=public
set OS_IDENTITY_API_VERSION=3
(osclient) C:\Users\OhmzPC\Documents\Export_Image>test_project_RC_file.bat
Please enter your NIPA Cloud Space user's password for project test_project as user test_user@nipa.cloud: <ใส่ password>
(osclient) C:\Users\OhmzPC\Documents\Export_Image>openstack token issue
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| expires | 2025-04-26T03:59:41+0000 |
| id | gAAAAABoCwithNSV3tPsaDzi54VvrSxIz6V9rreRJBurlVV2e4Ii5aolilEBRWtUnargn4iKPu8ru-Rt0XqXJl3HHs1x5ZzmH-oM-XQoFRRi7ov_ofiuhryudjdbvSmKHX7d0ZsrEOIvrbCkAqH4gnPNlpsbNc6dnnY5P1s5vmqDrXsOAOB9ywY |
| project_id | 834995e704b44fa888b7xxxxxxxxxxxx |
| user_id | e6275119d15648bfb7c2xxxxxxxxxxxx |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
list image ใน project ด้วย command
(osclient) C:\Users\OhmzPC\Documents\Export_Image>openstack image list
+--------------------------------------+--------------------------------------+--------+
| ID | Name | Status |
+--------------------------------------+--------------------------------------+--------+
| d00037bf-85f6-4bc3-b271-xxxxxxxxxxxx | ubuntu-24-v250307 | active |
+--------------------------------------+--------------------------------------+--------+
download image ใน project ด้วย command
(osclient) C:\Users\OhmzPC\Documents\Export_Image>openstack image save --file <ชื่อ file image>.qcow2 <image_ID>
ตัวอย่าง
(osclient) C:\Users\OhmzPC\Documents\Export_Image>openstack image save --file ubuntu-24-v250307.qcow2 d00037bf-85f6-4bc3-b271-xxxxxxxxxxxx
ถ้า download เรียบร้อยแล้วจะได้ไฟล์ image
(osclient) C:\Users\OhmzPC\Documents\Export_Image>dir
Volume in drive C is Windows
Volume Serial Number is XXXX-XXXX
Directory of C:\Users\OhmzPC\Documents\Export_Image
04/25/2025 11:08 AM <DIR> .
04/25/2025 10:43 AM <DIR> ..
04/25/2025 10:57 AM 1,270 test_project_RC_file.bat
04/25/2025 10:49 AM 1,343 test_project_RC_file.sh
04/25/2025 10:51 AM <DIR> osclient
04/25/2025 11:09 AM 1,243,992,064 ubuntu-24-v250307.qcow2
3 File(s) 1,243,994,677 bytes
3 Dir(s) 326,236,172,288 bytes free
หากต้องการ export ด้วย Linux สามารถดำเนินการได้ตามด้านล่าง
หลังจากเตรียม environment สำหรับแต่ละ OS เรียบร้อยแล้ว ให้ดำเนินการตามขั้นตอนด้านล่างต่อไป
Download Public API RC File โดย download จากหน้า project บน Nipa Cloud Space
ตรวจสอบ RC_file.sh
(osclient) root@test-export-image:/opt/osclient# vim test_project_RC_file.sh
#!/usr/bin/env bash
# To use NIPA Cloud Space public API you need to authenticate against the Identity
# service named keystone, which returns a **Token** and **Service Catalog**.
# The catalog contains the endpoints for all services the user/project has
# access to - such as Compute Instance, Compute Image, Block Storage, Networking.
export OS_AUTH_URL=https://identity-api.nipa.cloud/
# Co-working project identity
export OS_PROJECT_ID=834995e704b44fa888b7xxxxxxxxxxxx
export OS_PROJECT_NAME="test_project"
export OS_USER_DOMAIN_NAME="nipacloud"
if [ -z "$OS_USER_DOMAIN_NAME" ]; then unset OS_USER_DOMAIN_NAME; fi
export OS_PROJECT_DOMAIN_ID="c6b00adf4ed04fc5a958121fadb0e401"
if [ -z "$OS_PROJECT_DOMAIN_ID" ]; then unset OS_PROJECT_DOMAIN_ID; fi
# unset v2.0 items in case set
unset OS_TENANT_ID
unset OS_TENANT_NAME
# performing the action as the **user**.
export OS_USERNAME="test_user@nipa.cloud"
echo "Please enter your NIPA Cloud Space user's password for project $OS_PROJECT_NAME as user $OS_USERNAME: "
read -sr OS_PASSWORD_INPUT
export OS_PASSWORD=$OS_PASSWORD_INPUT
# NIPA Cloud Space only have 1 region "NCP-TH"
export OS_REGION_NAME="NCP-TH"
# Don't leave a blank variable, unset it if it was empty
if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi
export OS_INTERFACE=public
export OS_IDENTITY_API_VERSION=3
(osclient) root@test-export-image:/opt/osclient# source test_project_RC_file.sh
Please enter your NIPA Cloud Space user's password for project test_project as user test_user@nipa.cloud:<ใส่ password>
(osclient) root@test-export-image:/opt/osclient# openstack token issue
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| expires | 2025-04-26T04:36:06+0000 |
| id | gAAAAABoCxE24s4f-T2MOyOFsLcfGWvbf1zwQBZfwC3KcqiKSpod1OuDJa3xdWaBvtMui7w9Hr3B0OHkQYx8u1aQYKodxhyKSLIcazwG1JbwAbt-Vgx8KAcU5zWQGAkPoOUmWuyNFW0ZkzONKU0HOmISAr8DM1bErVjWL7Il595Xmzmjr_889Uo |
| project_id | 834995e704b44fa888b7xxxxxxxxxxxx |
| user_id | e6275119d15648bfb7c2xxxxxxxxxxxx |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
(osclient) root@test-export-image:/opt/osclient#
list image ใน project ด้วย command
(osclient) root@test-export-image:/opt/osclient# openstack image list
+--------------------------------------+--------------------------------------+--------+
| ID | Name | Status |
+--------------------------------------+--------------------------------------+--------+
| d00037bf-85f6-4bc3-b271-xxxxxxxxxxxx | ubuntu-24-v250307 | active |
+--------------------------------------+--------------------------------------+--------+
download image ที่ต้องการใน project ด้วย command
(osclient) root@test-export-image:/opt/osclient# openstack image save --file <ชื่อ file image> <image_ID>
ตัวอย่าง
(osclient) root@test-export-image:/opt/osclient# openstack image save --file ubuntu-24-v250307.qcow2 d00037bf-85f6-4bc3-b271-xxxxxxxxxxxx