-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtemplate.yaml
62 lines (56 loc) · 2.39 KB
/
template.yaml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# deploy this template using the aws cli
# aws cloudformation create-stack --stack-name moontracer-$RANDOM --template-body file://template.yaml --capabilities CAPABILITY_NAMED_IAM
# list and delete all stacks whose name starts with "moontracer"
# aws cloudformation list-stacks --query "StackSummaries[?starts_with(StackName, 'moontracer')].StackName" --output text | xargs -I {} aws cloudformation delete-stack --stack-name {}
Description: "Moontracer Workshop Instance"
Parameters:
NotebookInstanceType:
Type: String
Default: ml.t3.medium
Description: Notebook instance size. AWS Free Tier includes 250 hours of ml.t3.medium instance on Studio notebooks OR 250 hours of ml.t2 medium instance or ml.t3.medium instance on notebook instances. Learn more at https://aws.amazon.com/free
Resources:
BasicNotebookInstanceLifecycleConfig:
Type: "AWS::SageMaker::NotebookInstanceLifecycleConfig"
Properties:
OnStart:
- Content:
Fn::Base64: !Sub |
pip install --upgrade pip &&
pip install AWSIoTPythonSDK numexpr pandas numpy matplotlib boto3 awscli sagemaker pickleshare
WorkshopRole:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Statement:
-
Action:
- "sts:AssumeRole"
Effect: Allow
Principal:
Service:
- sagemaker.amazonaws.com
Version: "2012-10-17"
Path: /
Policies:
-
PolicyDocument:
Statement:
-
Action: ["s3:*","sagemaker:*", "logs:*" ,"iam:PassRole"]
Effect: Allow
Resource: "*"
Version: "2012-10-17"
PolicyName: workshop-policy
WorkshopNotebookInstance:
Type: "AWS::SageMaker::NotebookInstance"
Properties:
InstanceType: !Ref NotebookInstanceType
LifecycleConfigName: !GetAtt BasicNotebookInstanceLifecycleConfig.NotebookInstanceLifecycleConfigName
RoleArn: !GetAtt WorkshopRole.Arn
AdditionalCodeRepositories:
- https://github.com/CaravanaCloud/moontracer-workshop.git
Outputs:
OpenInstanceLink:
Value: !Sub
- https://${NotebookInstanceName}.notebook.${AWS::Region}.sagemaker.aws/lab/tree/moontracer-workshop/index.ipynb
- { NotebookInstanceName: !GetAtt WorkshopNotebookInstance.NotebookInstanceName }