Error in loading data from AWS S3

11 vues (au cours des 30 derniers jours)
Yona
Yona le 15 Juil 2018
Commenté : Yona le 18 Déc 2018
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?

Réponse acceptée

Arvind Narayanan
Arvind Narayanan le 26 Juil 2018
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 commentaire
Yona
Yona le 18 Déc 2018
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

Connectez-vous pour commenter.

Plus de réponses (1)

Harsh
Harsh le 20 Juil 2018
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 commentaire
Yona
Yona le 23 Juil 2018
Like you can see in my question, i used this form exactly trying to get a specific file or a but folder.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Introduction to Installation and Licensing dans Help Center et File Exchange

Produits


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by