Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Examples for migrating your cloud.gov applications to use AWS Elasticsearch services

License

Notifications You must be signed in to change notification settings

cloud-gov/aws-elasticsearch-example

Repository files navigation

aws-elasticsearch-example

About

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.

Major differences

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
  • Authentication
    • The AWS Elasticsearch implementation uses signed HTTP requests. You do not supply any username or passwordcredentials to the requests. You must generate a signature hash based on the access_key and secret_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 and password credentials from the service to create the authorization token in a request (ie. curl --user <USERNAME>:<PASSWORD> -XPUT 'localhost:9200/idx')
  • 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 be us-gov-west-1. You can see the region in the service's host and uri credentials ie (search-cg-broker-fake-service-host.us-gov-west-1.es.amazonaws.com)

Examples

The following is a list of different language examples for connecting and using the updated Elasticsearch service offering which leverages AWS Elasticsearch.

Creating an instance

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

Interacting with an instance

  • See the ./python example for connecting, loading, and querying data using the Python language.

Additional AWS Elasticsearch resources

Contributing

See CONTRIBUTING for additional information.

Public domain

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.

About

Examples for migrating your cloud.gov applications to use AWS Elasticsearch services

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published