Amazon Simple Storage Service (S3) stores objects in buckets. This guide uses the AWS Command Line Interface (CLI) to copy those objects onto your computer.
What does “download from S3” mean?
You authenticate the CLI, then run aws s3 cp (or aws s3 sync) with an s3://bucket/key source and a local destination path. The CLI calls the S3 API and writes files to disk.
When should you use the CLI?
Use it for scripts, large trees, and repeatable transfers. For one-off objects in the console, see Amazon S3 — buckets and uploads. For a CDN in front of a bucket, see CloudFront.
What you will do
Create an access key for a local profile, run aws configure, download one object, copy a whole prefix recursively, then filter by file extension with --exclude / --include.
Credentials in this walkthrough
The examples use IAM user access keys for a quick local setup. Prefer IAM Identity Center (SSO) or short-lived roles when your team supports them.
CLI first, console second.
Once aws configure works, the same patterns scale to sync jobs and CI without clicking through the console.
Treat access keys as secrets.
Never commit keys to source control. Rotate or delete them when you finish learning. Prefer SSO or roles for day-to-day work.
Need TLS for sites next?
After moving data with S3, use ACM for certificates on load balancers, APIs, and CloudFront.
Reference
Core Concepts
Terms you will use while downloading:
Concept
Meaning
Bucket
Container for objects in a Region
Object key
Full path-like name of a file inside the bucket
s3:// URI
CLI address form: s3://bucket/prefix/object
aws s3 cp
Copy one object or a tree with --recursive
aws s3 sync
Incremental copy that skips unchanged files
--exclude / --include
Filters which keys are transferred (order matters)
Access key
IAM user credentials for local CLI profiles (use carefully)
aws configure
Writes default profile credentials and Region for the CLI
Before you start
Prerequisites
Have these ready before you download:
An AWS account with permission to read the target bucket (for example s3:GetObject and list on the prefix you need).
The AWS CLI installed on your computer (aws --version works).
A bucket with sample objects—create one with the S3 console basics guide if needed.
Walkthrough
Examples
Authenticate the CLI, then download one file, a full prefix, and a filtered subset.
Example 1 — Create an Access Key
Create an IAM user access key pair in the console for local CLI use (labels can vary slightly over time).
Filters are evaluated in order; start from a broad exclude and then add narrower includes, or consult the AWS CLI reference for s3 cp for advanced patterns.
Local terminal
How It Works
--exclude "*" drops everything first.
--include "*.jpg" brings JPEG keys back into the transfer set.
Order matters—later rules override earlier matches for a given key.
Most failures are permissions, wrong Region, or filter order.
iam
Access Denied on cp
The profile principal needs s3:GetObject (and usually list) on the prefix. Bucket policies and explicit denies also block downloads.
region
Wrong default Region
A mismatched profile Region can confuse endpoint behavior. Pass --region or fix aws configure to match the bucket.
path
Local directory missing
Create the destination folder first. Some shells fail when the parent path does not exist.
filter
Include without a broad exclude
Filters are sequential. The usual pattern is exclude everything, then include the patterns you want.
keys
Leaked access keys
If a key appears in git or a screenshot, deactivate it in IAM immediately and create a new one.
sync
Recursive copy every time
For large prefixes you revisit often, prefer aws s3 sync so unchanged objects are skipped.
Remember
Key Takeaways
Authenticate first:aws configure (or SSO) so the CLI can call S3.
aws s3 cp: one object, or a tree with --recursive.
aws s3 sync: keep a local folder aligned over time.
Filters:--exclude / --include pull only the types you need.
One line: configure the CLI, then aws s3 cp / sync from s3:// to a local path.
Frequently Asked Questions
Use aws s3 cp with the s3:// URI for the object and a local path, for example: aws s3 cp s3://your-bucket-name/path/to/image.jpg /path/on/local/machine/
Use aws s3 cp with the --recursive flag from the bucket or prefix to a local directory, or use aws s3 sync for incremental transfers that skip unchanged files.
aws s3 cp copies the paths you specify; with --recursive it walks the prefix. aws s3 sync compares source and destination and skips files that already match, which is useful for incremental backups.
The CLI needs credentials in some form. Access key ID and secret access key are one option; many teams prefer IAM Identity Center (SSO) or IAM roles instead of long-lived keys for better security.
Check IAM permissions on the principal configured in the CLI, S3 bucket policies, object ownership, and any explicit denies. Also confirm the bucket Region matches the profile default if you rely on regional endpoints.
With aws s3 cp --recursive, filters are evaluated in order. A common pattern is --exclude "*" then --include "*.jpg" so only matching keys are copied.