@@ -4,6 +4,11 @@ echo ---------------------------------------------------------------------------
4
4
echo This script destroys the CDK stack
5
5
echo ---------------------------------------------------------------------------------------------
6
6
7
+ if [ -z " $AWS_REGION " ]; then
8
+ echo " Fatal: environment variable AWS_REGION not set. Aborting."
9
+ exit 1
10
+ fi
11
+
7
12
# Disable Contributor Insights
8
13
DDB_CONTRIB=$( aws ssm get-parameter --name ' /petstore/dynamodbtablename' | jq .Parameter.Value -r)
9
14
aws dynamodb update-contributor-insights --table-name $DDB_CONTRIB --contributor-insights-action DISABLE
@@ -24,21 +29,15 @@ aws eks update-kubeconfig --name PetSite
24
29
kubectl delete -f https://raw.githubusercontent.com/aws-samples/one-observability-demo/main/PetAdoptions/cdk/pet_stack/resources/load_balancer/crds.yaml
25
30
26
31
# Get rid of all resources (Application first, then cluster or it will fail)
27
- cdk destroy $STACK_NAME_APP $STACK_NAME --force
32
+ cdk destroy $STACK_NAME_APP --force
28
33
cdk destroy $STACK_NAME --force
29
34
30
35
# Sometimes the SqlSeeder doesn't get deleted cleanly. This helps clean up the environment completely including Sqlseeder
31
- aws cloudformation delete-stack --stack-name $STACK_NAME
32
36
aws cloudformation delete-stack --stack-name $STACK_NAME_APP
37
+ aws cloudformation delete-stack --stack-name $STACK_NAME
33
38
34
39
aws cloudwatch delete-dashboards --dashboard-names " EKS_FluentBit_Dashboard"
35
40
36
- # delete s3 buckets
37
- for b in $( aws s3 ls | awk ' /services-s3bucketpetadoption/ {print $3}' ) ; do
38
- echo " deleting ${b} "
39
- aws s3 rb s3://$b --force
40
- done
41
-
42
41
echo CDK BOOTSTRAP WAS NOT DELETED
43
42
44
43
echo ----- ✅ DONE --------
0 commit comments