Skip to content

Commit 45b9367

Browse files
committed
Minor update to default prefix
1 parent 2efd23b commit 45b9367

File tree

3 files changed

+31
-14
lines changed

3 files changed

+31
-14
lines changed

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,17 +133,26 @@ Then, click the **Add inline policy** link, switch to to the **JSON** tab, and p
133133
{
134134
"Effect": "Allow",
135135
"Action": [
136-
"iam:AttachRolePolicy",
137136
"iam:CreateRole",
138-
"iam:GetRole",
139-
"iam:PutRolePolicy",
140137
"iam:PassRole",
141-
"iam:DetachRolePolicy",
142-
"iam:DeleteRolePolicy",
143138
"iam:DeleteRole"
144139
],
145140
"Resource": "arn:aws:iam::*:role/ab-testing-api-*"
146141
},
142+
{
143+
"Effect": "Allow",
144+
"Action": [
145+
"iam:GetRole",
146+
"iam:AttachRolePolicy",
147+
"iam:PutRolePolicy",
148+
"iam:DetachRolePolicy",
149+
"iam:DeleteRolePolicy"
150+
],
151+
"Resource": [
152+
"arn:aws:iam::*:role/ab-testing-api-*",
153+
"arn:aws:iam::*:role/service-role/AmazonSageMakerServiceCatalogProductsLaunchRole"
154+
]
155+
},
147156
{
148157
"Effect": "Allow",
149158
"Action": [
@@ -181,7 +190,7 @@ Follow are a list of context values that are provided in the `cdk.json`, which c
181190
|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
182191
| `api_name` | The API Gateway Name | "ab-testing" |
183192
| `stage_name` | The stage namespace for resource and API Gateway path | "dev" |
184-
| `endpoint_prefix` | A prefix to filter Amazon SageMaker endpoints the API can invoke. | "" |
193+
| `endpoint_prefix` | A prefix to filter Amazon SageMaker endpoints the API can invoke. | "sagemaker-" |
185194
| `api_lambda_memory` | The [lambda memory](https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html) allocation for API endpoint. | 768 |
186195
| `api_lambda_timeout` | The lambda timeout for the API endpoint. | 10 |
187196
| `metrics_lambda_memory` | The [lambda memory](https://docs.aws.amazon.com/lambda/latest/dg/configuration-memory.html) allocated for metrics processing Lambda | 768 |
@@ -196,7 +205,7 @@ Follow are a list of context values that are provided in the `cdk.json`, which c
196205
Run the following command to deploy the API and testing infrastructure, optionally override context values.
197206

198207
```
199-
cdk deploy ab-testing-api -c endpoint_prefix=ab-testing-pipeline
208+
cdk deploy ab-testing-api -c endpoint_prefix=sagemaker-ab-testing-pipeline
200209
```
201210

202211
This stack will ask you to confirm any changes, and output the `ApiEndpoint` which you will provide to the A/B Testing sample notebook.

cdk.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"log_level": "INFO",
1212
"api_name": "ab-testing",
1313
"stage_name": "dev",
14-
"endpoint_prefix": "",
14+
"endpoint_prefix": "sagemaker-",
1515
"api_lambda_memory": 768,
1616
"api_lambda_timeout": 60,
1717
"metrics_lambda_memory": 768,

notebook/mab-reviews-helpfulness.ipynb

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@
380380
"\n",
381381
"# Create SageMaker client with up to 10 retries\n",
382382
"config = Config(retries={\"max_attempts\": 10, \"mode\": \"standard\"})\n",
383-
"sm_client = boto3.client('sagemaker')\n",
383+
"sm_client = boto3.client('sagemaker', config=config)\n",
384384
"\n",
385385
"# Get the project name\n",
386386
"response = sm_client.describe_project(ProjectName=project_name)\n",
@@ -666,7 +666,7 @@
666666
"source": [
667667
"### Track Lineage\n",
668668
"\n",
669-
"List lineage associated with the training job "
669+
"List lineage associated with the training job."
670670
]
671671
},
672672
{
@@ -712,6 +712,13 @@
712712
"associate_trial_component(training_job_arn, trial_name)"
713713
]
714714
},
715+
{
716+
"cell_type": "markdown",
717+
"metadata": {},
718+
"source": [
719+
"Then list the metrics for this experiment."
720+
]
721+
},
715722
{
716723
"cell_type": "code",
717724
"execution_count": null,
@@ -747,10 +754,11 @@
747754
"source": [
748755
"# list all packages and select the latest one\n",
749756
"packages = sm_client.list_model_packages(ModelPackageGroupName=champion_model_group,\n",
750-
" SortBy='CreationTime', SortOrder='Descending')['ModelPackageSummaryList']\n",
757+
" SortBy='CreationTime', SortOrder='Descending',\n",
758+
" MaxResults=1)['ModelPackageSummaryList']\n",
751759
"\n",
752-
"# Approve the top to models\n",
753-
"for package in packages[:2]:\n",
760+
"# Approve the top model\n",
761+
"for package in packages:\n",
754762
" latest_model_package_arn = package['ModelPackageArn']\n",
755763
" model_package_version = latest_model_package_arn.split('/')[-1]\n",
756764
" if package['ModelApprovalStatus'] == 'PendingManualApproval':\n",
@@ -1100,7 +1108,7 @@
11001108
"\n",
11011109
"### Invoke endpoint\n",
11021110
"\n",
1103-
"Ensure that our endpoint is in service. Set the stage_name here if not `dev`\n",
1111+
"Ensure that our endpoint is in service. Set the `stage_name` here if not `dev`\n",
11041112
"\n",
11051113
"👇👇👇"
11061114
]

0 commit comments

Comments
 (0)