@@ -144,7 +144,7 @@ To work around this, run the following command:
144
144
145
145
::
146
146
147
- aws eks describe-cluster --query cluster --name ${CLUSTER_NAME} --output text | grep OIDC
147
+ aws eks describe-cluster --region ${AWS_REGION} -- query cluster --name ${CLUSTER_NAME} --output text | grep OIDC
148
148
149
149
The OIDC URL will be returned as follows:
150
150
@@ -179,13 +179,37 @@ relationship code block into it. Be sure to replace all ``<OIDC ID>``, ``<AWS ac
179
179
]
180
180
}
181
181
182
+ If you're using the Amazon SageMaker Operators in China, create a file named ``trust.json `` and insert the following trust
183
+ relationship code block into it instead. Be sure to replace all ``<OIDC ID> ``, ``<AWS account number> ``, and ``<EKS Cluster region> `` placeholders with values corresponding to your cluster.
184
+
185
+ ::
186
+
187
+ {
188
+ "Version": "2012-10-17",
189
+ "Statement": [
190
+ {
191
+ "Effect": "Allow",
192
+ "Principal": {
193
+ "Federated": "arn:aws-cn:iam::<AWS account number>:oidc-provider/oidc.eks.<EKS Cluster region>.amazonaws.com/id/<OIDC ID>"
194
+ },
195
+ "Action": "sts:AssumeRoleWithWebIdentity",
196
+ "Condition": {
197
+ "StringEquals": {
198
+ "oidc.eks.<EKS Cluster region>.amazonaws.com/id/<OIDC ID>:aud": "sts.amazonaws.com",
199
+ "oidc.eks.<EKS Cluster region>.amazonaws.com/id/<OIDC ID>:sub": "system:serviceaccount:sagemaker-k8s-operator-system:sagemaker-k8s-operator-default"
200
+ }
201
+ }
202
+ }
203
+ ]
204
+ }
205
+
182
206
Run the following command to create a role with the trust
183
207
relationship defined in ``trust.json ``. This role enables the
184
208
Amazon EKS cluster to get and refresh credentials from IAM.
185
209
186
210
::
187
211
188
- aws iam create-role --role-name <role name> --assume-role-policy-document file://trust.json --output=text
212
+ aws iam create-role --region ${AWS_REGION} -- role-name <role name> --assume-role-policy-document file://trust.json --output=text
189
213
190
214
Your output should look like the following:
191
215
@@ -214,6 +238,12 @@ To attach AmazonSageMakerFullAccess, run the following command:
214
238
215
239
aws iam attach-role-policy --role-name <role name> --policy-arn arn:aws:iam::aws:policy/AmazonSageMakerFullAccess
216
240
241
+ If you're using the Amazon SageMaker Operators in China, attach the following policy instead:
242
+
243
+ ::
244
+
245
+ aws iam attach-role-policy --region ${AWS_REGION} --role-name <role name> --policy-arn arn:aws-cn:iam::aws:policy/AmazonSageMakerFullAccess
246
+
217
247
The Kubernetes
218
248
ServiceAccount ``sagemaker-k8s-operator-default `` should
219
249
have ``AmazonSageMakerFullAccess `` permissions. Confirm this when you
@@ -237,6 +267,12 @@ follows:
237
267
238
268
wget https://raw.githubusercontent.com/aws/amazon-sagemaker-operator-for-k8s/master/release/rolebased/installer.yaml
239
269
270
+ If you're using the Amazon SageMaker Operators in China, download the following installer script instead. Whenever ``installer.yaml `` is referenced, use ``installer_china.yaml `` instead.
271
+
272
+ ::
273
+
274
+ wget https://raw.githubusercontent.com/aws/amazon-sagemaker-operator-for-k8s/master/release/rolebased/china/installer_china.yaml
275
+
240
276
- Edit the ``installer.yaml `` file to
241
277
replace ``eks.amazonaws.com/role-arn ``. Replace the ARN here with
242
278
the Amazon Resource Name (ARN) for the OIDC-based role you’ve created.
@@ -405,7 +441,7 @@ To work around this, run the following command:
405
441
406
442
::
407
443
408
- aws eks describe-cluster --query cluster --name ${CLUSTER_NAME} --output text | grep OIDC
444
+ aws eks describe-cluster --region ${AWS_REGION} -- query cluster --name ${CLUSTER_NAME} --output text | grep OIDC
409
445
410
446
The OIDC URL will be returned as follows:
411
447
@@ -440,13 +476,37 @@ relationship code block into it. Be sure to replace all ``<OIDC ID>``, ``<AWS ac
440
476
]
441
477
}
442
478
479
+ If you're using the Amazon SageMaker Operators in China, create a file named ``trust.json `` and insert the following trust
480
+ relationship code block into it instead. Be sure to replace all ``<OIDC ID> ``, ``<AWS account number> ``, and ``<EKS Cluster region> `` placeholders with values corresponding to your cluster.
481
+
482
+ ::
483
+
484
+ {
485
+ "Version": "2012-10-17",
486
+ "Statement": [
487
+ {
488
+ "Effect": "Allow",
489
+ "Principal": {
490
+ "Federated": "arn:aws-cn:iam::<AWS account number>:oidc-provider/oidc.eks.<EKS Cluster region>.amazonaws.com/id/<OIDC ID>"
491
+ },
492
+ "Action": "sts:AssumeRoleWithWebIdentity",
493
+ "Condition": {
494
+ "StringEquals": {
495
+ "oidc.eks.<EKS Cluster region>.amazonaws.com/id/<OIDC ID>:aud": "sts.amazonaws.com",
496
+ "oidc.eks.<EKS Cluster region>.amazonaws.com/id/<OIDC ID>:sub": "system:serviceaccount:<Namespace>:sagemaker-k8s-operator-default"
497
+ }
498
+ }
499
+ }
500
+ ]
501
+ }
502
+
443
503
Run the following command to create a role with the trust
444
504
relationship defined in ``trust.json ``. This role enables the
445
505
Amazon EKS cluster to get and refresh credentials from IAM.
446
506
447
507
::
448
508
449
- aws iam create-role --role-name <role name> --assume-role-policy-document file://trust.json --output=text
509
+ aws iam create-role --region ${AWS_REGION} -- role-name <role name> --assume-role-policy-document file://trust.json --output=text
450
510
451
511
Your output should look like the following:
452
512
@@ -475,6 +535,12 @@ To attach AmazonSageMakerFullAccess, run the following command:
475
535
476
536
aws iam attach-role-policy --role-name <role name> --policy-arn arn:aws:iam::aws:policy/AmazonSageMakerFullAccess
477
537
538
+ If you're using the Amazon SageMaker Operators in China, attach the following policy instead:
539
+
540
+ ::
541
+
542
+ aws iam attach-role-policy --region ${AWS_REGION} --role-name <role name> --policy-arn arn:aws-cn:iam::aws:policy/AmazonSageMakerFullAccess
543
+
478
544
The Kubernetes
479
545
ServiceAccount ``sagemaker-k8s-operator-default `` should
480
546
have ``AmazonSageMakerFullAccess `` permissions. Confirm this when you
@@ -505,6 +571,12 @@ To install the operator onto the cluster:
505
571
506
572
wget https://raw.githubusercontent.com/aws/amazon-sagemaker-operator-for-k8s/master/release/rolebased/namespaced/operator.yaml
507
573
574
+ If you're using the Amazon SageMaker Operators in China, download the following operator script instead. Whenever ``operator.yaml `` is referenced, use ``operator_china.yaml `` instead.
575
+
576
+ ::
577
+
578
+ wget https://raw.githubusercontent.com/aws/amazon-sagemaker-operator-for-k8s/master/release/rolebased/namespaced/china/operator_china.yaml
579
+
508
580
- Update the installer YAML to place the resources into your specified namespace using the following command:
509
581
510
582
::
0 commit comments