Error in loading data from AWS S3

7 ビュー (過去 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 Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by