-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added scripts to delete ECR repository, user role and lambda function
from AWS
- Loading branch information
1 parent
6016ba0
commit 4717a48
Showing
7 changed files
with
51 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
# Get the current path | ||
THIS_DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) | ||
|
||
bash $THIS_DIR/delete_ecr_repository.sh | ||
bash $THIS_DIR/delete_lambda_function.sh | ||
bash $THIS_DIR/delete_lambda_user_role.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
aws ecr describe-repositories | grep '"repositoryArn": "$(image.ecr_arn_string)"' >/dev/null | ||
if [ $? -eq 0 ]; | ||
then | ||
aws ecr delete-repository \ | ||
--force \ | ||
--repository-name $(image.name) \ | ||
</dev/null | ||
echo "Deleted repository $(image.name)" | ||
else | ||
echo "Unable to delete repository $(image.name); does not exist" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
# Check if the lambda function exists | ||
aws lambda list-functions \ | ||
| grep '"FunctionArn": "$(image.function_arn_string)"' \ | ||
>/dev/null | ||
|
||
if [ $? -eq 0 ]; | ||
then | ||
echo "Found existing function; deleting it" | ||
aws lambda delete-function \ | ||
--function-name=$(lambda_function.name) >/dev/null | ||
else | ||
echo "Unable to delete function $(lambda_function.name); does not exist" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
# See if the role already exists | ||
aws iam list-roles | grep '"Arn": "$(aws.role_arn_string)"' >/dev/null | ||
if [ $? -eq 1 ]; | ||
then | ||
# It doesn't exist, so we can create it | ||
echo "Unable to delete User role $(aws.role); does not exist" | ||
else | ||
# The role does exist; delete it | ||
aws iam delete-role --role-name $(aws.role) | ||
echo "Deleted user role $(aws.role)" | ||
fi |
This file was deleted.
Oops, something went wrong.