EasyManua.ls Logo

AWS Storage Gateway - Aws Cli; Linux (Bash;Zsh); Microsoft Windows Powershell

AWS Storage Gateway
438 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
AWS Storage Gateway User Guide
AWS CLI
ActivateGateway API action to specify the configuration of your gateway. The request you make to
the gateway VM contains the AWS 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.
Topics
AWS CLI (p. 363)
Linux (bash/zsh) (p. 363)
Microsoft Windows PowerShell (p. 363)
AWS CLI
If you haven't already done so, you must install and configure the AWS CLI. To do this, follow these
instructions in the AWS Command Line Interface User Guide:
Installing the AWS Command Line Interface
Configuring the AWS CLI
The following example shows you how to use the AWS 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 -i key | \
cut -d'=' -f2 |\
cut -d'&' -f1
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.
API Version 2013-06-30
363

Table of Contents