Downloading folders and objects from the S3 bucket
With the increasing popularity of S3 and its simplicity, almost every organization started using S3 for their object store. So, you need to know how you can upload and download S3 objects from the S3 bucket. We have already seen this in the previous section on uploading or writing objects/folders to S3. Let's review the download-related cmdlet. The Read-S3Object
cmdlet lets you download an S3 object optionally, including sub-objects, to a local file or folder location on your local computer.
To download the Tax
file from the bucket myfirstpowershellbucket
and to save it as local-Tax.txt
locally, use the following command. If local-Tax.txt
is already present, the operation will overwrite the file:
PS C:\>Read-S3Object -BucketName myfirstpowershellbucket -Key Tax -File local-Tax.txt
To download the complete folder Books
under the bucket myfirstpowershellbucket
and save the folder as local-books
, use the following command. The operation would...