EXPORT AWS_profile=albt_alb_dev;
aws s3 rm s3://albt-alb-prd-us-east-1-raw/albdev/Test/Folder1/ --recursive --exclude "" --profile $AWS_profile;
I have given hard-coded value for Bucket name and folder name. I need to parameterize the Bucket name and Folder name used in the above script. Can anyone guide how to achieve this?
Thanks!
CodePudding user response:
You can simply use parameters like this:
EXPORT AWS_profile=albt_alb_dev;
bucketName="albt-alb-prd-us-east-1-raw"
folderName="Folder1"
aws s3 rm s3://$bucketName/albdev/Test/$folderName/ --recursive --exclude "" --profile $AWS_profile;
Or You can pass the parameters to the script:
EXPORT AWS_profile=albt_alb_dev;
bucketName=$1 #first argument to the script
folderName=$2 #second argument to the script
aws s3 rm s3://$bucketName/albdev/Test/$folderName/ --recursive --exclude "" --profile $AWS_profile;
And call it like this:
./script.sh albt-alb-prd-us-east-1-raw Folder1
You can parametrize the whole path of course.