Skip to content

Instantly share code, notes, and snippets.

@szczeles
Created March 14, 2019 13:08
Show Gist options
  • Save szczeles/52d7023e744ed244d6a2e540e98c605d to your computer and use it in GitHub Desktop.
Save szczeles/52d7023e744ed244d6a2e540e98c605d to your computer and use it in GitHub Desktop.
# Install OAuthenticator
sudo docker exec jupyterhub bash -c '/opt/conda/bin/pip install oauthenticator'
# Upgrade aws cli to enable access to secret manager
sudo pip install --upgrade awscli
# Configure jupyterhub to support OAuth
OAUTH_CLIENT_ID=`aws secretsmanager get-secret-value --secret-id oauth_client_id --region us-east-1 | jq -r .SecretString | head -c -1`
OAUTH_CLIENT_SECRET=`aws secretsmanager get-secret-value --secret-id oauth_client_secret --region us-east-1 | jq -r .SecretString | head -c -1`
aws s3 cp s3://de-bin/jupyterhub-emr/templates/jupyterhub_config.py - |
sed -e"s/__OAUTH_CLIENT_ID__/$OAUTH_CLIENT_ID/" |
sed -e"s/__OAUTH_CLIENT_SECRET__/$OAUTH_CLIENT_SECRET/" |
sudo tee /etc/jupyter/conf/jupyterhub_config.py 2> /dev/null
# Restatr JupyterHub to re-read updated configuration file
sudo docker restart jupyterhub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment