Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Amazon ES service with IAM authentication #3446

Merged
merged 3 commits into from
Feb 17, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No title here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because the default would be Region.

},
'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
2 changes: 2 additions & 0 deletions redash/settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def all_settings():

return settings


REDIS_URL = os.environ.get('REDASH_REDIS_URL', os.environ.get('REDIS_URL', "redis://localhost:6379/0"))
PROXIES_COUNT = int(os.environ.get('REDASH_PROXIES_COUNT', "1"))

Expand Down Expand Up @@ -165,6 +166,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