NCS - Documents
Go to Portal
  • NIPA Cloud Space Overview
    • Welcome to NIPA Cloud Space documentation
    • NCS User Account
      • Create NIPA Cloud Space Account
      • Loging in to Nipa Cloud Space
      • Reset NCS Password
      • Activating Two-Factor Authentication
      • Deactivating Two-Factor Authentication
    • Co-working Projects
      • Create Co-working Project
      • Manage Project Member
      • Exporting Resource List
    • Billing & Wallet
      • Topup a Project Wallet
      • Redeem Voucher
      • Insufficient Wallet Balance
  • COMPUTE
    • Compute Instance
      • What is OS Status?
      • Launching Compute Instance
      • Managing Instance
        • Stop
        • Start
        • Restart
        • Resize (Change Machine Type)
        • Take Snapshot
        • Auto Backup
        • Reset Linux "root" Password
        • Reset Windows "Administrator" Password
      • SSH to Linux Compute Instance
        • Converting Key Pair for PuTTy
        • Windows Client using Key Pair
        • Windows Client using Password
        • MacOS/Linux using Key Pairs
        • MacOS/Linux using Password
      • Remote Desktop to Windows Instance
      • Setting Docker Image Caching
      • Renaming Instance
      • Exporting Instance List
      • How to change Compute Instance hostname
      • How to install QEMU Guest Agent
      • How to fix update kernel for RHEL
      • How to Update Rocky Linux 9
      • How to Upgrade Rocky Linux to 9.4
      • How to change RDP port on Windows
    • Compute Image
      • Create Image From a Bootable Volume
      • Importing Your Own Image
      • Export Image
      • Share Image to Between Projects
      • Exporting Image List
    • Key Pair
      • Managing Key Pair(s)
      • Creating a New Key Pair
      • Importing an Existing Key Pair
    • Deployment Script
      • Managing Deployment Script
      • Create a Deployment Script
      • Clone a Deployment Script
      • Edit a Deployment Script
      • Delete a Deployment Script
  • STORAGE
    • Block Storage
      • Managing Volume(s)
        • Create From Blank
        • Create From an Image
        • Create From a Volume
        • Create From a Snapshot
        • Transferring a Volume
        • Accepting a Tranferred Volume
        • Renaming a Volume
        • How to Change Volume Type
      • Managing Snapshot(s)
        • Create a Snapshot
        • Renaming a Volume Snapshot
      • Exporting Volume and Volume Snapshot List
    • Object Storage (S3)
      • Migrate file S3 AWS to S3 NIPA
      • Create an Object Storage Bucket
      • Delete an Object Storage Bucket
      • Create an Object Storage Sub-User
      • Regenerate Sub-User's Access Key
      • Revoke Sub-User's Access Key
      • Create Bucket Policy
      • Bucket Versioning
      • Access S3 Bucket with Cyberduck
        • Upload Files to a Bucket
        • Share File via Public Link
      • Access S3 Bucket with s3cmd
        • Basic command
        • การ set ACL สำหรับการเปิดใช้งาน Objects แบบ public
        • การสร้าง Presigned URL สำหรับการใช้งานชั่วคราว
      • Mount S3 Bucket on instances with s3fs-fuse
      • Mount the S3 bucket on the Windows
      • Access S3 buckets With AWS S3 Client SDK
        • S3Client Configuration
        • Basic Command
        • Multipart Upload
      • Access S3 buckets with internal network for NCS instance
      • Delete Lifecycle Policies
      • Move Objects Lifecycle Script
      • Configure a static website using S3 Bucket
    • NIPA Drive
      • Purchasing a Drive
  • NETWORKING
    • Networking
      • Managing VPC Network(s)
        • Create a Network
        • DHCP Setting
        • Create Port
        • Create Router
      • Managing Security Group(s)
        • Create a New Security Group
        • Create Security Group Presets
      • Managing External IP(s)
        • Create an External IP
        • Exporting External IP List
      • NAT Gateway with Ubuntu (VM) แบบ Host Route
      • NAT and VPN Gateway on NCS with Pfsense-2.6.0
  • LOAD BALANCING
    • Load Balancer as a Service
      • Create Load Balancer
      • Using Network Load Balancing
      • Using Application Load Balancing
      • Renaming a Load Balancer
      • Exporting Load Balancer List
      • Monitoring Load Balancer Using Prometheus
    • SSL Certificate
      • Import SSL Certificate
  • DATABASE AS A SERVICE
    • SQL Database
      • Create SQL Database Instance
        • Create MySQL Database Instance
      • Manage SQL Database Instance
        • Reboot Database Service
        • Delete Database Instance
        • Online Extend Storage Size
        • Edit Allowed CIDR
      • Auto-Scaling SQL Database Storage
        • Enable Auto-Scaling
        • Disable Auto-Scaling
        • Edit Auto-Scaling
      • Manage SQL Database Root User
        • Enable Root User
        • Reset Root User Password
      • Manage SQL Database Schema
        • Create Database Schema
        • Delete Database Schema
      • Manage SQL Database User
        • Create Database User
        • Delete Database User
        • Reset Password
        • Edit Access
      • Manage SQL Database Backup
        • Create Backup
        • Create A New SQL Database Instance From Backup
        • Delete Backup
      • Manage SQL Database Logs
        • Enable Logs
        • Disable Logs
        • Refresh Logs
        • Load More Logs
      • Manage Monitoring User
        • Create Monitoring User
        • Delete Monitoring User
      • Monitor SQL Database with Percona Monitoring and Management (PMM)
  • SCHEDULING
    • Schedules
      • Create Schedule
    • Jobs
  • Public API
    • What is NCS Public API ?
      • Download NCS Project RC File
      • Getting Start with NCS Public API
        • Using OpenStack Client Tool
        • Using REST API
        • Terraform with Openstack
        • Auto-scaling OpenStack Instances with Senlin and Prometheus
          • Installation Prometheus
          • Installation Alertmanager
  • MIGRATION
    • Migrating Linux VM from vSphere to NCS
    • Migrating Windows VM from vSphere to NCS
  • Customer Support
    • Having Problem Before Access a Project
    • Having Problem In a Project
  • Tutorial
    • My First Website
    • Access MySQL Database With MySQL Workbench
    • Pritunl for VPN server
    • Install Rancher Server with Docker Quick Start
      • Create RKE2 Cluster via Rancher Dashboard
    • Install odoo18 with external database
    • How to use LBaaS for mysql Load Balancing
    • How to use Cloudflare with Nipa Cloud Space
  • Release Notes
    • v5.0.X (v5.0.0-now)
      • v5.0.0
      • v5.1.0
      • v5.2.0
      • v5.2.1
      • v5.2.2
      • v5.2.3
      • v5.2.4
      • v.5.3.0
      • v5.4.0
    • v4.19.X (v4.19.0-v4.19.3)
      • v4.19.0
      • v4.19.1
      • v4.19.2
      • v4.19.3
    • v4.18.X (v4.18.0-v4.18.2)
      • v4.18.0
      • v4.18.1
      • v4.18.2
    • v4.17.X (v4.17.0-v4.17.3)
      • v4.17.0
      • v4.17.0.1
      • v4.17.1
      • v4.17.2
      • v4.17.3
    • v4.16.X (v4.16.0-v4.16.5)
      • v4.16.0
      • v4.16.1
      • v4.16.2
      • v4.16.3
      • v4.16.4
      • v4.16.5
    • v4.15.X (v4.15.0-v4.15.9)
      • v4.15.0
      • v4.15.1
      • v4.15.2
      • v4.15.3
      • v4.15.4
      • v4.15.5
      • v4.15.6
      • v4.15.7
      • v4.15.8
      • v4.15.9
    • v.4.14.X (v4.14.0-v4.14.2)
      • v.4.14.0
      • v4.14.1
      • 4.14.2
Powered by GitBook
On this page

Was this helpful?

  1. STORAGE
  2. Object Storage (S3)

Migrate file S3 AWS to S3 NIPA

ในกรณีที่ลูกค้าต้องการย้ายข้อมูลจาก Amazon S3 มาใช้งาน S3 Bucket ของ Nipa Cloud สามารถดำเนินการ โดยใช้ s3fs และ rsync ได้ตามขั้นตอนต่อไปนี้

ข้อกำหนด

a. ต้องจัดเตรียม S3 Bucket, Access ID และ Secret Key ของ AWS และ Nipa cloud เพื่อใช้สำหรับ mount s3fs (สำหรับ AWS สามารถเตรียมโดยรายละเอียดเพิ่มเติมตาม link :https://www.nakivo.com/blog/mount-amazon-s3-as-a-drive-how-to-guide/)

b. เตรียม instance สำหรับ mount s3fs (ตัวอย่างในเอกสารใช้ Ubuntu 22.04)

ขั้นตอนการ sync file จาก S3 AWS มายัง S3 Nipa cloud รายละเอียดดังนี้

  1. ดำเนินการสร้าง S3 bucket บน Nipa Cloud Space ขั้นตอนการสร้างรายละเอียดตาม link ด้านล่าง

#สร้าง bucket เพื่อใช้เป็น container เก็บ object ต่างๆ สำหรับ object storage

https://docs-epc.gitbook.io/ncs-documents/object-storage/create-an-object-storage-bucket

#ในการ authen เข้าใช้งาน bucket ที่สร้างบน Nipa Cloud Space จะทำโดยใช้ access ID และ secret key ที่อยู่ใน sub-user

https://docs-epc.gitbook.io/ncs-documents/object-storage/create-object-storage-sub-user

#สร้าง policy เพื่อจำกัดการเข้าใช้งาน bucket

https://docs-epc.gitbook.io/ncs-documents/object-storage/create-bucket-policy

  1. เมื่อสร้าง S3 Bucket Nipa และ user Access-ID, Secret Key เรียบร้อย ให้ SSH ไปยัง instance ที่สร้างไว้

  2. ติดตั้ง dependency สำหรับใช้งาน s3fs

apt update
apt-get -y install automake autotools-dev fuse g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config

# ติดตั้ง s3fs-fuse
git clone https://github.com/s3fs-fuse/s3fs-fuse.git
cd s3fs-fuse/
./autogen.sh
./configure --prefix=/usr --with-openssl
make
make install

#ตรวจสอบว่าติดตั้ง s3fs สำเร็จหรือไม่
which s3fs
  1. ดำเนินการสร้างไฟล์สำหรับเก็บ Access ID, Secret Key

# Access ID สำหรับ mount S3 AWS
echo "ACCESS_KEY:SECRET_KEY" | sudo tee /etc/passwd-s3fs-aws
# Access ID สำหรับ mount S3 NIPA
echo "ACCESS_KEY:SECRET_KEY" | sudo tee /etc/passwd-s3fs-nipa

# เปลี่ยน Permission ของไฟล์
chmod 600 /etc/passwd-s3fs-aws
chmod 600 /etc/passwd-s3fs-nipa
  1. ดำเนินการสร้าง Path สำหรับ mount S3 AWS และ mount S3 NIPA

mkdir -p /mnt/s3aws
mkdir -p /mnt/s3nipacloud
  1. ดำเนินการ mount S3 Bucket AWS ไปยัง /mnt/s3aws โดยมีรายละเอียด option ดังนี้

sudo s3fs {bucketname} {/mountpoint} -o passwd_file=/etc/passwd-s3fs-aws

{bucketname} = ชื่อของ bucket ที่สร้าง ตัวอย่างเช่น my-bucket

{/mountpoint} = path ที่ต้องการ mount ไฟล์จาก s3 bucket aws ตัวอย่างเช่น /mnt/s3aws

# ตัวอย่าง Command
sudo s3fs my-bucket /mnt/s3aws -o passwd_file=/etc/passwd-s3fs-aws
  1. ดำเนินการ mount S3 Bucket NIPA ไปยัง /mnt/s3nipacloud

sudo s3fs {bucketname} {/mountpoint} -o passwd_file=/etc/passwd-s3fs-nipa -o allow_other -o url=https://s3-bkk.nipa.cloud

{bucketname} = ชื่อของ bucket ที่สร้าง ตัวอย่างเช่น my-bucket

{/mountpoint} = path ที่ต้องการ mount ไฟล์จาก s3 bucket aws ตัวอย่างเช่น /mnt/s3aws

# ตัวอย่าง Command
sudo s3fs my-bucket /mnt/s3nipacloud -o passwd_file=/etc/passwd-s3fs-nipa -o allow_other -o url=https://s3-bkk.nipa.cloud
  1. ตรวจสอบว่าสามารถ mount S3 Bucket สำเร็จหรือไม่ โดย run command

df -h
  1. ดำเนินการ sync file จาก S3 Bucket AWS ไปยัง S3 Bucket NIPA

rsync -av --progress {/path/to/source/} {/path/to/destination/}

# ตัวอย่าง Command
rsync -av --progress /mnt/s3aws/ /mnt/s3nipacloud/

10. เมื่อ sync ไฟล์เสร็จเรียบร้อย ให้ตรวจสอบไฟล์ใน S3 Bucket NIPA ว่าครบหรือไม่โดยสามารถ run command

diff -r {/path/to/source} {/path/to/destination}
# คำสั่ง diff จะแสดงความแตกต่างระหว่างไฟล์ในไดเรกทอรีต้นทางและไดเรกทอรีปลายทาง ถ้าไม่มีผลลัพธ์ที่แสดงออกมา แสดงว่าไฟล์ต้นทางและปลายทางเท่ากัน

#ตัวอย่าง Command
diff -r /mnt/s3aws /mnt/s3nipacloud
PreviousObject Storage (S3)NextCreate an Object Storage Bucket

Last updated 10 months ago

Was this helpful?