-
Notifications
You must be signed in to change notification settings - Fork 3
/
cfn_template
210 lines (199 loc) · 6.6 KB
/
cfn_template
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Create resources needed for the AWS Solution: SO9254'
Parameters:
ParameterVPCId:
Description: ID of the AWS Virtual Private Cloud (VPC)
Type: AWS::EC2::VPC::Id
ParameterSubnet1Id:
Description: SubnetId, for Availability Zone 1 in the region in your VPC
Type: AWS::EC2::Subnet::Id
ParameterSubnet2Id:
Description: SubnetId, for Availability Zone 2 in the region in your VPC
Type: AWS::EC2::Subnet::Id
HealthImagingImportRoleName:
Type: String
Default: HealthImagingImportJobRole
Description: This is an IAM role used by Amazon HealthImaging to import data. If you have an IAM role with the same name, please change this name.
HealthOmicsImportRoleName:
Type: String
Default: OmicsUnifiedJobRole
Description: This is an IAM role used by Amazon HealthOmics to import data. If you have an IAM role with the same name, please change this name.
CreateS3BucketforSageMaker:
Description: Do you want to create a S3 Bucket name like sagemaker-AWS::Region-AWS::AccountId
Type: String
Default: false
AllowedValues:
- true
- false
Conditions:
CreateS3Bucket: !Equals
- true
- !Ref 'CreateS3BucketforSageMaker'
Resources:
SageMakerBucket:
Condition: CreateS3Bucket
Type: AWS::S3::Bucket
Properties:
BucketName: !Sub sagemaker-${AWS::Region}-${AWS::AccountId}
VersioningConfiguration:
Status: Enabled
AccessControl: Private
PublicAccessBlockConfiguration:
BlockPublicAcls: TRUE
BlockPublicPolicy: TRUE
IgnorePublicAcls: TRUE
RestrictPublicBuckets: TRUE
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
SageMakerExecutionRole:
Type: "AWS::IAM::Role"
DependsOn: HealthImagingImportJobRole
Properties:
RoleName: SageMakerStudioExecutionRole
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- sagemaker.amazonaws.com
- omics.amazonaws.com
- medical-imaging.amazonaws.com
- states.amazonaws.com
- glue.amazonaws.com
- codepipeline.amazonaws.com
- codebuild.amazonaws.com
Action:
- "sts:AssumeRole"
Policies:
- PolicyName: S3andMedicalImaging
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- "s3:GetObject"
- "s3:PutObject"
- "s3:DeleteObject"
- "s3:ListBucket"
- "s3:GetEncryptionConfiguration"
Resource: "arn:aws:s3:::*"
- Effect: Allow
Action:
- "medical-imaging:CreateDatastore"
- "medical-imaging:Get*"
- "medical-imaging:List*"
- "medical-imaging:Update*"
- "medical-imaging:StartDICOMImportJob"
- "medical-imaging:DeleteDatastore"
- "medical-imaging:DeleteImageSet"
Resource: "*"
- Effect: Allow
Action:
- "iam:GetUser"
- "iam:GetPolicy"
- "iam:CreatePolicy"
- "iam:GetRole"
- "iam:CreateRole"
- "iam:AttachRolePolicy"
Resource: "*"
- Effect: Allow
Action:
- "glue:CreateCrawler"
- "glue:GetCrawler"
- "glue:StartCrawler"
- "glue:DeleteCrawler"
Resource: "*"
- Effect: "Allow"
Action:
- "iam:PassRole"
Resource:
- !GetAtt HealthImagingImportJobRole.Arn
- !GetAtt OmicsAccessRole.Arn
- !Sub arn:aws:iam::${AWS::AccountId}:role/SageMakerStudioExecutionRole
Path: /
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AmazonSageMakerFullAccess
- arn:aws:iam::aws:policy/AmazonHealthLakeFullAccess
- arn:aws:iam::aws:policy/AmazonOmicsFullAccess
- arn:aws:iam::aws:policy/AWSLakeFormationDataAdmin
- arn:aws:iam::aws:policy/AmazonAthenaFullAccess
HealthImagingImportJobRole:
Type: "AWS::IAM::Role"
Properties:
RoleName: !Ref HealthImagingImportRoleName
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- medical-imaging.amazonaws.com
Action:
- "sts:AssumeRole"
Policies:
- PolicyName: S3andMedicalImaging
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- "s3:GetObject"
- "s3:PutObject"
- "s3:DeleteObject"
- "s3:ListBucket"
- "s3:GetEncryptionConfiguration"
Resource: arn:aws:s3:::*
- Effect: Allow
Action:
- "medical-imaging:StartDICOMImportJob"
Resource: "*"
OmicsAccessRole:
Type: AWS::IAM::Role
Properties:
RoleName: !Ref HealthOmicsImportRoleName
AssumeRolePolicyDocument:
Statement:
- Action:
- sts:AssumeRole
Effect: Allow
Principal:
Service:
- omics.amazonaws.com
Version: '2012-10-17'
Path: /
Policies:
- PolicyName: s3-access
PolicyDocument:
Statement:
- Action:
- s3:GetObject
- s3:GetBucketLocation
- s3:ListBucket
- s3:Put*
Effect: Allow
Resource:
- arn:aws:s3:::*
- arn:aws:s3:::*/*
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AmazonOmicsFullAccess
WorkshopDomain:
Type: AWS::SageMaker::Domain
DependsOn: SageMakerExecutionRole
Properties:
AuthMode: IAM
DefaultUserSettings:
ExecutionRole: !GetAtt SageMakerExecutionRole.Arn
DomainName: "SageMakerStudioWorkshopDomain"
SubnetIds:
- !Ref ParameterSubnet1Id
- !Ref ParameterSubnet2Id
VpcId: !Ref ParameterVPCId
DefaultUser:
Type: AWS::SageMaker::UserProfile
Properties:
DomainId: !Ref WorkshopDomain
UserProfileName: sagemaker-user
DependsOn: WorkshopDomain