Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
487 views
in Technique[技术] by (71.8m points)

linux - Trying to upload tiffs to Mapbox I get 'Access denied when calling the CreateMultipartUpload operation'

I am trying to create a shell script that will upload our tiffs to mapbox using their API. I retrieve the temporary credentials from the initial curl post but when it comes to copying the data across via aws' cp command I get the error Access denied when calling the CreateMultipartUpload operation.

I am assuming that this error is to do with credentials being stored incorrectly. My code is as follows:

#save curl response as var
ans=`curl -X POST "https://api.mapbox.com/uploads/v1/xxx/credentials?access_token=$token"`

#extract necessary info from var
key=`echo $ans | grep -zoP '"key":s*"K[^s,]*(?=s*",)'`
bucket=`echo $ans | grep -zoP '"bucket":s*"K[^s,]*(?=s*",)'`
accessKeyId=`echo $ans | grep -zoP '"accessKeyId":s*"K[^s,]*(?=s*",)'`
secretAccessKey=`echo $ans | grep -zoP '"secretAccessKey":s*"K[^s,]*(?=s*",)'`
sessionToken=`echo $ans | grep -zoP '"sessionToken":s*"K[^s,]*(?=s*",)'`

#export env variables for auth
export AWS_ACCESS_KEY_ID=$accessKeyId
export AWS_SECRET_ACCESS_KEY=$secretAccessKey
export AWS_SESSION_TOKEN=$sessionToken

#copy data across
aws s3 cp $inputdir s3://$bucket/$key/ --recursive --region us-east-1

Any help would be much appreciated.

question from:https://stackoverflow.com/questions/65941933/trying-to-upload-tiffs-to-mapbox-i-get-access-denied-when-calling-the-createmul

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

--recursive is not supported. You need to upload file one by one.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...