本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
取得閘道的啟用金鑰
若要接收閘道的啟用金鑰,請向閘道虛擬機器 (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- 您要啟用的閘道類型,例如STORED、CACHED、FILE_S3、VTL或FILE_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"
雙堆疊端點
若要取得雙堆疊端點的啟用金鑰:
IPv4
curl "http://gateway_ip_address/?activationRegion&endpointType=DUALSTACK&ipVersion=ipv4&no_redirect"
IPv6
curl "http://gateway_ip_address/?activationRegion&endpointType=DUALSTACK&ipVersion=ipv6&no_redirect"
FIPS 端點
若要取得 FIPS 端點的啟用金鑰:
IPv4
curl "http://gateway_ip_address/?activationRegion&endpointType=FIPS_DUALSTACK&ipVersion=ipv4&no_redirect"
IPv6
curl "http://gateway_ip_address/?activationRegion&endpointType=FIPS_DUALSTACK&ipVersion=ipv6&no_redirect"
VPC 端點
若要取得 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] } } }
使用本機主控台
下列範例示範如何使用本機主控台來產生和顯示啟用金鑰。
Amazon Linux 2 (AL2) 型閘道
您可以根據 AL2 為閘道選取標準或 FIPS 端點。
注意
FIPS 端點並非全部可用 AWS 區域。如需詳細資訊,請參閱依服務分類的 FIPS 端點
從本機主控台取得 AL2-based閘道的啟用金鑰
-
以管理員身分登入您的本機主控台。
-
從AWS 設備啟用 - 組態主功能表中,選取
0以選擇取得啟用金鑰。 -
為閘道系列選項選取 Storage Gateway。
-
輸入您要啟用閘道 AWS 的區域。
-
針對網路類型,輸入
1表示公有,或輸入2表示 VPC。 -
對於端點類型,輸入
1表示標準,或輸入2表示聯邦資訊處理標準 (FIPS)。
Amazon Linux 2023 (AL2023) 型閘道
對於以 AL2023 為基礎的閘道,可使用下列端點:
-
標準端點 (僅支援 IPv4)
-
FIPS 端點 (僅支援 IPv4)
-
雙堆疊端點 (支援 IPv4 和 IPv6)
-
雙堆疊 FIPS 端點 (支援 IPv4 和 IPv6)
如需詳細資訊,請參閱端點類型。
從本機主控台取得 AL2023-based閘道的啟用金鑰
-
登入您的本機主控台。如果您是從 Windows 電腦連線到您的 Amazon EC2 執行個體,請以 admin 身分登入。
-
從AWS 設備啟用 - 組態主功能表中,選取
0以選擇取得啟用金鑰。 -
為閘道系列選項選取 Storage Gateway。
-
輸入您要啟用閘道 AWS 的區域。
-
對於網路類型,輸入
1表示公有,或輸入2表示 VPC 端點。 -
對於選取端點類型,啟用 FIPS?,輸入
Y以啟用 FIPSN或使用非 FIPS 端點。 -
對於端點類型,輸入
1表示標準端點,或輸入2表示雙堆疊端點。-
對於雙堆疊端點,對於選取 IP 版本或結束:,輸入
1表示 IPv4 或2表示 IPv6。
-