Solr can be run on Amazon's EC2.


/!\ :TODO: /!\ This page is a work in progress that will reflect how to run Solr 4.3 on AWS EC2 with screenshots when I am done. -MDB

Create an Instance

  1. Create an Amazon Web Services account. Amazon offers a free usage tier if you're just trying it out for the first time.

  2. Follow the Getting Started with Amazon EC2 Linux Instances guide to become familiar with EC2 instances, security groups, instance keys, and EBS volumes.

  3. Create a security group for Solr servers. It should allow access to ports 22 and 8983 for the IP you're working from, with routing prefix /32 (e.g., This will limit access to your current machine. If you want wider access to the instance available to collaborate with others, you can specify that, but make sure you only allow as much access as needed. A Solr instance should not be exposed to general Internet traffic. If you need help figuring out what your IP is, you can always use Please note that production security on AWS is a wide ranging topic and is beyond the scope of this tutorial.

  4. Create instance
    1. Click on Launch instance in the EC2 section of the AWS console.

Launch Instance

Classic Wizard

Choose AMI

Instance Type

Advanced Options

Edit Storage

EBS Volumes

Add Volume

  1. OK, we have the disks we want. Click Continue.


Name Instance

Create Keypair

Choose Security Group


Log In to Instance

OK, your instance should be coming up now. You can track the progress in the EC2 Console. When the state becomes Running, grab your server key and log in! First, grab the hostname from the detail view of the host. It will look something like With command line ssh, it looks something like:

ssh -i ~/.ssh/[KEYNAME.pem] ubuntu@[HOSTNAME]

So, for example,

ssh -i ~/.ssh/solr.pem

(This assumes you stored the key in your .ssh folder as previously mentioned.)

Windows users who don't have command line SSH set up can download PuTTY and import the key by following

If everything goes well, you should be greeted with a message welcoming you to Ubuntu and displaying some OS statistics. You're in!

EBS Setup

We attached an EBS volume to the host when we created it, but we didn't specify an image to use, so it came blank. That's easy to fix:

sudo apt-get -y install xfsprogs
sudo mkfs.xfs /dev/xvdc
sudo mkdir /ebs
sudo mount /dev/xvdc /ebs

Et voila, our ebs volume is formatted with XFS and is now available at the path /ebs. Notice that you don't need a password to run sudo.

Download Solr

We're going to install Solr right on the volume alongside the index. This will make it easy to migrate instance sizes by simply detaching the ebs volume and attaching to a new instance, or by taking a snapshot and restoring it elsewhere.

cd /ebs
curl -O
tar xf solr-4.3.0.tgz
  1. Launch Jetty
  2. Index some stuff

10. Dials to tweak

SolrOnAmazonEC2 (last edited 2013-06-12 00:39:24 by 173)