Skip to content

Fix: Enable neptune proxy custom sts endpoint #2086

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

Merged
merged 2 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions docs/tutorials/how-to-use-amundsen-with-aws-neptune.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,6 @@ The NeptuneConfig requires a few environment variables to be set these are:
* `AWS_REGION` - The AWS region where the Neptune instance is located.
* `S3_BUCKET_NAME`- The location where the proxy can upload S3 files for bulk uploader

In addition to the Config parameters above, the `IGNORE_NEPTUNE_SHARD` environment variable must be set to 'True'
if you are using the default databuilder integration.
In addition to the Config parameters above:
* `IGNORE_NEPTUNE_SHARD` environment variable must be set to 'True' if you are using the default databuilder integration.
* `STS_ENDPOINT` can also be set if the default endpoint does not work for your environment. For example: `https://sts.ap-southeast-1.amazonaws.com`. Refer to [AWS Documentation](https://docs.aws.amazon.com/general/latest/gr/sts.html) for a full list of STS endpoints.
3 changes: 2 additions & 1 deletion metadata/metadata_service/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ class NeptuneConfig(LocalGremlinConfig, LocalConfig):

PROXY_CLIENT_KWARGS = {
'neptune_bulk_loader_s3_bucket_name': os.environ.get('S3_BUCKET_NAME'),
'ignore_neptune_shard': distutils.util.strtobool(os.environ.get('IGNORE_NEPTUNE_SHARD', 'True'))
'ignore_neptune_shard': distutils.util.strtobool(os.environ.get('IGNORE_NEPTUNE_SHARD', 'True')),
'sts_endpoint': os.environ.get('STS_ENDPOINT')
}

JANUS_GRAPH_URL = None
Expand Down
6 changes: 5 additions & 1 deletion metadata/metadata_service/proxy/neptune_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,13 @@ def __init__(self, *, host: str, port: Optional[int] = None, user: str = None,
except Exception:
raise NotImplementedError(f'Cannot find s3 bucket name!')

# Get custom sts endpoint, default None
sts_endpoint = client_kwargs['sts_endpoint']

# Instantiate bulk loader and graph traversal factory
bulk_loader_config: Dict[str, Any] = dict(NEPTUNE_SESSION=password, NEPTUNE_URL=host,
NEPTUNE_BULK_LOADER_S3_BUCKET_NAME=s3_bucket_name)
NEPTUNE_BULK_LOADER_S3_BUCKET_NAME=s3_bucket_name,
STS_ENDPOINT=sts_endpoint)
self.neptune_bulk_loader_api = NeptuneBulkLoaderApi.create_from_config(bulk_loader_config)
self.neptune_graph_traversal_source_factory = get_neptune_graph_traversal_source_factory(session=password,
neptune_url=host)
Expand Down