Skip to content

Commit

Permalink
Add support for Amazon ES service with IAM authentication (#3446)
Browse files Browse the repository at this point in the history
* Add support for Amazon ES service with IAM authentication

* Add required dependency.
  • Loading branch information
arikfr authored Feb 17, 2019
1 parent 81c9504 commit 60472e2
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
Binary file added client/app/assets/images/db-logos/aws_es.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions redash/query_runner/amazon_elasticsearch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
from .elasticsearch import ElasticSearch
from . import register

try:
from requests_aws4auth import AWS4Auth
enabled = True
except ImportError:
enabled = False


class AmazonElasticsearchService(ElasticSearch):
@classmethod
def name(cls):
return "Amazon Elasticsearch Service"

@classmethod
def enabled(cls):
return enabled

@classmethod
def type(cls):
return "aws_es"

@classmethod
def configuration_schema(cls):
return {
'type': 'object',
'properties': {
'server': {
'type': 'string',
'title': 'Endpoint'
},
'region': {
'type': 'string',
},
'access_key': {
'type': 'string',
'title': 'Access Key'
},
'secret_key': {
'type': 'string',
'title': 'Secret Key'
}
},
"secret": ["secret_key"],
"order": ["server", "region", "access_key", "secret_key"],
"required": ['server', 'region', 'access_key', 'secret_key']
}

def __init__(self, configuration):
super(AmazonElasticsearchService, self).__init__(configuration)

self.auth = AWS4Auth(configuration['access_key'], configuration['secret_key'], configuration['region'], 'es')


register(AmazonElasticsearchService)
1 change: 0 additions & 1 deletion redash/query_runner/elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def enabled(cls):

def __init__(self, configuration):
super(BaseElasticSearch, self).__init__(configuration)

self.syntax = "json"

if self.DEBUG_ENABLED:
Expand Down
1 change: 1 addition & 0 deletions redash/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def all_settings():
'redash.query_runner.url',
'redash.query_runner.influx_db',
'redash.query_runner.elasticsearch',
'redash.query_runner.amazon_elasticsearch',
'redash.query_runner.presto',
'redash.query_runner.databricks',
'redash.query_runner.hive_ds',
Expand Down
1 change: 1 addition & 0 deletions requirements_all_ds.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ pymapd>=0.2.1
qds-sdk>=1.9.6
ibm-db>=2.0.9
pydruid==0.4
requests-aws4auth==0.9
# certifi is needed to support MongoDB and SSL:
certifi
# We don't install snowflake connector by default, as it's causing conflicts with
Expand Down

0 comments on commit 60472e2

Please sign in to comment.