|
1758 | 1758 | "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", |
1759 | 1759 | "* DynamoDB\n", |
1760 | 1760 | "* Amazon SageMaker\n", |
1761 | | - "* Kinesis Firehose\n", |
1762 | | - "\n", |
1763 | | - "![\\[AB Testing Pipeline X-Ray\\]](../docs/ab-testing-pipeline-xray.png)" |
| 1761 | + "* Kinesis Firehose" |
1764 | 1762 | ] |
1765 | 1763 | }, |
1766 | 1764 | { |
|
1769 | 1767 | "source": [ |
1770 | 1768 | "## Clean up\n", |
1771 | 1769 | "\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. " |
1776 | 1771 | ] |
1777 | 1772 | }, |
1778 | 1773 | { |
|
1781 | 1776 | "metadata": {}, |
1782 | 1777 | "outputs": [], |
1783 | 1778 | "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" |
1790 | 1781 | ] |
1791 | 1782 | }, |
1792 | 1783 | { |
1793 | 1784 | "cell_type": "markdown", |
1794 | 1785 | "metadata": {}, |
1795 | 1786 | "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." |
1799 | 1805 | ] |
1800 | 1806 | }, |
1801 | 1807 | { |
|
1804 | 1810 | "metadata": {}, |
1805 | 1811 | "outputs": [], |
1806 | 1812 | "source": [ |
1807 | | - "sm_client.delete_project(ProjectName=project_name)" |
| 1813 | + "!aws sagemaker delete-project --project-name $project_name" |
1808 | 1814 | ] |
1809 | 1815 | } |
1810 | 1816 | ], |
|
0 commit comments