Installing AWS Cloud Search Command Line Tools

  In case you’re too lazy to dig into the full CloudSearch developer guide, here’s a quick summary of how to install the CloudSearch API command line tools on Linux:

  1. Ensure that you have a JRE/JDK installed.  Most distros will ship with something like OpenJDK, which is fine.  If you’d like, grab the “Oracle” JDK or JRockit (6+).
  2. Ensure that JAVA_HOMEis set in your environment.  You’ll probably want to make sure that something like the following is in your bash config:
    export JAVA_HOME=/opt/jre7
  3. Next, go download the actual Amazon CloudSearch command line tools from AWS Developer Tools.
  4. `tar xzf` and `mv` the cloud-search-tools-* directory into something like /opt/aws/cloud-search-tools.
  5. Add a CS_HOME environment variable that points at /opt/aws/cloud-search-tools.  Again, unless there’s a collision, you’ll probably want this in your bash config:
    export CS_HOME=/opt/aws/cloud-search-tools
  6. If you haven’t already done so, create an AWS_CREDENTIAL_FILEthat looks like this:
    accessKey=AKIAIOSFODNN7EXAMPLE
    secretKey=wJalrXUtnFEMI/K7MDENG/bPxRfiCYzEXAMPLEKEY

    You can always grab your credentials from the security credential page. You’ll need an environment variable to tell CS where to find this as well, so open up your bash config and add another line like this:

    export AWS_CREDENTIAL_FILE=/home/user/.ec2/credentials
  7. OK, assuming you’ve set your environment variables, you should be ready to go! Let’s test by creating a domain and checking the status:
    user@host:~$ /opt/aws/cloud-search-tools/bin/cs-create-domain -d domain-name
    ===========================================
    Creating domain [domain-name]
    Domain endpoints are currently being created. Use cs-describe-domain to check for endpoints.
    
    user@host:~$ /opt/aws/cloud-search-tools/bin/cs-describe-domain
    ======================
    Domain Name: domain-name (currently being activated).
    ======================
  8. Once the domain is created, you should see something like this:
    user@host:~$ /opt/aws/cloud-search-tools/bin/cs-describe-domain -d domain-name
    === Domain Summary ===
    Domain Name: domain-name
    Document Service endpoint: doc-domain-name-endpoint_id.us-east-1.cloudsearch.amazonaws.com
    Search Service endpoint: search-domain-name-endpoint_id.us-east-1.cloudsearch.amazonaws.com
    SearchInstanceType: search.m1.small
    SearchPartitionCount: 1
    SearchInstanceCount: 1
    Searchable Documents: 0
    Current configuration changes require a call to IndexDocuments: No
    ======================

Happy CloudSearching!