Skip to main content

Useful Scripts

Here is a list of some useful scripts to help with some day-to-day tasks:

Script Description
s3_delete.sh Use this script to delete s3 buckets that has many versions.
This script is needed when Terraform fails to delete s3 buckets because of some versions.
Use AWS vault to run this script.
Example: aws-vault exec <profile> -- s3_delete.sh bucket-name
rds_delete.sh Use this script to delete rds instances.
Use AWS vault to run this script.
Example: aws-vault exec <profile> -- rds_delete.sh rds-instance-name
AddSecret.sh Use this script to add secrets in AWS parameter store.
Use AWS vault to run this script.
Example:
aws-vault exec <profile> -- AddSecret.sh <environment> <name> <value>
AddSecureSecret.sh Use this script to add secure secrets in AWS parameter store.
Use AWS vault to run this script.
Example:
aws-vault exec <profile> -- AddSecureSecret.sh <environment> <name> <value>
query_cloudwatch_log.py Use this script to query VPC Flow Logs in Cloudwatch.
This is a quick script written in python that can query various fields in AWS VPC flow logs extracted from Cloudwatch. Cloudwatch doesnt support advanced querying where you will have to check src_ip against a known IP list. This scripts will allow you to load existing list of IPs from a CSV and match that against the src_ip in VPC Flow logs.‘ Steps: 1. Create a log export request to S3 using CloudWatch console.
  1. Download the logs from S3 using AWS CLI.
  2. Run the script on the log dir.
  3. Provide path for log dir.
  4. Provide allowed IP list path using file (CSV) path. |
This page was last reviewed on 12 April 2024. It needs to be reviewed again on 12 July 2024 by the page owner #nvvs-devops .
This page was set to be reviewed before 12 July 2024 by the page owner #nvvs-devops. This might mean the content is out of date.