This repository is an example for using the Elasticsearch service in your cloud.gov applications
from using the elasticsearch56
service running on the medium-ha
and medium
plans to the
elasticsearch-aws
service running on the aws-elasticsearch-prod
and aws-elasticsearch-dev
plans powered by
AWS Elastisearch. The new AWS Elasticsearch services provides customers with access the Elasticsearch v7.4.
The following table has a comparison of the differences between the legacy and new AWS Elasticsearch.
Legacy Service | AWS Service | |
---|---|---|
Version | v5.6 | v7.4 |
Authentication | Basic Auth | Signed HTTP Requests |
Auth Credentials | username , password |
access_key , secret_key |
AWS Region | N/A | us-gov-west-1 |
- Versions
- For more information about the supported v7.4 functionality from Elasticsearch in the AWS implementation see the AWS developer guides and the Elasticsearch reference
- Authentication
- The AWS Elasticsearch implementation uses signed HTTP requests. You do not supply any
username
orpassword
credentials to the requests. You must generate a signature hash based on theaccess_key
andsecret_key
provided in the credentials. That signature hash is then appended to the request as a HTTP header. See the docs - The legacy service used basic authentication so you would add the
username
andpassword
credentials from the service to create the authorization token in a request (ie.curl --user <USERNAME>:<PASSWORD> -XPUT 'localhost:9200/idx'
)
- The AWS Elasticsearch implementation uses signed HTTP requests. You do not supply any
- AWS Region
- Only applicable to the new AWS Elasticsearch service, you will always be required to include the AWS region of
us-gov-west-1
when creating a signed HTTP request. It will always beus-gov-west-1
. You can see the region in the service'shost
anduri
credentials ie (search-cg-broker-fake-service-host.us-gov-west-1.es.amazonaws.com
)
- Only applicable to the new AWS Elasticsearch service, you will always be required to include the AWS region of
The following is a list of different language examples for connecting and using the updated Elasticsearch service offering which leverages AWS Elasticsearch.
The following example compares the difference between creating an elasticsearch instance between the old and new service offerings.
##
## The following examples are creating a development instance
##
### The old way
$ cf create-service elasticsearch56 medium dev-elastic-service
### The new way
$ cf create-service aws-elasticsearch BETA-es-dev dev-elastic-service
##
## The following examples are creating a production, high availability instance
##
### The old way
$ cf create-service elasticsearch56 medium-ha prod-elastic-service
### The new way
$ cf create-service aws-elasticsearch BETA-es-medium-ha prod-elastic-service
- See the ./python example for connecting, loading, and querying data using the Python language.
- What Is Amazon Elasticsearch Service?
- Signing HTTP Requests to Amazon Elasticsearch Service
- The cloud.gov aws-broker provides the underlying marketplace service
See CONTRIBUTING for additional information.
This project is in the worldwide public domain. As stated in CONTRIBUTING:
This project is in the public domain within the United States, and copyright and related rights in the work worldwide are waived through the CC0 1.0 Universal public domain dedication.
All contributions to this project will be released under the CC0 dedication. By submitting a pull request, you are agreeing to comply with this waiver of copyright interest.