From 9caf05192829a98a3f27834089f267a28193c480 Mon Sep 17 00:00:00 2001 From: "Giuseppe A. Porcelli" Date: Wed, 12 Oct 2022 16:01:48 +0200 Subject: [PATCH] Enhanced install procedure. --- README.md | 109 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 63 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 8280e99..1441e48 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,9 @@ There are two ways to get started and install the solution in Amazon SageMaker: In both cases we are going to leverage on the following install scripts: - SageMaker Studio: [install-codeserver](install-scripts/studio/install-codeserver.sh) -- SageMaker Notebook Instances: [install-codeserver](install-scripts/notebook-instances/install-codeserver.sh) and [setup-codeserver](install-scripts/notebook-instances/setup-codeserver.sh) (install procedure is split in two sequential steps to better support lifecycle configurations - see next sections) +- SageMaker Notebook Instances: [install-codeserver](install-scripts/notebook-instances/install-codeserver.sh) and [setup-codeserver](install-scripts/notebook-instances/setup-codeserver.sh) (install procedure is split in two sequential steps to better support lifecycle configurations - see next sections). + +The install procedure is based on the latest stable release of the solution as of today. ### Install with Lifecycle Configurations @@ -59,32 +61,35 @@ When using Amazon SageMaker Studio, code-server must be installed on the instanc **Example: install code-server automatically for all users in the Studio domain** -1. Download the [install-codeserver](install-scripts/studio/install-codeserver.sh) script in a directory of choice. - -2. From a terminal appropriately configured with AWS CLI, run the following commands in the directory above: - - LCC_CONTENT=`openssl base64 -A -in install-codeserver.sh` - - aws sagemaker create-studio-lifecycle-config \ - --studio-lifecycle-config-name install-codeserver-on-jupyterserver \ - --studio-lifecycle-config-content $LCC_CONTENT \ - --studio-lifecycle-config-app-type JupyterServer \ - --query 'StudioLifecycleConfigArn' - - aws sagemaker update-domain \ - --region \ - --domain-id \ - --default-user-settings \ - '{ - "JupyterServerAppSettings": { - "DefaultResourceSpec": { - "LifecycleConfigArn": "arn:aws:sagemaker:::studio-lifecycle-config/install-codeserver-on-jupyterserver", - "InstanceType": "system" - }, - "LifecycleConfigArns": [ - "arn:aws:sagemaker:::studio-lifecycle-config/install-codeserver-on-jupyterserver" - ] - }}' +From a terminal appropriately configured with AWS CLI, run the following commands: + + curl -LO https://github.com/aws-samples/amazon-sagemaker-codeserver/releases/download/v0.1.5/amazon-sagemaker-codeserver-0.1.5.tar.gz + tar -xvzf amazon-sagemaker-codeserver-0.1.5.tar.gz + + cd amazon-sagemaker-codeserver/install-scripts/studio + + LCC_CONTENT=`openssl base64 -A -in install-codeserver.sh` + + aws sagemaker create-studio-lifecycle-config \ + --studio-lifecycle-config-name install-codeserver-on-jupyterserver \ + --studio-lifecycle-config-content $LCC_CONTENT \ + --studio-lifecycle-config-app-type JupyterServer \ + --query 'StudioLifecycleConfigArn' + + aws sagemaker update-domain \ + --region \ + --domain-id \ + --default-user-settings \ + '{ + "JupyterServerAppSettings": { + "DefaultResourceSpec": { + "LifecycleConfigArn": "arn:aws:sagemaker:::studio-lifecycle-config/install-codeserver-on-jupyterserver", + "InstanceType": "system" + }, + "LifecycleConfigArns": [ + "arn:aws:sagemaker:::studio-lifecycle-config/install-codeserver-on-jupyterserver" + ] + }}' Make sure to replace , and in the previous commands with the Studio domain ID, the AWS region and AWS Account ID you are using respectively. @@ -94,20 +99,23 @@ Amazon SageMaker Notebook Instances support lifecycle configuration scripts that **Example: Create a notebook instance and install code-server automatically** -1. Download the [install-codeserver](install-scripts/notebook-instances/install-codeserver.sh) and [setup-codeserver](install-scripts/notebook-instances/setup-codeserver.sh) scripts in a directory of choice. +From a terminal appropriately configured with AWS CLI, run the following commands: + + curl -LO https://github.com/aws-samples/amazon-sagemaker-codeserver/releases/download/v0.1.5/amazon-sagemaker-codeserver-0.1.5.tar.gz + tar -xvzf amazon-sagemaker-codeserver-0.1.5.tar.gz -2. From a terminal appropriately configured with AWS CLI, run the following commands in the directory above: + cd amazon-sagemaker-codeserver/install-scripts/notebook-instances - aws sagemaker create-notebook-instance-lifecycle-config \ - --notebook-instance-lifecycle-config-name install-codeserver \ - --on-start Content=$((cat setup-codeserver.sh || echo "")| base64) \ - --on-create Content=$((cat install-codeserver.sh || echo "")| base64) + aws sagemaker create-notebook-instance-lifecycle-config \ + --notebook-instance-lifecycle-config-name install-codeserver \ + --on-start Content=$((cat setup-codeserver.sh || echo "")| base64) \ + --on-create Content=$((cat install-codeserver.sh || echo "")| base64) - aws sagemaker create-notebook-instance \ - --notebook-instance-name \ - --instance-type \ - --role-arn \ - --lifecycle-config-name install-codeserver + aws sagemaker create-notebook-instance \ + --notebook-instance-name \ + --instance-type \ + --role-arn \ + --lifecycle-config-name install-codeserver Make sure to replace , and in the previous commands with the appropriate values. @@ -115,28 +123,37 @@ Make sure to replace , and