Skip to main content

Posts

Curl command to check if file exists in s3 bucket

 Hello Techie's,  we can use below Shell script to check if particular file present in s3 bucket. # -------------------------------------------------------------------- #s3 Bucket Credentials #-------------------------------------------------------------------- s3_access_key=XXXXXXXXXXX s3_secret_key=XXXXXXXXXXX host=s3_bucket_api_url bucket=s3_bucket_name folder_name=name_of_the folder_in_bucket file_name=name_of_the_file_to_check #-------------------------------------------------------------------- #curl command variables #-------------------------------------------------------------------- dateValue=`date -R` contentType="application/xml" filepath="/${bucket}/${folder_name}/${file_name} signature_string="GET\n\${contentType}\n${dateValue}\n${filepath}" signature_hash=`echo -en ${signature_string} | openssl sha1 -hmac ${s3_secret_key} -binary | base64` #-------------------------------------------------------------------- #Curl command to check if file exi...
Recent posts

How to encrypt s3 bucket credentials using openssl in shellscript

  Hello Techie's   If someone reading your shell script and you have provided password variable without encyption, then the person reading that script can use password credentials for his own sake. In order overcome this, we need to encrypt the passwords so that person reading the script will not understand the password credentials. ------------------------------------------ Example s3 Bucket credentials: Bucket_name: Archived s3_access_key: abcdef s3_secret_key: ghijkl -- > Follow below steps to encrypt your bucket credentials. --------------------------------------------- Step 1:  we have create our common key to  encrypt access_key & secret_key of s3 bucket. --------------------------------------------- key: techie --------------------------------------------- Step 2: use below command to find base64 encryted format of your comman key and s3 bucket credentials. echo "techie" | base64 key=$(echo "dGVjaGllCg==" | base64 -d) echo "abcdef" |...

curl command to send file to aws s3 bucket

  Hello Techie's, Do you want to send file to AWS S3 Bucket using curl command ? Well, you are in the right place..! ‐‐--------------------------------------------------------------------- bucket= your Bucket name files_location=/home/test.tar.gz now_time=$(date +"%H%M%S") contentType="application/x-compressed-tar" dateValue=`date -R` # your key goes here.. S3Key= # your secrets goes here.. s3Secret= function pushToS3() {   files_path=$1   for file in $files_path   do     fname=$(basename $file)     logInfo "Start sending $fname to S3"     resource="/${bucket}/${now_date}/${fname}_${now_time}"     stringToSign="PUT\n\n${contentType}\n${dateValue}\n${resource}"     signature=`echo -en ${stringToSign} | openssl sha1 -hmac ${s3Secret} -binary | base64`     curl -X PUT -T "${file}" \      -H "Host: ${bucket}.s3.amazonaws.com" \      -H "Date: ${dateValue}" \      -H "...

RedHat OpenShift D280 Exam Preparation

  Hello Techie's,   Are you wondering what are all the questions will be asked in RedHat Openshift D280 Exam ? well, you are in the right place. Here you find the questions aswell as the answers, by following this you can clear the Exam like a piece of cake.   Step 1 -Inital Setup - SSH  user name & password for the workbench server will be given in the information. we need to login only to the workstation or workbench url. ssh root@workbench.lab.example.com Step 2 - Login to the Openshift cluster as Kubeadmin oc login -u kubeadmin -p xxxxxx api_server_connection_url password will be given in  cat /root/kubeadmin-password api server connection url - will be provided in the information window. ------------------------------------------------------------------------------------------- Question  : 1 Manage Identiy Providers: (secret name and identiy provider name will be given in the exam) ⁃    Create user bob with password indionce ⁃  ...