Skip to content

Commit 754b480

Browse files
authored
Notebook Instance Samples (#81)
This pull request contains samples for the Notebook Instance. Files added: README.md: Contains instructions on how to create/update/describe/delete a notebook instance. my-notebook-instance.yaml: Contains a sample yaml file that a user would use to create or update a notebook instance.
1 parent c85bee3 commit 754b480

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

samples/notebook_instance/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Notebook Instance Sample
2+
3+
## Prerequisites
4+
5+
This sample assumes that you have completed the [common prerequisites](/samples/README.md).
6+
7+
### Update the Notebook Instance Specification
8+
9+
Edit the roleARN value in my-notebook-instance.yaml to include the Sagemaker Execution permissions.
10+
11+
## Using the Notebook Instance controller
12+
13+
### Create a Notebook Instance
14+
15+
This command creates a Sagemaker notebook instance based on the specification provided in my-notebook-instance.yaml.
16+
The Notebook Instance will start at the Pending state and will transition into InService once ready.
17+
18+
```
19+
$ kubectl apply -f my-notebook-instance.yaml
20+
notebookinstance.sagemaker.services.k8s.aws/my-notebook-instance created
21+
```
22+
### Update a Notebook Instance
23+
This commands updates the Notebook Instance with the updated spec provided in my-notebook-instance.yaml. The update command retains the state the Notebook Instance was previously in. If the update command was called while the Notebook Instance was in the InService state, it will end up in the InService state after the update. If the update command was called while the Notebook Instance was in the Stopped/Stopping state, it will end up in the Stopped state after the update.
24+
Additionally this controller automatically takes care of setting the `Disassociate<field>` fields if the corresponding `<field>` field is removed from the spec and resource is updated. `<field>` in this case means the following fields: LifecycleConfigName, DefaultCodeRepository, AdditionalCodeRepositories, AcceleratorTypes.
25+
```
26+
$ kubectl apply -f my-notebook-instance.yaml
27+
notebookinstance.sagemaker.services.k8s.aws/my-notebook-instance configured
28+
```
29+
### Describe a Notebook Instance
30+
This command desribes a specific Notebook Instance, it is useful for checking items like the status, errors or parameters of the Notebook Instance.
31+
32+
Note: The status field Url returns a url in the form <name>.notebook.<region>.sagemaker.aws. To view the Jupyter Notebook in the browser, use https://<url>
33+
34+
```
35+
$ kubectl describe NotebookInstance <YOUR NOTEBOOK INSTANCE NAME>
36+
```
37+
### List Notebook Instances
38+
This command lists all the notebook instances created using the ACK controller.
39+
```
40+
$ kubectl get NotebookInstance
41+
```
42+
### Delete a Notebook Instance
43+
This command deletes the Notebook Instance.
44+
```
45+
$ kubectl delete NotebookInstance <YOUR NOTEBOOK INSTANCE NAME>
46+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: sagemaker.services.k8s.aws/v1alpha1
2+
kind: NotebookInstance
3+
metadata:
4+
name: <YOUR NOTEBOOK INSTANCE NAME>
5+
spec:
6+
instanceType: ml.t2.medium
7+
notebookInstanceName: <YOUR NOTEBOOK INSTANCE NAME>
8+
roleARN: <YOUR SAGEMAKER ROLE ARN>
9+
volumeSizeInGB: 6
10+
directInternetAccess: Enabled
11+
rootAccess: Enabled

0 commit comments

Comments
 (0)