Privacy Terms

Who We Are At Walk In The Cloud, we are committed to maintaining the trust and confidence of all visitors to our web site. In particular, we want you to know that Walk In The Cloud is not in the business of selling, renting or trading email lists with other companies and businesses for marketing purposes.  In this Privacy Policy, we’ve provided detailed information on when and why we collect personal information, how we use it, the limited conditions under which we may disclose it to others, and how we keep it secure.  We take your privacy seriously and take measures to provide all visitors and users of Walk In The Cloud with a safe and secure environment. Cookies  Walk In The Cloud may set and access Walk In The Cloud cookies on your computer.  Cookies are used to provide our system with the basic information to provide the services you are requesting.  Cookies can be cleared at any time from your internet browser settings.  Google Analytics When someone visits Walk In The Cloud we us

[筆記] UBUNTU 16.04 Google Compute Engine 自動自我備份

以下步驟將教學利用Google Compute Engine 自我定期備份(Backup automatically):

1. 安裝 Google Cloud ( 如果用外部機器才需要裝,如果使用Google Compute Engine內建已安裝)

# Create an environment variable for the correct distribution
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"

# Add the Cloud SDK distribution URI as a package source
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

# Import the Google Cloud Platform public key
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

# Update the package list and install the Cloud SDK
sudo apt-get update && sudo apt-get install google-cloud-sdk

2. 開啟該Instance的Cloud Engine API權限

# 如果還沒開機器可以再開機器的時候設定,已經開了就要停止機器用「編輯」做設定,須將Compute Engine的權限開啟為「讀寫」

停用Instance後可進行編輯,選取存取範圍為針對各個API設定存取權

找到Compute Engine開啟讀寫,其餘不需更動


3. 撰寫Script sh檔自動建立Snapshot並刪除昨日的Snapshot

# 新增一個執行檔
cd /home
sudo vim backup.sh

# 內容如下:主要是將昨日日期與今日日期標記在snapshot名稱
yesterday="$(date -d yesterday '+%Y%m%d')"
nowDate=$(date +%Y%m%d)
sudo gcloud compute disks snapshot [GOOGLE CLOUD ENGINE DISK NAME] --snapshot-names=backup-$nowDate --zone=asia-east1-a
gcloud compute snapshots delete backup-$yesterday

# 將執行檔轉為可執行
sudo chmod +x backup.sh

4. 將sh設定到Crontab中
sudo vim /etc/crontab

# 內容如下:看是要什麼時候執行該備份,以下為定期每日凌晨一點執行
0 1  * * * root /home/backup.sh


留言