mapbox / mapbox-cli-py

Command line interface to Mapbox Web Services
MIT License
165 stars 44 forks source link

Handle uploads of existing s3 objects #49

Closed perrygeo closed 7 years ago

perrygeo commented 8 years ago

It should be possible to accept an s3 uri as an upload object. With a file we transfer the data to s3 with stage and then calling create to start the processing. With an s3 uri we skip the transfer and call create directly

Questions

cc @rclark

perrygeo commented 8 years ago

So a few notes on what I've found so far:

The upload API appears to only accept https URIs, not s3://

$ mapbox upload perrygeo.test3 s3://mapbox/playground/perrygeo/rgb.tif
Error: status code 500
{"message":"Internal Server Error"}

If I upload from mapbox bucket with standard permissions (ie not public readable), I get a 422 error - "Could not access URL". If I change perms to public readable, I can make it work once

$ mapbox upload perrygeo.test1 https://s3.amazonaws.com/mapbox/playground/perrygeo/rgb.tif

However, subsequent uploads with that url fail

$ mapbox upload perrygeo.test2 https://s3.amazonaws.com/mapbox/playground/perrygeo/rgb.tif
Error: status code 409
{"message":"The provided url has already been used by another upload. Fetch new credentials."}

Trying to access publicly accessible data from a non-mapbox bucket in a different region fails

$ mapbox upload perrygeo.test4 https://s3-us-west-2.amazonaws.com/perrygeo-gdal/test1.tif
Error: status code 500
{"message":"Internal Server Error"}

Still haven't tested non-mapbox, public in us-east to see if region plays a role.

So my current understanding is that direct s3 upload is only available to public objects in mapbox buckets - @rclark does this behavior make sense given what you know of the Upload API?

perrygeo commented 8 years ago

From @rclark via chat: