How to use Matlab to download data from an AWS S3 bucket

조회 수: 31 (최근 30일)
Stephen Forczyk
Stephen Forczyk 2021년 8월 6일
댓글: Yongjian Feng 2021년 8월 11일
I have been using python scripts to download from a public Amzon S3 bucket to my local computer. I would like to create a Matlab script to do the same. So far my Matlab scripts do not work. The key steps in the python scripts are easy (see below)
import s3fs
import os
import numpy as np
fs = s3fs.S3FileSystem(anon=True)
fs.ls('s3://noaa-goes16/')
sourcestub='noaa-goes16/ABI-L2-CPSF/2020/238/' (gets a list of particular files in a folder)
files = np.array(fs.ls(sourcestr)) (skipped some steps but these are the essentials
Basically the python script goes to the bucket and logs on to the public account with no need for a password. Retrieves the files using a loop one file at a time.
How can I replicate this functionality in Matlab. The data in the AWS help provided by Mathworks talks mostly about uploading data to a personal S3 bucket (not FREE!) on AWS. The python script does not require me to pay any fees as it is a public account apparently owned by the US Govt

채택된 답변

Yongjian Feng
Yongjian Feng 2021년 8월 11일
Try this?
https://www.mathworks.com/help/cloudcenter/ug/transfer-data-to-amazon-s3-buckets.html
  댓글 수: 2
Stephen Forczyk
Stephen Forczyk 2021년 8월 11일
The data I am trying to download is public access I don't have an AWS account to download from python. So after reading the web page I don't see how I can complete entries such as
set AWS_ACCESS_KEY_ID="YOUR_AWS_ACCESS_KEY_ID"
set AWS_SECRET_ACCESS_KEY="YOUR_AWS_SECRET_ACCESS_KEY"
set AWS_DEFAULT_REGION="us-east-1"
Can the first two items be set to blank?
Yongjian Feng
Yongjian Feng 2021년 8월 11일
Maybe you need to set the first two env vars to be blank. Please give it a try.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Downloads에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by