[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 20:19:14 PDT 2023


Thanks Even,

it works now with these environmental configurations:

export AWS_ACCESS_KEY_ID=AKIAY5
export AWS_SECRET_ACCESS_KEY=qc2KcpIm
export AWS_REQUEST_PAYER=requester
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 



On 07.07.23 3:52 AM, Even Rouault wrote:
>
> You also need to specify: --config AWS_REQUEST_PAYER requester
>
> Le 07/07/2023 à 03:37, Bang Pham Huu a écrit :
>>
>> 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,
>>
>>
>>
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev
> -- 
> http://www.spatialys.com
> My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230707/fdbe941f/attachment.htm>


More information about the gdal-dev mailing list