-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsagemaker.tf
40 lines (32 loc) · 1.16 KB
/
sagemaker.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
resource "aws_iam_role" "sagemaker_jupyter_instance_role" {
name = "sbeacon_backend_sagemaker_jupyter_instance_role"
assume_role_policy = data.aws_iam_policy_document.sagemaker_jupyter_instance_policy.json
}
data "aws_iam_policy_document" "sagemaker_jupyter_instance_policy" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["sagemaker.amazonaws.com"]
}
}
}
resource "aws_sagemaker_notebook_instance_lifecycle_configuration" "sagemaker_jupyter_instance_lcc" {
name = "clone-gaspi-notebooks"
on_create = base64encode(
<<EOT
#!/bin/bash
sudo unlink /home/ec2-user/sample-notebooks
git clone --depth 1 https://github.com/GSI-Xapiens-CSIRO/GASPI-ETL-notebooks.git /home/ec2-user/GASPI-ETL-notebooks
sudo ln -s /home/ec2-user/GASPI-ETL-notebooks /home/ec2-user/sample-notebooks
EOT
)
on_start = base64encode(
<<EOT
#!/bin/bash
sudo unlink /home/ec2-user/sample-notebooks
git clone --depth 1 https://github.com/GSI-Xapiens-CSIRO/GASPI-ETL-notebooks.git /home/ec2-user/GASPI-ETL-notebooks
sudo ln -s /home/ec2-user/GASPI-ETL-notebooks /home/ec2-user/sample-notebooks
EOT
)
}