Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

hippolin/S3PreSignedUpload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#利用Pre-Signed URL透過cURL上傳檔案至S3 因為遇到AWS的網友有pre-singed upload的問題,在解決問題後,把方法分享出來。

1.請在S3Sample.java的目錄裡加上AwsCredentials.properties內容如下:

accessKey=<your access key>
secretKey=<your secret key>    

2.修改S3Sample.java

private static String bucketName = "<your bucket name>";
private static String objectKey = "<your filename on s3>";

3.執行後會有一個pre-signed URL:

Generating pre-signed URL.
Pre-Signed URL = https://hippo.test.s3-ap-northeast-1.amazonaws.com/20130916.zip?Expires=1379587357&AWSAccessKeyId=AKIAJZHVMBQ5SEZPXMDQ&Signature=piEWbsPr2a6Tbu9TeINm1/gIt60%3D

4.用cURL上傳檔案

curl --insecure -X PUT --data-binary @<要上傳的filename> "<Pre-Signed URL>"

因為URL中有"&",shell會把它當成background script而拆成好幾條指令去跑。 所以在pre-signed URL的前後一定要加上『 " 』雙引號。

Reference

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages