How to download multiple files from an S3 bucket

Create a list of files to be downloaded as below:

aws s3 ls s3://bucketname/prefix/ | awk '{print $4}' > $listfile

Now you can download the files by looping through the list as below:

while read filename                                     
do                                                      
aws s3 cp s3://bucketname/prefix/$filename . > /dev/null
done < $listfile                                        

See also  How to enable Termination Protection on an EC2 Instance