Here are detailed, step by step instructions, on how to install and setup your EC2 environment for testing with Selenium Grid
The current EC2 automation assumes a UNIX plaform (Mac OS X, Linux Solaris, BSD). Windows users can still use the Official EC2 Image for Selenium Grid 1.0 but the built-in automation is not likely to work.
Step 1: Acquire a Valid Amazon EC2 Account and Associated Credentials
Step 1a: Signup for Amazon Accounts(AWS and EC2)
-
Create an Amazon Web Service Account (AWS)
Go to http://www.amazon.com/aws and click on the
Sign up for AWS
link in the upper right.
Complete all the information required for Amazon AWS registration.
-
Create an Amazon Compute Cloud Account (EC2)
If you are not already logged into your AWS account, click on the following link and logging into your account.
http://www.amazon.com/aws
- Goto the bottom of your AWS home page and click on the link
Explore Our WebServices
- Navigate to the bottom of the page and click on the link
Amazon Elastic Compute Cloud (Amazon EC2)
- In the upper right corner, click on the link
Sign up for this Web Service
. You will need a
credit card for this service as it is a pay-for-use service.
Step 1b: Create Web Service Access Keys and X.509 Certificate
Go to http://www.amazon.com/aws and click on the
Sign up for AWS
link in the upper right.
Complete all the information required for Amazon AWS registration.
If you are not already logged into your AWS account, click on the following link and logging into your account. http://www.amazon.com/aws
- Goto the bottom of your AWS home page and click on the link
Explore Our WebServices
- Navigate to the bottom of the page and click on the link
Amazon Elastic Compute Cloud (Amazon EC2)
- In the upper right corner, click on the link
Sign up for this Web Service
. You will need a credit card for this service as it is a pay-for-use service.
Once your AWS account has been created and you have added the EC2 web service to your account navigate back to your AWS Home account.
If you are not already logged into your AWS account, click on the following link and logging into your account. http://www.amazon.com/aws
- In the upper right corner click on the link "Your Web Service Account" and select the option "AWS Access Identifiers"
- Navigate to the section "Access Key ID and Secret Access Key." On the right side of the page you will be able to see your Your Access Id Key and Your Secret Access Key (see image below)
- To generate your X.509 Certificate, scroll down to the next section and click on the link Create New
- Follow the directions for creating your new certificate and private key. At the end of the process download the private key and save it
- Download the certificate and save it
- In your home directory, create a directory ".ec2" and copy private key and the certificate to this directory. Make sure the content of this directory can only been seen by you, as any user that can access these files will be able to use your Amazon AWS account and add charges to your credit card.
- Retrieve your AWS Account Id. In the upper right corner click on the link "Your Web Service Account" and select the option "AWS Account Activity"
Step 2: Install and Configure Amazon EC2 API Command Line Tools
Step 2a: Verify That JDK 1.5 or Higher is Installed
The Amazon EC2 command line tools require either a JDK/JRE 1.5 or higher.
You can double-check what version you have installed on your computer
by openning a terminal window and
running java -version
The command output should indicate that a 1.5 version of the JDK is available. If not, update your JDK to 1.5
Step 2b: Download EC2 API Command Line Tools
Once your accounts have been created and your certificates have been download the link to EC2 Command Line Tools.
Extract the downloaded file on your computer. Please take note of the directory where the tools have been extracted, you are going to need this information in a second.
Setup your environment
Your must set the following environment variables:
EC2_HOME- Should point to the directory where you installed EC2 API tools (root location)
EC2_PRIVATE_KEY-
Should point to your EC2 private key file.
e.g.
export EC2_PRIVATE_KEY=/somewhere/pk-5CCEI7ODBPYGRXYOAZWGPVCG5LJ6HLGE.pem EC2_CERT-
Should point to your EC2 certificate file.
e.g.
export EC2_CERT=/somewhere/cert-5CCEI7ODBPYGRXYOAZWGPVCG5LJ6HLGE.pem EC2_KEYPAIR-
Should point to your EC2 keypair file.
e.g.
export EC2_KEYPAIR=/somewhere/id_rsa-gsg-keypair.pem EC2_KEYPAIR_NAME-
Should be the name of your EC2 keypair.
e.g.
export EC2_KEYPAIR_NAME=gsg-keypair
You must also add ${EC2_HOME}/bin to your PATH
Check Your Installation
At this point you should be able to successfully run the following commands:
$ ec2-version 1.2-13740 2007-08-29 $ ec2-describe-images -a | grep selenium-grid IMAGE ami-780fea11 selenium-grid-1.0/image.manifest.xml 069216575636 available public
Pay special attention to your EC2 private key, certificate, and the name of the keypair you generate.
Additional References
For more detail instructions or for trouble shooting, consult the EC2 Getting Started Guide for more information Once your AWS account has been created and you have added the 2 web services (S3 and EC2) to your account Amazon Elastic Compute Cloud Getting Started Guide
Installing Capistrano
You will need to install Capistrano to take advance of Selenium Grid EC2 automation.
On Ubuntu:
sudo apt-get install ruby rubygems
sudo gem install capistrano -y
On OS X 10.5 (Leopard):
sudo gem install capistrano -y
Installation for other platforms is documented on Capistrano website.
Install Selenium Grid
Install the latest Selenium Grid distribution if you haven't done it already.
You are now ready to run Selenium Grid Demo on EC2


