forked from santanu-dey/connect-personalize-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
personalize-training-notebook.yaml
108 lines (99 loc) · 3.2 KB
/
personalize-training-notebook.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
AWSTemplateFormatVersion: "2010-09-09"
Description: "Create Amazon Personalize resources for Customer Intent Prediction Blog Article"
Parameters:
ResourceBucket:
Type: String
Description: S3Bucket Bucket where the Resources are stored (CloudFormation, data files, Lambda code)
PersonalizeResourceBucketRelativePath:
Type: String
Description: S3Bucket path for personalize source code. S3 key that ends with the filename
Resources:
CustomPersonalizeServiceRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Principal:
Service:
- "sagemaker.amazonaws.com"
Action:
- "sts:AssumeRole"
-
Effect: "Allow"
Principal:
Service:
- "personalize.amazonaws.com"
Action:
- "sts:AssumeRole"
Path: "/service-role/"
Policies:
-
PolicyName: "PersonalizeUserPolicy"
PolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Action:
- codecommit:*
Resource: !Sub "arn:aws:codecommit:${AWS::Region}:${AWS::AccountId}:personalize*"
-
Effect: Allow
Action:
- personalize:*
Resource: "*"
-
Effect: Allow
Action:
- cloudwatch:PutMetricData
- cloudwatch:ListMetrics
Resource: "*"
-
Effect: Allow
Action:
- s3:GetObject
- s3:PutObject
- s3:DeleteObject
- s3:DeleteBucket
- s3:CreateBucket
- s3:ListBucket
- s3:PutBucketPolicy
Resource:
- "arn:aws:s3:::*Personalize*"
- "arn:aws:s3:::*personalize*"
-
Effect: Allow
Action: "iam:PassRole"
Resource: "*"
Condition:
StringEquals:
"iam:PassedToService": personalize.amazonaws.com
-
Effect: Allow
Action: "iam:GetRole"
Resource: "*"
Coderepo:
Type: AWS::CodeCommit::Repository
Properties:
RepositoryName: personalize-connect-demo-repo
RepositoryDescription: CodeCommit Repo for the personalize demo notebook
Code:
S3:
Bucket: !Ref ResourceBucket
Key: !Ref PersonalizeResourceBucketRelativePath
NotebookInstance:
Type: AWS::SageMaker::NotebookInstance
Properties:
NotebookInstanceName: personalize-connect-demo-notebook
InstanceType: "ml.t2.medium"
RoleArn: !GetAtt CustomPersonalizeServiceRole.Arn
DefaultCodeRepository: !GetAtt Coderepo.CloneUrlHttp
Outputs:
NotebookInstanceId:
Value: !Ref NotebookInstance
PersonalizeRoleARN:
Value: !GetAtt CustomPersonalizeServiceRole.Arn