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:
- 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+).
- 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:
- Next, go download the actual Amazon CloudSearch command line tools from AWS Developer Tools.
- `tar xzf` and `mv` the cloud-search-tools-* directory into something like /opt/aws/cloud-search-tools.
- 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:
- If you haven’t already done so, create an AWS_CREDENTIAL_FILEthat looks like this:
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:
- 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). ======================
- 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 ======================
how do I use the commandline tool behind firewall (configure it to use proxy)?
While I have not done this, I would suggest two options:
1. Standard JRE HTTP proxy configuration using environment variables or `java` command line arguments – http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html
2. Using boto, a Python library for AWS services, which supports proxies via Python’s connection handlers – http://docs.pythonboto.org/en/latest/ref/cloudsearch.html
Thanks for responding. what are the right env variables? I tried setting
but it did not work for me.
OK, some Java applications do not behave well with proxies (I have seen similar issues with WebLogic). At this point, I would recommend exploring boto or requesting an exception on your corporate policies.