[gdal-dev] [AWS-S3]Access denied 403 error when requesting gdalinfo to usgs-landsat bucket?

Bang Pham Huu b.phamhuu at jacobs-university.de
Thu Jul 6 18:37:30 PDT 2023


Hello,

GDAL 3.4.1, released 2021/12/27 (Ubuntu 22.04)

I have this file ~/.aws/credentials  (configured by this command: aws 
configure)

[default]
aws_access_key_id = AKIAY.....
aws_secret_access_key = qc2KcpImI/....

This works fine for aws CLI command to download a Landsat-8 tiff file:

aws s3 cp --request-payer requester 
s3://usgs-landsat/collection02/level-2/standard/oli-tirs/2023/233/245/LC08_L2SP_233245_20230510_20230518_02_T2/LC08_L2SP_233245_20230510_20230518_02_T2_SR_B1.TIF 
.

But gdal cannot read the file?

gdalinfo 
/vsis3/usgs-landsat/collection02/level-2/standard/oli-tirs/2023/233/245/LC08_L2SP_233245_20230510_20230518_02_T2/LC08_L2SP_233245_20230510_20230518_02_T2_SR_B1.TIF
Warning 1: HTTP response code on 
https://usgs-landsat.s3.amazonaws.com/collection02/level-2/standard/oli-tirs/2023/233/245/LC08_L2SP_233245_20230510_20230518_02_T2/LC08_L2SP_233245_20230510_20230518_02_T2_SR_B1.TIF: 
403

On https://gdal.org/user/virtual_file_systems.html, it says:

Starting with GDAL 2.3, alternate ways of providing credentials similar 
to what the "aws" command line utility or Boto3 support can be used. If 
the above mentioned environment variables are not provided, 
the|~/.aws/credentials|

|
|

|I even tried to set environmental variables, but it doesn't work either:|

|export AWS_ACCESS_KEY_ID=AKIAY5....
export AWS_SECRET_ACCESS_KEY=qc2KcpImI/....
gdalinfo 
/vsis3/usgs-landsat/collection02/level-2/standard/oli-tirs/2023/233/245/LC08_L2SP_233245_20230510_20230518_02_T2/LC08_L2SP_233245_20230510_20230518_02_T2_SR_B1.TIF
Warning 1: HTTP response code on 
https://usgs-landsat.s3.amazonaws.com/collection02/level-2/standard/oli-tirs/2023/233/245/LC08_L2SP_233245_20230510_20230518_02_T2/LC08_L2SP_233245_20230510_20230518_02_T2_SR_B1.TIF: 
403
ERROR 14: Access Denied
gdalinfo failed - unable to open 
'/vsis3/usgs-landsat/collection02/level-2/standard/oli-tirs/2023/233/245/LC08_L2SP_233245_20230510_20230518_02_T2/LC08_L2SP_233245_20230510_20230518_02_T2_SR_B1.TIF'.

|

Thanks,


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230707/eaf2085b/attachment.htm>


More information about the gdal-dev mailing list