Error in loading data from AWS S3

조회 수: 5 (최근 30일)
Yona
Yona 2018년 7월 15일
댓글: Yona 2018년 12월 18일
I tried to get a files from a bucket i creat in S3
I use a code i saw in different places:
setenv('AWS_ACCESS_KEY_ID', <myKeyID>);
setenv('AWS_SECRET_ACCESS_KEY', <myaccessKey>);
setenv('AWS_REGION', 'us-east-1');
fds = fileDatastore('s3://{mybucket}/','ReadFcn',@load, 'FileExtensions',{'.csv'})
matlab "think" a lot and then I got
Error using fileDatastore (line 102)
Cannot find files or folders matching: 's3://{mybucket}/'.
I try to change to a bucket that don't exist and i got the same error but vary fast, I tried to change the ReadFcn, I try to get directly one file (and not all the files in the bucket), I change the access key. Nothing worked.
Any idea what is the problem?

채택된 답변

Arvind Narayanan
Arvind Narayanan 2018년 7월 26일
Hi Yona,
Based on the error message that you have shared, it seems that the location 's3://{mybucket}/' seems to be the cause of the issue. Please replace {mybucket} with the actual bucket name without any flower brackets.
Even in the case of the above commands:
setenv('AWS_ACCESS_KEY_ID', <myKeyID>);
setenv('AWS_SECRET_ACCESS_KEY', <myaccessKey>);
Please remove the angular brackets and then fill in the keyID and the access key as string type.
If all else fails, you can also use the following API for the data store:
fs = matlab.io.datastore.DsFileSet("s3://{mybucket}/", "IncludeSubFolders", true);
Hope this helps!
Thanks,
Arvind
  댓글 수: 1
Yona
Yona 2018년 12월 18일
I use my bucket name and my key, I just change in before posting this question.
The second way you suggest don't look to work too (after a minute or two I close matlab after it look like it stuck)
For now, I use different solution but the connectiong from matlab to s3 must be better

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

추가 답변 (1개)

Harsh
Harsh 2018년 7월 20일
Make sure the s3 bucket actually exists and you are using the accurate internationalized resource identifier (IRI) of the form -> s3://bucketname/path_to_file. This error occurs when the bucket on s3 cannot be found. Step by step instructions are here.
  댓글 수: 1
Yona
Yona 2018년 7월 23일
Like you can see in my question, i used this form exactly trying to get a specific file or a but folder.

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

카테고리

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

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by