選取您的 Cookie 偏好設定

我們使用提供自身網站和服務所需的基本 Cookie 和類似工具。我們使用效能 Cookie 收集匿名統計資料,以便了解客戶如何使用我們的網站並進行改進。基本 Cookie 無法停用,但可以按一下「自訂」或「拒絕」以拒絕效能 Cookie。

如果您同意,AWS 與經核准的第三方也會使用 Cookie 提供實用的網站功能、記住您的偏好設定,並顯示相關內容,包括相關廣告。若要接受或拒絕所有非必要 Cookie,請按一下「接受」或「拒絕」。若要進行更詳細的選擇,請按一下「自訂」。

取得閘道的啟用金鑰

焦點模式
取得閘道的啟用金鑰 - AWS Storage Gateway

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

若要接收閘道的啟用金鑰,請向閘道虛擬機器 (VM) 發出網頁請求。虛擬機器會傳回包含啟用金鑰的重新導向,該重新導向會當做 ActivateGateway API 動作的其中一個參數傳遞,以指定閘道的組態。如需詳細資訊,請參閱 Storage Gateway API 參考資料中的 ActivateGateway

注意

如果未使用,閘道啟用金鑰會在 30 分鐘內過期。

您向閘道 VM 提出的請求包含啟動發生 AWS 的區域。重新導向在回應中傳回的 URL 會包含稱為 activationkey 的查詢字串參數。此查詢字串參數便是您的啟用金鑰。查詢字串的格式如下:http://gateway_ip_address/?activationRegion=activation_region。此查詢的輸出傳回啟用區域和金鑰。

此 URL 也包含 vpcEndpoint 使用 VPC 端點類型連線之閘道的 VPC 端點識別碼。

注意

Storage Gateway 硬體設備、虛擬機器映像範本和 Amazon EC2 Amazon 機器映像 (AMI) 已預先設定好接收和回應本頁所述的 Web 請求所需的 HTTP 服務。您不需要或建議您在閘道上安裝任何其他服務。

Linux (curl)

以下範例顯示如何使用 Linux (curl) 取得啟用金鑰。

注意

將反白顯示的變數取代為閘道的實際值。可接受的值如下:

  • gateway_ip_address:例如,閘道器的 IPV4 地址 172.31.29.201

  • gateway_type - 您要啟用的閘道類型,例如 STOREDCACHEDFILE_S3VTLFILE_FSX_SMB

  • region_code:您要啟用閘道的區域。請參閱《AWS 一般參考指南》中的區域端點。如果未指定此參數,或提供的值拼字錯誤或不符合有效區域,則命令會預設為us-east-1區域。

  • vpc_endpoint:例如,閘道的 VPC 端點名稱 vpce-050f90485f28f2fd0-iep0e8vq.storagegateway.us-west-2.vpce.amazonaws.com

若要取得公用端點的啟用金鑰:

curl "http://gateway_ip_address/?activationRegion=region_code&no_redirect"

若要取得 VPC 端點的啟用金鑰:

curl "http://gateway_ip_address/?activationRegion=region_code&vpcEndpoint=vpc_endpoint&no_redirect"

Linux (bash/zsh)

下列範例顯示如何使用 Linux (bash/zsh) 擷取 HTTP 回應、剖析 HTTP 標頭及取得啟用金鑰的方式。

function get-activation-key() { local ip_address=$1 local activation_region=$2 if [[ -z "$ip_address" || -z "$activation_region" || -z "$gateway_type" ]]; then echo "Usage: get-activation-key ip_address activation_region gateway_type" return 1 fi if redirect_url=$(curl -f -s -S -w '%{redirect_url}' "http://$ip_address/?activationRegion=$activation_region&gatewayType=$gateway_type"); then activation_key_param=$(echo "$redirect_url" | grep -oE 'activationKey=[A-Z0-9-]+') echo "$activation_key_param" | cut -f2 -d= else return 1 fi }

Microsoft Windows PowerShell

下列範例顯示如何使用 Microsoft Windows PowerShell 擷取 HTTP 回應、剖析 HTTP 標頭及取得啟用金鑰的方式。

function Get-ActivationKey { [CmdletBinding()] Param( [parameter(Mandatory=$true)][string]$IpAddress, [parameter(Mandatory=$true)][string]$ActivationRegion, [parameter(Mandatory=$true)][string]$GatewayType ) PROCESS { $request = Invoke-WebRequest -UseBasicParsing -Uri "http://$IpAddress/?activationRegion=$ActivationRegion&gatewayType=$GatewayType" -MaximumRedirection 0 -ErrorAction SilentlyContinue if ($request) { $activationKeyParam = $request.Headers.Location | Select-String -Pattern "activationKey=([A-Z0-9-]+)" $activationKeyParam.Matches.Value.Split("=")[1] } } }

使用本機主控台

以下範例顯示如何使用本機主控台產生並顯示啟用金鑰。

從本機主控台取得閘道的啟用金鑰
  1. 登入您的本機主控台。如果您是從 Windows 電腦連線到您的 Amazon EC2 執行個體,請以 admin 身分登入。

  2. 登入並查看 AWS 設備啟用 - 設定主功能表後,選取 0 以選擇取得啟用金鑰

  3. 為閘道系列選項選取 Storage Gateway

  4. 出現提示時,輸入您要啟用閘道 AWS 的區域。

  5. 輸入 1 公用端點或 2 VPC 端點做為網路類型。

  6. 輸入 1 標準或 2 美國聯邦資訊處理標準 (FIPS) 做為端點類型。

隱私權網站條款Cookie 偏好設定
© 2025, Amazon Web Services, Inc.或其附屬公司。保留所有權利。