developmentseed / geolambda

Create and deploy Geospatial AWS Lambda functions
MIT License
303 stars 85 forks source link

Configuring geolambda GDAL error #105

Closed jose-sanchez-morales closed 2 years ago

jose-sanchez-morales commented 2 years ago

I am trying to make a lambda_function.py works in AWS.

I have a lambda using geolambda v4 and geolambda-python v3 as layers, for running a script in Python that uses sentinel-2 jp2 files.

Python version is Python 3.7

I have added the 2 variables in the lambda environment: GDAL_DATA=/opt/share/gdal PROJ_LIB=/opt/share/proj (only needed for GeoLambda 2.0.0+)

However, when running the command:

src_tci_ds = gdal.Open('/vsis3/my-bucket/subfolder/image.jp2')

I got this error:

Warning 1: HTTP response code on https://my-bucket.s3.amazonaws.com/sub-folder/file.XML: 403 Warning 1: HTTP response code on https://my-bucket.s3.amazonaws.com/sub-folder/file.xml: 403 Warning 1: HTTP response code on https://my-bucket.s3.amazonaws.com/sub-folder/file.IMD: 403 Warning 1: HTTP response code on https://my-bucket.s3.amazonaws.com/sub-folder/file.imd: 403 Warning 1: HTTP response code on https://my-bucket.s3.amazonaws.com/sub-folder/file.RPB: 403 Warning 1: HTTP response code on https://my-bucket.s3.amazonaws.com/sub-folder/file.rpb: 403 Warning 1: HTTP response code on https://my-bucket.s3.amazonaws.com/sub-folder/file.PVL: 403 Warning 1: HTTP response code on https://my-bucket.s3.amazonaws.com/sub-folder/file.pvl: 403 Warning 1: HTTP response code on https://my-bucket.s3.amazonaws.com/sub-folder/file_rpc.txt: 403 Warning 1: HTTP response code on https://my-bucket.s3.amazonaws.com/sub-folder/file_RPC.TXT: 403 Warning 1: HTTP response code on https://my-bucket.s3.amazonaws.com/sub-folder/file_metadata.txt: 403

Surely, it must be some configuration I am missing, but what could it be?

Thanks,

vincentsarago commented 2 years ago

that's not errors but warning, of GDAL trying to list all files in sub-folder to avoid this you can set GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR

ref: https://github.com/developmentseed/titiler/blob/master/docs/advanced/performance_tuning.md#gdal_disable_readdir_on_open