Getting an Activation Key for Your Gateway - Amazon Storage Gateway
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Amazon FSx File Gateway documentation has been moved to What is Amazon FSx File Gateway?

Volume Gateway documentation has been moved to What is Volume Gateway?

Tape Gateway documentation has been moved to What is Tape Gateway?

Getting an Activation Key for Your Gateway

To get an activation key for your gateway, you make a web request to the gateway VM and it returns a redirect that contains the activation key. This activation key is passed as one of the parameters to the ActivateGateway API action to specify the configuration of your gateway. For more information, see ActivateGateway in the Storage Gateway API Reference.

The request you make to the gateway VM contains the Amazon Region in which activation occurs. The URL returned by the redirect in the response contains a query string parameter called activationkey. This query string parameter is your activation key. The format of the query string looks like the following: http://gateway_ip_address/?activationRegion=activation_region.

The URL returned by the redirect also includes the following query string parameters:

  • gatewayType - The type of gateway that received the request

  • endpointType - The type of endpoint the gateway uses to connect to Amazon

  • vpcEndpoint - The VPC Endpoint ID for gateways that connect using the VPC endpoint type

Note

The Amazon Storage Gateway Hardware Appliance, VM image templates, and EC2 AMI come preconfigured with the HTTP services necessary to receive and respond to the web requests described on this page. It is not required or recommended to install any additional services on your gateway.

Amazon CLI

If you haven't already done so, you must install and configure the Amazon CLI. To do this, follow these instructions in the Amazon Command Line Interface User Guide:

The following example shows you how to use the Amazon CLI to fetch the HTTP response, parse HTTP headers and get the activation key.

wget 'ec2_instance_ip_address/?activationRegion=eu-west-2' 2>&1 | \ grep -i location | \ grep -oE 'activationKey=[A-Z0-9-]+' | \ pipe pipe pipe> cut -f2 -d=

Linux (curl)

The following examples show you how to get the activation key using Linux (curl).

Note

Replace the highlighted variables with actual values for your gateway. Acceptable values are as follows:

  • gateway_ip_address - The IPv4 address of your gateway, for example 172.31.29.201

  • gateway_type - The type of gateway you want to activate, such as STORED, CACHED, VTL, VTL_SNOW, FILE_S3, or FILE_FSX_SMB.

  • region_code - The region in which you want to activate your gateway. See Regional endpoints in the Amazon General Reference Guide.

  • vpc_endpoint - The VPC endpoint name for your gateway, for example vpce-050f90485f28f2fd0-iep0e8vq.storagegateway.us-west-2.vpce.amazonaws.com.

To get the activation key for a public endpoint:

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

To get the activation key for a VPC endpoint:

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

Linux (bash/zsh)

The following example shows you how to use Linux (bash/zsh) to fetch the HTTP response, parse HTTP headers, and get the activation key.

function get-activation-key() { local ip_address=$1 local activation_region=$2 if [[ -z "$ip_address" || -z "$activation_region" ]]; then echo "Usage: get-activation-key ip_address activation_region" return 1 fi if redirect_url=$(curl -f -s -S -w '%{redirect_url}' "http://$ip_address/?activationRegion=$activation_region"); 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

The following example shows you how to use Microsoft Windows PowerShell to fetch the HTTP response, parse HTTP headers, and get the activation key.

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