Skip to content

Commit 3cadb76

Browse files
committed
Update notebook to use CLI to cleanup
1 parent 526bca1 commit 3cadb76

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

notebook/mab-reviews-helpfulness.ipynb

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,9 +1758,7 @@
17581758
"The API Lambda functions are instrumented with [AWS X-Ray](https://aws.amazon.com/xray/) so you can inspect the latency for all downstream services including\n",
17591759
"* DynamoDB\n",
17601760
"* Amazon SageMaker\n",
1761-
"* Kinesis Firehose\n",
1762-
"\n",
1763-
"![\\[AB Testing Pipeline X-Ray\\]](../docs/ab-testing-pipeline-xray.png)"
1761+
"* Kinesis Firehose"
17641762
]
17651763
},
17661764
{
@@ -1769,10 +1767,7 @@
17691767
"source": [
17701768
"## Clean up\n",
17711769
"\n",
1772-
"It is strongly recommended that you use CloudFormation to delete your SageMaker endpoint.\n",
1773-
"* `sagemaker-<<project_name>>-deploy-<<stage>>`\n",
1774-
"\n",
1775-
"Alternatively, you can delete the endpoint manually below."
1770+
"Start by deleting the AWS CloudFormation stack created to provision the SageMaker endpoint. "
17761771
]
17771772
},
17781773
{
@@ -1781,21 +1776,32 @@
17811776
"metadata": {},
17821777
"outputs": [],
17831778
"source": [
1784-
"endpoint_name = f'sagemaker-{project_name}-{stage_name}' \n",
1785-
"\n",
1786-
"print(f\"Deleting endpoint: {endpoint_name}...\")\n",
1787-
"sm_client.delete_endpoint(EndpointName=endpoint_name)\n",
1788-
"sm_client.get_waiter('endpoint_deleted').wait(EndpointName=endpoint_name)\n",
1789-
"print(\"Complete.\")"
1779+
"deploy_stack = f\"sagemaker-{project_name}-deploy-{stage_name}\"\n",
1780+
"!aws cloudformation delete-stack --stack-name $deploy_stack"
17901781
]
17911782
},
17921783
{
17931784
"cell_type": "markdown",
17941785
"metadata": {},
17951786
"source": [
1796-
"Then you can delete the project, which delete the AWS CloudFormation template that was used to create the A/B Testing deployment pipline.\n",
1797-
"\n",
1798-
"`NOTE`: You will need to ensure the S3 artifact bucket is empty before you are able to completely delete the project."
1787+
"Then empty the S3 bucket containing the artifacts output from the A/B Testing deployment pipeline."
1788+
]
1789+
},
1790+
{
1791+
"cell_type": "code",
1792+
"execution_count": null,
1793+
"metadata": {},
1794+
"outputs": [],
1795+
"source": [
1796+
"s3_artifact_path = f\"s3://sagemaker-{project_id}-artifact-{stage_name}-{region_name}\"\n",
1797+
"!aws s3 rm --recursive $s3_artifact_path"
1798+
]
1799+
},
1800+
{
1801+
"cell_type": "markdown",
1802+
"metadata": {},
1803+
"source": [
1804+
"Once complete, delete the project which removes the AWS CloudFormation stack that created the CodePipeline."
17991805
]
18001806
},
18011807
{
@@ -1804,7 +1810,7 @@
18041810
"metadata": {},
18051811
"outputs": [],
18061812
"source": [
1807-
"sm_client.delete_project(ProjectName=project_name)"
1813+
"!aws sagemaker delete-project --project-name $project_name"
18081814
]
18091815
}
18101816
],

0 commit comments

Comments
 (0)