How To Install Google Chrome, Selenium & Chromedriver For AWS EC2 Instances

Cover Image for How To Install Google Chrome, Selenium & Chromedriver For AWS EC2 Instances
James Phoenix
James Phoenix

If you’re looking to use selenium and headless browsers on amazon web services (AWS) its essential that you install the relevant versions of selenium, ChromeDriver and Google Chrome to your EC2 instance. In this guide you’ll learn how to easily deploy and test a fully functional selenium python environment.

Install ChromeDriver

You will need to install ChromeDriver which allows you programmatic access to google chrome via the Webdriver API protocol.

cd /tmp/
sudo wget
sudo unzip
sudo mv chromedriver /usr/bin/chromedriver
chromedriver --version
  1. Navigating to the /tmp/ folder.
  2. Using wget to download chromedriver.
  3. Unzipping chromedriver.
  4. Moving chromedriver to the usr/bin folder.
  5. Inspecting the current version of chromedriver.

Install Google Chrome

Then you’ll need to download and install the Google Chrome binary for your EC2 instance.

sudo curl | bash
sudo mv /usr/bin/google-chrome-stable /usr/bin/google-chrome
google-chrome --version && which google-chrome
  1. Curl downloads the google-chrome binary.
  2. The google-chrome binary is then moved into usr/bin (by default linux expects your google chrome executable be within this directory.
  3. The google-chrome –version & which google-chrome commands allow you to view whether the installation was successful and the current version of chrome. Its’ worth double checking that your chromedriver and google chrome versions are the same version.

Installing Selenium

Now install selenium for python 3x with the following command:

pip3 install selenium --user

If you still need to setup pip3 on your EC2 instance, you can visit this post here.

Adding Arguments To Your Selenium ChromeDriver

From my initial testing, I would recommend adding all of the following arguments when initialising selenium in a production environment:

from import Options
from selenium import webdriver

options = Options()

driver = webdriver.Chrome(options=options)

Test Your Connection

I’ve created a python script that you can use to make sure everything is working correctly. Simply SSH into your EC2 instance, enter a python3 environment and run the following script:

from import Options
from selenium import webdriver

url = ''

options = Options()

driver = webdriver.Chrome(options=options)

# Navigate to

# Extract the top heading from
text = driver.find_element_by_class_name('h000-mktg').text


If the test was successful, you should have printed the top headline from which at this current time says: Built for developers


More Stories

Cover Image for What Are Webhooks? And How Do They Relate to Data Engineering?

What Are Webhooks? And How Do They Relate to Data Engineering?

Webhooks are a simple and powerful method for receiving real-time notifications when certain events occur. They enable a whole host of automated and interconnected applications. Broadly speaking, your apps can communicate via two main ways: polling and webhooks.  Polling is like going to a shop and asking for pizza – you have to ask whenever you want it. Webhooks are almost the…

James Phoenix
James Phoenix
Cover Image for What is an API? And How Do They Relate to Data Engineering?

What is an API? And How Do They Relate to Data Engineering?

An API, or Application Programming Interface, is a set of rules and protocols that allow different software systems to communicate with each other. Put simply, APIs define how software components should interact and allow developers to create new applications by leveraging existing functionality from other systems. Research shows that business investment in API has boomed in recent years, and significant API investment…

James Phoenix
James Phoenix