Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentinel2 L1C requester pays #52

Closed
samsammurphy opened this issue Aug 8, 2018 · 5 comments
Closed

Sentinel2 L1C requester pays #52

samsammurphy opened this issue Aug 8, 2018 · 5 comments

Comments

@samsammurphy
Copy link
Contributor

Hi @vincentsarago 👋

It happened, AWS now requires a requester pays header for Sentinel2 L1C 😢 . How do we move forward with rio tiler from here?

This is the message I get when running the first example in the README

from rio_tiler import sentinel2
tile, mask = sentinel2.tile('S2A_tile_20170729_19UDP_0', 77, 89, 8)
# rasterio._err.CPLE_AWSAccessDeniedError: Access Denied

Interestingly when I run the command again I get this

# rasterio._err.CPLE_OpenFailedError: '/vsis3/sentinel-s2-l1c/tiles/19/U/DP/2017/7/29/0/preview.jp2' does not exist in the file system, and is not recognized as a supported dataset name.

which is more inline with what my (previously working) lambda sentinel2 tiler is now saying..

@samsammurphy samsammurphy changed the title requester pays Sentinel2 L1C requester pays Aug 8, 2018
@vincentsarago
Copy link
Member

Hi @samsammurphy,
To make it work you need to set AWS_REQUEST_PAYER="requester" environment.
I could add a

with rasterio.Env(AWS_REQUEST_PAYER="requester") as env:

but I'm not sure it's the best way to do

@samsammurphy
Copy link
Contributor Author

Howdy @vincentsarago

I understand the concern that rio tiler uses will be charged by AWS to access L1C now. It has to be really clear to the users (i.e. to avoids nasty surprises).

From the front end maybe this could be a one time configuration setting

from rio_tiler import sentinel2
sentinel2.aws_requester_payer = 'requester'

This could have the effect setting the AWS_REQUEST_PAYER environment variable before running rio tiler, maybe through rasterio as you mentioned, or perhaps as subprocess command? The latter, however, might not work on all machines (?) and would require python2 vs 3 handling, here's what it might look like anyway..

import subprocess
subprocess.run(['export', 'AWS_REQUEST_PAYER="requester"']) 

@vincentsarago
Copy link
Member

FYI
There was a ticket couples years ago about the same subject on rasterio: rasterio/rasterio#692

@samsammurphy
Copy link
Contributor Author

samsammurphy commented Aug 10, 2018

Cheers!

Mojodna suggests a way of setting the environment variable which would handle the reservation I had with my previous subprocess-based suggestion, namely:

os.environ["AWS_REQUEST_PAYER"] = "requester"

edit
p.s. he suggests this instead of using rasterio.Env.

@vincentsarago
Copy link
Member

@samsammurphy I'm going to close this, except if it's still a blocker!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants