Prerequisites to Set Up a PC to Failback a Recovered Linux Machine from AWS
In order to failback a Linux machine you require the following software on the PC:
■ The Amazon EC2 CLI tools that you use to export the Linux machine from EC2. These tools are available from
Amazon EC2 CLI Tools.
■ Java version 1.7 or higher. Either the runtime environment, JRE, or developer environment, JDK, must be available. Java is available from the
Java web site.
You also require the following user variables definitions on the PC:
■ Define the following user variables:
■ JAVA_HOME
■ EC2_HOME
■ AWS_ACCESS_KEY
■ AWS_SECRET_KEY
The Amazon EC2 CLI tools use your access keys to identify you. There are two types of access keys: access key IDs, for example, AKIAIOSFODNN7EXAMPLE, and secret access keys, for example, wJalrXUtn+7xRfiCYEXAMPLEKEY.
You define these variables as follows:
a) Click Start, right-click Computer, and select Properties.
b) Select Advanced system settings.
c) Click Environment Variables.
d) Under User variables, click New.
e) In Variable name, type JAVA_HOME
f) In Variable value, type the path to your Java home, for example, C:\Program Files (x86)\Java\jre1.8.0_45
Don't include the bin folder in JAVA_HOME.
g) Click OK.
h) Repeat steps
d to
g for the other variables:
■ EC2_HOME, set the Variable name value to the path of the folder into which you saved the Amazon EC2 CLI tools, for example, C:\Tools\AWS Tools\ec2-api-tools-1.7.4.0
■ EC2_URL, set the Variable name value to the region in AWS where the instance to be failed back is located, for example, https://ec2.eu-west-1.amazonaws.com
■ AWS_ACCESS_KEY, set the Variable name value to the AWS access key ID.
■ AWS_SECRET_KEY, set the Variable name value to the AWS secret key.
i) Select the Path variable and click Edit and add the following to the beginning of the Variable value: ;%EC2_HOME%\bin;%JAVA_HOME%\bin
Add the bin folder that contains the Java executable to the path before other versions of Java.
j) Click OK and then click OK to exit the Environment Variable dialog.
k) Verify that the environment is set up correctly: Open a new Command Prompt window and enter the following:
■ C:\> java -version
Verifies the JAVA_HOME and path are set correctly. The output from the command should be similar to the following:
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b15)
Java HotSpot(TM) Client VM (build 24.45-b02, mixed mode, sharing)
■ C:\> dir "%EC2_HOME%"
Verifies the EC2_HOME and path are set correctly. The output from the command is the folder listing where you saved the Amazon EC2 CLI tools.
■ C:\> ec2-describe-regions
Verifies the EC2 environment variables are set correctly. The output from the command should be similar to the following:
REGION us-east-1 ec2.us-east-1.amazonaws.com
REGION eu-west-1 ec2.eu-west-1.amazonaws.com
REGION sa-east-1 ec2.sa-east-1.amazonaws.com
REGION ap-northeast-1 ec2.ap-northeast-1.amazonaws.com
REGION us-west-2 ec2.us-west-2.amazonaws.com
REGION us-west-1 ec2.us-west-1.amazonaws.com
REGION ap-southeast-1 ec2.ap-southeast-1.amazonaws.com
If you get an error that any of these commands are not recognized as an internal or external command, check the setting of Variable name and Variable value settings and the Path setting. Fix any errors, open a new Command Prompt window, and try the command again. If you get an error that the required option -O is missing, check the setting of AWS_ACCESS_KEY. If you get an error that the required option -W is missing, check the setting of AWS_SECRET_KEY. If you get a Client.AuthFailure error, check that you've entered your AWS_ACCESS_KEY and AWS_SECRET_KEY correctly, and check that the date and time are set correctly on your computer.
■ Define an S3 bucket for the failed back instance to store the exported instances. To create a bucket:
a) Sign into the AWS Management Console and open the Amazon S3 Management Console.
b) Click Create Bucket.
c) In the Create Bucket dialog box, enter a name for the bucket and select the region where you want the bucket to reside.
The name of the bucket must be unique across all existing bucket names in Amazon S3. The bucket name can contain lowercase letters, numbers, periods (.), and hyphens (-), must start with a number or letter and be between 3 and 63 characters long. The name cannot include underscores (_), two, adjacent periods or dashes next to periods and must not end with a hyphen.
d) Click Create.
e) Expand Permissions, and click Add more permissions.
f) In the new line, enter vm-import-export@amazon.com as the Grantee and check Upload/Delete and View Permissions.
g) Click Save.