How Do I dowload a file from Amazon S3?
6 views (last 30 days)
Show older comments
Hello,
I am trying to use matlab to download a .gz file from Amazon s3. I have the AWS creditials set.
% Set AWS credentials
YOUR_AWS_ACCESS_KEY_ID = 'test1';
YOUR_AWS_SECRET_ACCESS_KEY = 'test2';
setenv('AWS_ACCESS_KEY_ID', YOUR_AWS_ACCESS_KEY_ID);
setenv('AWS_SECRET_ACCESS_KEY', YOUR_AWS_SECRET_ACCESS_KEY);
setenv('AWS_REGION', 'us-west-2');
I have my path s3 path:
rawdataPath = 's3://companya/Frontier/FieldData/file.csv.gz'
I am wondering how I can download this file.
0 Comments
Answers (1)
Voss
on 18 Mar 2024
Once you have your environment set up, you should be able to treat files on S3 as you would treat any local file, e.g.,
rawdataPath = 's3://companya/Frontier/FieldData/file.csv.gz'
localDir = 'C:\Downloads';
% copy .gz to local directory:
copyfile(rawdataPath,localDir)
% or unzip .gz to local directory:
gunzip(rawdataPath,localDir)
2 Comments
See Also
Categories
Find more on Programming Utilities in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!