Advertisement
nexus2204

bashS3

Jun 22nd, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.12 KB | None | 0 0
  1. #autor: Barrios J Manu
  2. #Desc: Sube cosas a un bucket publico S3
  3. #upload image
  4. wget https://mediarouting.vestahub.com/Media/94703548/box/270x406 > header.txt
  5. mv 270x406 270x406.jpg
  6. date='date +%Y%m%d'
  7. dateFormatted='date -R'
  8. s3Bucket="balde"
  9. fileName="270x406.jpg"
  10. relativePath="/${s3Bucket}/${fileName}"
  11. contentType="image/jpg"
  12. curl -X PUT -T "${fileName}" \
  13. -H "Host: ${s3Bucket}.s3.amazonaws.com" \
  14. -H "Date: ${dateFormatted}" \
  15. -H "Content-Type: ${contentType}" \
  16. https://${s3Bucket}.s3.amazonaws.com/${fileName}
  17. #capturing and upload the header
  18. fileName2="header.txt"
  19. contentType2="text/plain"
  20. curl -X PUT -T "${fileName2}" \
  21. -H "Host: ${s3Bucket}.s3.amazonaws.com" \
  22. -H "Date: ${dateFormatted}" \
  23. -H "Content-Type: ${contentType2}" \
  24. https://${s3Bucket}.s3.amazonaws.com/${fileName2}
  25. #greps, for cache and cfid
  26. cat header.txt | grep X-Cache
  27. cat header.txt | grep x-amz-cf-id > cfid.txt
  28. #upload cfid
  29. fileName3="cfid.txt"
  30. curl -X PUT -T "${fileName3}" \
  31. -H "Host: ${s3Bucket}.s3.amazonaws.com" \
  32. -H "Date: ${dateFormatted}" \
  33. -H "Content-Type: ${contentType2}" \
  34. https://${s3Bucket}.s3.amazonaws.com/${fileName3}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement