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

Create a guide to setup access via SageMaker #38

Closed
nimrodkor opened this issue Nov 26, 2020 · 6 comments · Fixed by #58
Closed

Create a guide to setup access via SageMaker #38

nimrodkor opened this issue Nov 26, 2020 · 6 comments · Fixed by #58
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@nimrodkor
Copy link

Is your feature request related to a problem? Please describe.
I'd like to connect to a Neptune cluster. The easiest thing for me would be to launch a SageMaker notebook in that VPC and work on it. However, it seems like installing the extensions is not as straight-forward as a pip install.

Describe the solution you'd like
A guide on how to install all the required dependencies, via a lifecycle configuration if possible.

@austinkline austinkline added the documentation Improvements or additions to documentation label Nov 30, 2020
@austinkline
Copy link
Contributor

Thanks for submitting this ticket! This should just be a documentation change. Indeed, pip install is not sufficient since you also need to enable some things on the jupyter side, and we upload pip as a wheel which won't do those steps.

The recommended approach for Sagemaker would be to use our script found in s3:
s3://aws-neptune-notebook/graph_notebook.tar.gz

Here is a sample lifecycle configuration which makes use of it:

#!/bin/bash
 
sudo -u ec2-user -i <<'EOF'
 
echo "export GRAPH_NOTEBOOK_AUTH_MODE=DEFAULT" >> ~/.bashrc  # set to IAM instead of DEFAULT if cluster is IAM enabled
echo "export GRAPH_NOTEBOOK_HOST=CHANGE-ME" >> ~/.bashrc
echo "export GRAPH_NOTEBOOK_PORT=8182" >> ~/.bashrc
echo "export NEPTUNE_LOAD_FROM_S3_ROLE_ARN=" >> ~/.bashrc
echo "export AWS_REGION=us-west-2" >> ~/.bashrc
 
aws s3 cp s3://aws-neptune-notebook/graph_notebook.tar.gz /tmp/graph_notebook.tar.gz
rm -rf /tmp/graph_notebook
tar -zxvf /tmp/graph_notebook.tar.gz -C /tmp
/tmp/graph_notebook/install.sh
 
EOF

@joywa joywa self-assigned this Dec 9, 2020
@joywa joywa mentioned this issue Jan 15, 2021
@joywa joywa linked a pull request Jan 15, 2021 that will close this issue
@joywa
Copy link
Contributor

joywa commented Jan 15, 2021

Updated docs to share sample lifecycle configuration file for use with SageMaker: https://github.com/aws/graph-notebook/tree/main/additional-databases/sagemaker

@joywa joywa closed this as completed Jan 15, 2021
@rossjohnstone-paypay
Copy link

Hi @joywa (if you're still there) or anyone else. Is it necessary to generate the graph config in the lifecycle script?

Are these lines

/home/ec2-user/anaconda3/envs/JupyterSystemEnv/bin/python -m graph_notebook.configuration.generate_config \
--host "${HOST}" \
--port "${PORT}" \
--neptune_service "${SERVICE}" \
--auth_mode "${AUTH_MODE}" \
--ssl "${SSL}" \
--load_from_s3_arn "${LOAD_FROM_S3_ARN}" \
--aws_region "${AWS_REGION}"

equivalent to running, for example, this in a notebook cell?:

%%graph_notebook_config
{
  "host": "your-neptune-endpoint",
  "neptune_service": "neptune-graph",
  "port": 443,
  "auth_mode": "IAM",
  "ssl": true,
  "ssl_verify": true,
  "aws_region": "your-neptune-region"
}

I would prefer not to hard-code my (Neptune Analytics) graph into the lifecycle configuration script, since I expect to delete the graph after using the notebook.

@michaelnchin
Copy link
Member

@rossjohnstone-paypay yes, you certainly can use %%graph_notebook_config to manually set the connection configuration after the notebook is created. If generate_config is not run as part of the lifecycle, the initial configuration will be populated with placeholder values, which can be overridden.

@rossjohnstone-paypay
Copy link

Hi @michaelnchin thanks. Would you be able to share a version of the lifecycle configuration script for use in JupyterLab within SageMaker Studio?

I tried simply executing the commands here but I'm not sure if I'm enabling the extensions within the correct instance of JupyterLab.

@michaelnchin
Copy link
Member

@rossjohnstone-paypay I believe SageMaker Studio uses JupyterLab 4 - graph-notebook currently supports up to JupyterLab 3, so it would not be compatible at the moment.

Related issue: #689

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants