I am currently experiencing an 'Access Denied' error after using rasterio to open the Sentinel-2 AWS .jp2 image files (currently hosted by Sinergise and can be found here).

My code looks like this:

import rasterio

access_key = '*****************'
secret_access_key = '***********************'
region_name = 'eu-central-1'

Session = rasterio.env.Env(aws_access_key_id=access_key,

url = 's3://sentinel-pds/tiles/10/S/DG/2015/12/7/0/B01.jp2'

with Session:
    with rasterio.open(url) as dataset:
            print dataset

The response is:

CPLE_AWSAccessDenied                      Traceback (most recent call last)
<ipython-input-1-4f6da7274649> in <module>()
     13 with Session:
---> 14     with rasterio.open(url) as dataset:
     15         print dataset

/Users/Barney/anaconda/lib/python2.7/site-packages/rasterio/__init__.pyc in open(path, mode, driver, width, height, count, crs, transform, dtype, nodata,  **kwargs)
    191         raise ValueError(
    192             "mode string must be one of 'r', 'r+', or 'w', not %s" % mode)
--> 193     s.start()
    194     return s

rasterio/_base.pyx in rasterio._base.DatasetReader.start (rasterio/_base.c:2847)()

rasterio/_base.pyx in rasterio._base.DatasetReader.start (rasterio/_base.c:2799)()

rasterio/_err.pyx in rasterio._err.CPLErrors.check (rasterio/_err.c:1773)()

CPLE_AWSAccessDenied: Access Denied 

I'm unsure if I am using rasterio aws environments correctly, is the aws session token key required even if the secret and access keys are provided? I should also add that this function works correctly if provided with a Landsat-8 url (i.e. http://landsat-pds.s3.amazonaws.com/L8/139/045/LC81390452014295LGN00/LC81390452014295LGN00_B1.TIF)

Versions (installed through Anaconda):

rasterio - 0.36.0

python - 2.7

Sorry if the above is vague. My questions would be - why does this work for Landsat-8 but not Sentinel-2? How can rasterio be used to open Sentinel-2 AWS data?

1 Answer 1


I believe you are using the wrong bucket name. It should be s3://sentinel-s2-l1c, not s3://sentinel-pds


url = 's3://sentinel-s2-l1c/tiles/10/S/DG/2015/12/7/0/B01.jp2'

See more info here: http://sentinel-pds.s3-website.eu-central-1.amazonaws.com/ and https://aws.amazon.com/public-datasets/sentinel-2/

  • +1 - the Sentinel-2 on AWS specifically states: "LOCATION s3://sentinel-s2-l1c"
    – user2856
    Dec 18, 2016 at 22:52
  • 1
    Yep, works with the URL in the answer. Answer should be accepted. Note: access to these JP2 files using free JPEG 2000 drivers has poor performance. You'll need to build GDAL from source using, for example, the not-free MrSID SDK, to get decent performance with JP2. I wonder if there's a reason they went with JP2 instead of GeoTIFF?
    – sgillies
    Dec 22, 2016 at 10:38
  • @sgillies Dsoes that mean the rasterio manylinux wheels suffer this performance hit too? Did you by chance do any (public) benchmarks/comparisons?
    – Kersten
    Dec 22, 2016 at 11:34
  • 2
    I can't distribute the MrSID SDK with the wheels and so they use the free Jasper-based JP2 driver. I don't have benchmarks to publish.
    – sgillies
    Dec 23, 2016 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.