Skip to content

DavidCardoso/utils-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Utilities via CLI

Playing with scripts.

Usage examples

Getting the list of AWS S3 buckets:

# It will create a '/tmp/utils-cli-bin-aws-s3-list-bucket-names.log' by default
./bin/aws-s3-list-bucket-names.sh

# Changing the output file
BUCKETS_LIST_FILE=output.txt ./bin/aws-s3-list-bucket-names.sh

# Filtering the output
BUCKET_NAME_FILTER='^some-prefix' ./bin/aws-s3-list-bucket-names.sh

Checking if a tag exists in an AWS S3 Bucket:

# Defaults to TAG_NAME=backup_tier TAG_VALUE=class_a BUCKETS_LIST_FILE=/tmp/utils-cli-bin-aws-s3-list-bucket-names.log
./bin/aws-s3-check-bucket-tag.sh
# Buckets with tag 'backup_tier=class_a':
# ❌ bucket-1
# ❌ another-bucket
# ✅ my-bucket-02

# Checking another tag
TAG_NAME=tag TAG_VALUE=value ./bin/aws-s3-check-bucket-tag.sh

# Using another file
BUCKETS_LIST_FILE=output.txt ./bin/aws-s3-check-bucket-tag.sh

Getting AWS S3 bucket details

BUCKET_NAME='bucket-name' ./bin/aws-s3-get-bucket-details.sh

Getting AWS S3 bucket lock config

BUCKET_NAME='bucket-name' ./bin/aws-s3-get-bucket-lock-config.sh

Getting AWS S3 object details

# Folders
BUCKET_NAME='bucket-name' OBJECT_KEY='my/folder/' ./bin/aws-s3-get-object-details.sh

# Files
BUCKET_NAME='bucket-name' OBJECT_KEY='my/folder/file.txt' ./bin/aws-s3-get-object-details.sh