Skip to content

Commit 2ebd835

Browse files
committed
import changes from GH
1 parent c64b571 commit 2ebd835

File tree

2 files changed

+60
-8
lines changed

2 files changed

+60
-8
lines changed
Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
echo ---------------------------------------------------------------------------------------------
4-
echo This script destroys the CDK stack
4+
echo This script destroys the resources created in the workshop
55
echo ---------------------------------------------------------------------------------------------
66

77
if [ -z "$AWS_REGION" ]; then
@@ -11,7 +11,7 @@ fi
1111

1212
# Disable Contributor Insights
1313
DDB_CONTRIB=$(aws ssm get-parameter --name '/petstore/dynamodbtablename' | jq .Parameter.Value -r)
14-
aws dynamodb update-contributor-insights --table-name $DDB_CONTRIB --contributor-insights-action DISABLE
14+
aws dynamodb update-contributor-insights --table-name $DDB_CONTRIB --contributor-insights-action DISABLE
1515

1616
echo STARTING SERVICES CLEANUP
1717
echo -----------------------------
@@ -22,25 +22,28 @@ STACK_NAME_APP=$(aws ssm get-parameter --name '/eks/petsite/stackname' --region
2222

2323
# Set default name in case Parameters are gone (partial deletion)
2424
if [ -z $STACK_NAME ]; then STACK_NAME="Services"; fi
25-
if [ -z $STACK_NAME_APP ]; then STACK_NAME_APP="Applications"; fi
25+
if [ -z $STACK_NAME_APP ]; then STACK_NAME_APP="Applications"; fi
26+
if [ -z $STACK_NAME_CODEPIPELINE ]; then STACK_NAME_CODEPIPELINE="Observability-Workshop"; fi
2627

2728
# Fix for CDK teardown issues
2829
aws eks update-kubeconfig --name PetSite
2930
kubectl delete -f https://raw.githubusercontent.com/aws-samples/one-observability-demo/main/PetAdoptions/cdk/pet_stack/resources/load_balancer/crds.yaml
3031

31-
#Deleting keycloak
32+
#Deleting keycloak
3233
kubectl delete namespace keycloak --force
3334

34-
# Get rid of all resources (Application first, then cluster or it will fail)
35-
cdk destroy $STACK_NAME_APP --force
36-
cdk destroy $STACK_NAME --force
37-
3835
# Sometimes the SqlSeeder doesn't get deleted cleanly. This helps clean up the environment completely including Sqlseeder
3936
aws cloudformation delete-stack --stack-name $STACK_NAME_APP
37+
aws cloudformation wait stack-delete-complete --stack-name $STACK_NAME_APP
4038
aws cloudformation delete-stack --stack-name $STACK_NAME
39+
aws cloudformation wait stack-delete-complete --stack-name $STACK_NAME
4140

4241
aws cloudwatch delete-dashboards --dashboard-names "EKS_FluentBit_Dashboard"
4342

43+
# delete the code pipeline stack
44+
aws cloudformation delete-stack --stack-name $STACK_NAME_CODEPIPELINE
45+
aws cloudformation wait stack-delete-complete --stack-name $STACK_NAME_CODEPIPELINE
46+
4447
echo CDK BOOTSTRAP WAS NOT DELETED
4548

4649
echo ----- ✅ DONE --------

setup-cloudshell.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/env bash
2+
3+
if [ -z "$AWS_REGION" ]; then
4+
echo "error: environment variable AWS_REGION not set. Aborting."
5+
exit 1
6+
fi
7+
8+
function install_helm(){
9+
echo "Installing helm"
10+
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
11+
chmod 700 get_helm.sh
12+
./get_helm.sh
13+
sudo mv $(which helm) $HOME/.local/bin/
14+
rm get_helm.sh
15+
}
16+
17+
function install_eksctl(){
18+
echo "Installing eksctl"
19+
ARCH=amd64
20+
PLATFORM=$(uname -s)_$ARCH
21+
curl -sLO "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_$PLATFORM.tar.gz"
22+
curl -sL "https://github.com/eksctl-io/eksctl/releases/latest/download/eksctl_checksums.txt" | grep $PLATFORM | sha256sum --check
23+
tar -xzf eksctl_$PLATFORM.tar.gz -C /tmp && rm eksctl_$PLATFORM.tar.gz
24+
sudo mv /tmp/eksctl $HOME/.local/bin/
25+
}
26+
27+
function install_awscurl(){
28+
echo "Installing awscurl"
29+
pip install awscurl
30+
}
31+
32+
mkdir -p $HOME/.local/bin
33+
cd /tmp
34+
35+
# install helm
36+
command -v helm >/dev/null 2>&1 ||
37+
{ install_helm; }
38+
39+
# install awscurl
40+
command -v awscurl >/dev/null 2>&1 ||
41+
{ install_awscurl; }
42+
43+
# install eksctl
44+
command -v eksctl >/dev/null 2>&1 ||
45+
{ install_eksctl; }
46+
47+
echo "All dependencies installed!"
48+
49+
cd -

0 commit comments

Comments
 (0)