I want to read a JSON file in AWS S3 bucket into a Python list of dicts. My AWS credentials are stored in env:
os.environ['AWS_ACCESS_KEY_ID'] = "my_access_key"
os.environ['AWS_SECRET_ACCESS_KEY'] = "my_secret_access_key"
os.environ['AWS_DEFAULT_REGION'] = 'eu-central-1'
Now I try to read the file:
f = open("s3://bucketname/folder/file.json")
And I get the following:
FileNotFoundError: [Errno 2] No such file or directory: 's3://bucketname/folder/file.json'
(I can read the file via boto3
but I wonder if there is a way for direct access like the above.)
The basic options are:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.