Akarsha Sehwag ce1e2d8367
Add Workshop E2E (#253)
* feat: e2e tutorial lab5

* docs: Add README.md for 05-AgentCore Observability lab

* feat: Add Lab 6 of E2E tutorial

* fix: Fix Agent ECR repository typo

* docs: Update Lab 6 Guidelines

* feat: cleanup guardrails

* docs: fix step name

* added lab4

* Add Lab 3 Identity Notebook and README

* added memory and updated lab 1

* pushing all of the helper files from original use case. Remove as needed

* feat: update lab1 helper file

* chore: restructure utils

* feat: update memory helper

* chore: restructure identity

* chore: append to agent definition from the helper

* Renamed agentcore identity to lab6

* Renamed Gateway notebook to Lab 3 and reviewed with fixes

* Fixed typo in delete_memory

* Lab 1: review and minor fixes

* Lab 1: cleanup

* Lab 2: refactored

* fix: change model to Claude 3.7

* added TODOs

* updated lab1 notebook

* update runtime intro

* refactor utils file

* minor_update to memory

* memory return client

* revert change.

* feat: update runtime lab

* feat: add helper for bedrock guardrails

* fix: fix typos

* docs: minor update

* update lab1 tools

* update memory

* update - runtime

* updated lab3 + lambda

* removed outputs

* changed sh

* removed zip

* added one missing piece

* chore: rm observability old lab

* Updates to Lab6 Identity

* Updates to Lab6 Identity

* updated arch. diagram

* update docs lab1

* rename-lab-5-6

* update arch doc

* lab 03

* fixed lab 3 docs

* Fix Lab 4

* Lab 7 frontend

* Fix lab7

* Fix prereq issues and update gitignore

* adding lab 3 tool removal

* removed checkpoints

* merged

* chore: Update Lab 4 documentation

* fix: Update AgentCore IAM Role to access memory

* Lab 7 fixed invoke to runtime

* minor changes

* removed guardrails + minor edits

* Deleting files and folders.

* Rename, Refactor and deletion

Added sagemaker_helper

* fixing Client

* Removing guardrails code

* remove unused arch

* remove unused files

* updating lab01

* remove policies

* updating lab02

* docs: Update lab 4 markdown

* chore: Update Lab 4

* update cleanup

* cleaning up DS_Store files

* frontend

* updates to lab1 notebook

* updating architectures

* Lab5: fixed response formatting in streamlit app

* updating lab3

* updated lab3

* Lab 5 and Lab 6 and Helper Scripts Updates

Lab 5: Added the architecture diagram
Lab 6: Updated the notebook
Utils: Added helper functions
Sagemaker_helper: Cosmetic Updates

* Updating lab 4

* removing clean up from lab 3

* added lab3 changes

* Streamlit Fixes, Cosmetic Updates, Notebook Updates

* add maira's changes

* update lab2+3

* minor updates

* sync labs

* fix runtime docs

* refactoring end-to-end tutorials

* remove guardrail ss

---------

Co-authored-by: Aleksei Iancheruk <aianch@amazon.fr>
Co-authored-by: EugeneSel <youdjin.sel15@gmail.com>
Co-authored-by: Aidan Ricci <riaidan@amazon.com>
Co-authored-by: Achintya <pinnintiachintya@gmail.com>
Co-authored-by: naresh rajaram <nareshrd@amazon.com>
Co-authored-by: Lorenzo Micheli <lorenzo.micheli@gmail.com>
Co-authored-by: Achintya <apinnint@amazon.com>
Co-authored-by: HT <hardikvt@amazon.com>
Co-authored-by: HT <hardik.thakkar00@gmail.com>
Co-authored-by: Maira Ladeira Tanke <mttanke@amazon.com>
2025-08-14 22:52:33 -04:00

272 lines
7.4 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"id": "bc918d1b",
"metadata": {},
"source": [
"# 🧹 AgentCore End-to-End Cleanup\n",
"\n",
"This notebook provides a comprehensive cleanup process for all resources created during the AgentCore End-to-End tutorial.\n",
"\n",
"## Overview\n",
"\n",
"This cleanup process will remove:\n",
"- **Memory**: AgentCore Memory resources and stored data\n",
"- **Runtime**: Agent runtime instances and ECR repositories\n",
"- **Security**: Execution roles, and Authorization Provider resources\n",
"- **Observability**: CloudWatch log groups and streams\n",
"- **Local Files**: Generated configuration and code files\n",
"\n",
"⚠️ **Important**: This cleanup is irreversible. Make sure you have saved any important data (if needed) before proceeding.\n",
"\n",
"---"
]
},
{
"cell_type": "markdown",
"id": "imports_header",
"metadata": {},
"source": [
"## Step 1: Import Required Dependencies\n",
"\n",
"Load all necessary modules and helper functions for the cleanup process."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "imports",
"metadata": {},
"outputs": [],
"source": [
"import boto3\n",
"import os\n",
"from botocore.exceptions import ClientError\n",
"\n",
"from bedrock_agentcore_starter_toolkit import Runtime\n",
"from lab_helpers.lab2_memory import delete_memory, REGION\n",
"from lab_helpers.utils import (\n",
" delete_agentcore_runtime_execution_role,\n",
" delete_ssm_parameter,\n",
" cleanup_cognito_resources,\n",
" get_customer_support_secret,\n",
" delete_customer_support_secret,\n",
" agentcore_memory_cleanup,\n",
" gateway_target_cleanup,\n",
" runtime_resource_cleanup,\n",
" delete_observability_resources,\n",
" local_file_cleanup\n",
")\n",
"\n",
"print(\"✅ Dependencies imported successfully\")\n",
"print(f\"🌍 Working in region: {REGION}\")"
]
},
{
"cell_type": "markdown",
"id": "memory_header",
"metadata": {},
"source": [
"## Step 2: Clean Up Memory Resources\n",
"\n",
"Remove AgentCore Memory resources and associated data."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "16eda4ba",
"metadata": {},
"outputs": [],
"source": [
"print(\"🧠 Starting Memory cleanup...\")\n",
"agentcore_memory_cleanup()"
]
},
{
"cell_type": "markdown",
"id": "runtime_header",
"metadata": {},
"source": [
"## Step 3: Clean Up Runtime Resources\n",
"\n",
"Remove the AgentCore Runtime, ECR repository, and associated AWS resources."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "runtime_cleanup",
"metadata": {},
"outputs": [],
"source": [
"print(\"🚀 Starting Runtime cleanup...\")\n",
"runtime_resource_cleanup()"
]
},
{
"cell_type": "markdown",
"id": "794ea1ca-f684-4790-a027-f99883a9b3da",
"metadata": {},
"source": [
"## Step 4: Clean Up Gateway Resources\n",
"Remove targets, Gateway"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3b697bc6-69f6-47cc-866e-f6f42de0e2c4",
"metadata": {},
"outputs": [],
"source": [
"print(\"⚙️ Starting Gateway Cleanup...\")\n",
"gateway_target_cleanup()"
]
},
{
"cell_type": "markdown",
"id": "security_header",
"metadata": {},
"source": [
"## Step 5: Clean Up Security Resources\n",
"\n",
"Remove execution roles, and authentication resources."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "security_cleanup",
"metadata": {},
"outputs": [],
"source": [
"print(\"🛡️ Starting Security cleanup...\")\n",
"import json\n",
"try:\n",
" # bedrock_client = boto3.client(\"bedrock\", region_name=REGION)\n",
" \n",
" # Delete execution role\n",
" print(\" 🗑️ Deleting AgentCore Runtime execution role...\")\n",
" delete_agentcore_runtime_execution_role()\n",
" print(\" ✅ Execution role deleted\")\n",
" \n",
" # Delete SSM parameter\n",
" print(\" 🗑️ Deleting SSM parameter...\")\n",
" delete_ssm_parameter(\"/app/customersupport/agentcore/runtime_arn\")\n",
" print(\" ✅ SSM parameter deleted\")\n",
" \n",
" # Clean up Cognito and secrets\n",
" print(\" 🗑️ Cleaning up Cognito resources...\")\n",
" cs = json.loads(get_customer_support_secret())\n",
" cleanup_cognito_resources(cs['pool_id'])\n",
" print(\" ✅ Cognito resources cleaned up\")\n",
" \n",
" print(\" 🗑️ Deleting customer support secret...\")\n",
" delete_customer_support_secret()\n",
" print(\" ✅ Customer support secret deleted\")\n",
" \n",
"except Exception as e:\n",
" print(f\" ⚠️ Error during security cleanup: {e}\")"
]
},
{
"cell_type": "markdown",
"id": "files_header",
"metadata": {},
"source": [
"## Step 6: Clean Up Local Files\n",
"\n",
"Remove generated configuration and code files from the local directory."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "files_cleanup",
"metadata": {},
"outputs": [],
"source": [
"print(\"📁 Starting Local Files cleanup...\")\n",
"local_file_cleanup()\n"
]
},
{
"cell_type": "markdown",
"id": "observability_header",
"metadata": {},
"source": [
"## Step 7: Clean Up Observability Resources\n",
"\n",
"Remove CloudWatch log groups and streams used for agent monitoring."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7b7bc594",
"metadata": {},
"outputs": [],
"source": [
"print(\"📊 Starting Observability cleanup...\")\n",
"\n",
"delete_observability_resources()"
]
},
{
"cell_type": "markdown",
"id": "completion_header",
"metadata": {},
"source": [
"## 🎉 Cleanup Complete!\n",
"\n",
"All AgentCore resources have been cleaned up. Here's a summary of what was removed:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "completion_summary",
"metadata": {},
"outputs": [],
"source": [
"print(\"\\n\" + \"=\" * 60)\n",
"print(\"🧹 CLEANUP COMPLETED SUCCESSFULLY! 🧹\")\n",
"print(\"=\" * 60)\n",
"print()\n",
"print(\"📋 Resources cleaned up:\")\n",
"print(\" 🧠 Memory: AgentCore Memory resources and data\")\n",
"print(\" 🚀 Runtime: Agent runtime and ECR repository\")\n",
"print(\" 🛡️ Security: Roles, and SSM secrets\")\n",
"print(\" 📊 Observability: CloudWatch logs\")\n",
"print(\" 📁 Files: Local configuration files\")\n",
"print()\n",
"print(\"✨ Your AWS account is now clean and ready for new experiments!\")\n",
"print(\"\\nThank you for completing the AgentCore End-to-End tutorial! 🚀\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}