forked from awslabs/amazon-bedrock-agentcore-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup.sh
More file actions
executable file
·63 lines (53 loc) · 1.63 KB
/
cleanup.sh
File metadata and controls
executable file
·63 lines (53 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Cleanup script for Basic Agent Runtime CloudFormation stack
# This script deletes the CloudFormation stack and all associated resources
set -e
# Configuration
STACK_NAME="${1:-basic-agent-demo}"
REGION="${2:-us-west-2}"
echo "=========================================="
echo "Cleaning up Basic Agent Runtime"
echo "=========================================="
echo "Stack Name: $STACK_NAME"
echo "Region: $REGION"
echo "=========================================="
# Confirm deletion
read -p "Are you sure you want to delete the stack '$STACK_NAME'? (yes/no): " CONFIRM
if [ "$CONFIRM" != "yes" ]; then
echo "Cleanup cancelled."
exit 0
fi
echo ""
echo "Deleting CloudFormation stack..."
aws cloudformation delete-stack \
--stack-name "$STACK_NAME" \
--region "$REGION"
if [ $? -eq 0 ]; then
echo ""
echo "✓ Stack deletion initiated successfully!"
echo ""
echo "Waiting for stack deletion to complete..."
echo "This may take a few minutes..."
echo ""
aws cloudformation wait stack-delete-complete \
--stack-name "$STACK_NAME" \
--region "$REGION"
if [ $? -eq 0 ]; then
echo ""
echo "=========================================="
echo "✓ Stack deleted successfully!"
echo "=========================================="
echo ""
echo "All resources have been cleaned up."
echo ""
else
echo ""
echo "✗ Stack deletion failed or timed out"
echo "Check the CloudFormation console for details"
exit 1
fi
else
echo ""
echo "✗ Failed to initiate stack deletion"
exit 1
fi