Downloading an object
- In the management console
, select the appropriate folder. - Select Object Storage.
- Select the bucket from which you want to download an object.
- Next to the object you want to download, click
If you do not have the AWS CLI yet, install and configure it.
To download a single object, run this command:
aws s3 cp \
--endpoint-url=https://storage.yandexcloud.net \
s3://<bucket_name>/<object_key> \
<local_path>
Where:
--endpoint-url
: Object Storage endpoint.<bucket_name>
: Name of the bucket to download the object from.<object_key>
: Key of the object to download.<local_path>
: Path to the directory to save the downloaded object to, e.g.,~/downloads/
.
To download all bucket objects, run this command:
aws s3 cp \
--endpoint-url=https://storage.yandexcloud.net \
--recursive \
s3://<bucket_name> \
<local_path>
Where:
--endpoint-url
: Object Storage endpoint.--recursive
: Command to download all objects from the specified bucket to a local directory.<bucket_name>
: Name of the bucket to download the object from.<local_path>
: Path to the directory to save the downloaded objects to, e.g.,~/downloads/
.
The aws s3 cp
command is high-level, its functionality is limited. For more information, see the AWS CLI reference
You can download bucket objects selectively using the aws s3api
command and a JMESPath query template. To download objects using a query template, run this command:
-
Bash:
aws s3api list-objects \ --endpoint-url https://storage.yandexcloud.net \ --bucket <bucket_name> \ --query '<query>' \ --output text | xargs -I {} aws s3api get-object --endpoint-url https://storage.yandexcloud.net --bucket <bucket_name> --key {} <local_path>{}
Where:
--endpoint-url
: Object Storage endpoint.--bucket
: Name of the bucket to download objects from.--query
: Query in JMESPath format.<local_path>
: Path to the directory to save the downloaded objects to, e.g.,~/downloads/
.
Here is an example of a command that downloads all objects whose filenames start with
date-20231002
from thesample-bucket
to the~/downloads/
local directory:aws s3api list-objects \ --endpoint-url https://storage.yandexcloud.net \ --bucket sample-bucket \ --query 'Contents[?starts_with(Key, `date-20231002`) == `true`].[Key]' \ --output text | xargs -I {} aws s3api get-object --endpoint-url https://storage.yandexcloud.net --bucket sample-bucket --key {} ~/downloads/{}
-
PowerShell
Foreach($x in (aws s3api list-objects ` --endpoint-url https://storage.yandexcloud.net ` --bucket <bucket_name> ` --query '<query>' ` --output text)) ` {aws s3api get-object --endpoint-url https://storage.yandexcloud.net --bucket <bucket_name> --key $x <local_path>$x}
Where:
--endpoint-url
: Object Storage endpoint.--bucket
: Name of the bucket to download objects from.--query
: Query in JMESPath format.<local_path>
: Path to the directory to save the downloaded objects to, e.g.,d:\downloads\
.
Here is an example of a command that downloads all objects whose filenames start with
date-20231002
from thesample-bucket
to thed:\downloads\
local directory:Foreach($x in (aws s3api list-objects ` --endpoint-url https://storage.yandexcloud.net ` --bucket sample-bucket ` --query 'Contents[?starts_with(Key, `date-20231002`) == `true`].[Key]' ` --output text)) ` {aws s3api get-object --endpoint-url https://storage.yandexcloud.net --bucket sample-bucket --key $x d:\downloads\$x}
To download an object, use the get S3 API method.