-
Notifications
You must be signed in to change notification settings - Fork 0
/
5-cleanup.sh
executable file
·43 lines (37 loc) · 1.45 KB
/
5-cleanup.sh
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
#!/bin/bash
# set -eo pipefail
STACK=test-stack-saurabh
if [[ $# -eq 1 ]] ; then
STACK=$1
echo "Deleting stack $STACK"
fi
aws cloudformation delete-stack --stack-name $STACK
echo "Deleted $STACK stack."
# if [ -f bucket-name.txt ]; then
# ARTIFACT_BUCKET=$(cat bucket-name.txt)
# if [[ ! $ARTIFACT_BUCKET =~ lambda-artifacts-[a-z0-9]{16} ]] ; then
# echo "Bucket was not created by this application. Skipping."
# else
# while true; do
# read -p "Delete deployment artifacts and bucket ($ARTIFACT_BUCKET)? (y/n)" response
# case $response in
# [Yy]* ) aws s3 rb --force s3://$ARTIFACT_BUCKET; rm bucket-name.txt; break;;
# [Nn]* ) break;;
# * ) echo "Response must start with y or n.";;
# esac
# done
# fi
# fi
# FUNCTION=$(aws cloudformation describe-stack-resource --stack-name $STACK --logical-resource-id MyLambdaFunction --query 'StackResourceDetail.PhysicalResourceId' --output text)
# while true; do
# read -p "Delete function log group (/aws/lambda/$FUNCTION)? (y/n)" response
# case $response in
# [Yy]* )
# if ! output=$(aws logs delete-log-group --log-group-name /aws/lambda/$FUNCTION 2>&1); then
# echo "Failed to delete log group. Error: $output"
# fi
# break;;
# [Nn]* ) break;;
# * ) echo "Response must start with y or n.";;
# esac
# done