Pages

2023年5月11日 星期四

【GCP 】Region HTTP TO HTTPS Load Balance 設定方式(台灣)

目的:在GCP上建立台灣版的HTTP轉HTTPS的負載平衡器

步驟:

1. 進入GCP Console

2. 點選右上角的【啟用Cloud Shell】

3. 點選右下角【開啟編輯器】

4. 點選【File】➔【New File】

5. 貼上以下內容(相關名稱與domain請自行修改)


  1. kind: compute#urlMap
  2. name: example-http-to-https
  3. defaultUrlRedirect:
  4. redirectResponseCode: MOVED_PERMANENTLY_DEFAULT
  5. httpsRedirect: True
  6. tests:
  7. - description: Test with no query parameters
  8. host: example.com
  9. path: /
  10. expectedOutputUrl: https://example.com/
  11. expectedRedirectResponseCode: 301

6. 點選【File】➔【Save As...】➔ 選擇tmp目錄➔存檔名稱為:web-map-http.yaml

7. 點選右上角X ➔ 離開編輯器

8. 到【VPC Network】➔【IP Address】➔尋找HTTPS負載平衡器,建立的HTTPS IP名稱。

9. 點選右上角的【啟用Cloud Shell】

10. 執行以下指令(請依自行設定的區域、IP名稱自行修改)

  1. gcloud compute url-maps import example-http-to-https --source /tmp/web-map-http.yaml --region=asia-east1
  2. gcloud compute url-maps describe example-http-to-https --region=asia-east1
  3. gcloud compute target-http-proxies create http-lb-proxy --url-map=example-http-to-https --region=asia-east1
  4. gcloud compute forwarding-rules create http-content-rule \
  5. --load-balancing-scheme=EXTERNAL_MANAGED \
  6. --address=uat-example-https2 \
  7. --network-tier=STANDARD \
  8. --region=asia-east1 \
  9. --target-http-proxy=http-lb-proxy \
  10. --target-http-proxy-region=asia-east1 \
  11. --ports=80

11. 完成後,網域站台即可透過HTTP協定轉到HTTPS。

Related Posts:

  • 【AWS】SQL Server服務備份與還原資料 AWS上面RDS的SQL Server雖然有提供線上的備份服務,但是在導入資料到本地端的開發環卻是比較困難的,因此下方影片提供了相關的步驟來讓大家可以照步驟來進行備份還原AWS上的SQL SERVER的服務資料。預先準備:1. AWS S3的空間。2. SQL Server Manager Stoudo管理工具… Read More
  • 【GCP 】Region HTTP TO HTTPS Load Balance 設定方式(台灣)目的:在GCP上建立台灣版的HTTP轉HTTPS的負載平衡器步驟:1. 進入GCP Console2. 點選右上角的【啟用Cloud Shell】3. 點選右下角【開啟編輯器】4. 點選【File】➔【New File】 5. 貼上以下內容(相關名稱與domain請自行修改) kind: compute#urlMap name: example-http-to-https defaultUrlRedirect: redirectRespons… Read More
  • 【GCP】靜態網頁建置 GCP上除了使用VM架設Web Server建置靜態網頁外,另外也提供了其他方式可以不使用VM的情況下,將html檔案,放置在雲端儲存體內,透過相關設定,來建構靜態網頁網站,但相關流程較為複雜,但因為是Serverless的架構,因此穩定度會高很多。 在GCP Console下,透過下面六個步驟(範例域名:example.com.tw),即可建置一個靜態網站。 1. 新增一個example.com.tw名稱的buc… Read More

0 意見: