← All posts
2 min read

Restore an archived S3 object temporarily

#aws#cli#s3#storage#archive#cost
📑 On this page

Part 79 of AWS from Zero. This lesson keeps the scope to one S3 behavior you can verify from the terminal.

What we are learning

Archived objects may require a restore request before their data can be read. The restored copy is temporary and remains in the same storage class.

Before you run it

BUCKET="replace-with-your-private-demo-bucket"
KEY="archive/report.zip"

Use an object already stored in an archive class. Retrieval time and pricing depend on class and tier.

Cost note: Archive retrieval and restored-copy storage can incur charges.

The command

aws s3api restore-object \
  --bucket "$BUCKET" \
  --key "$KEY" \
  --restore-request '{"Days":2,"GlacierJobParameters":{"Tier":"Standard"}}'

A successful configuration command may return no output. Treat inspection as a separate required step.

Inspect the result

aws s3api head-object \
  --bucket "$BUCKET" \
  --key "$KEY" \
  --query "{Class:StorageClass,Restore:Restore}"

The restore field indicates whether retrieval is in progress and later shows the temporary expiry date.

One tiny variation

aws s3api restore-object \
  --bucket "$BUCKET" \
  --key "$KEY" \
  --restore-request '{"Days":1,"GlacierJobParameters":{"Tier":"Bulk"}}'

Bulk can be slower and cheaper where supported. Choose the tier before submitting the job.

Common mistake

Calling restore again while a job is active can return RestoreAlreadyInProgress. Poll metadata instead of repeatedly resubmitting.

Cleanup

aws s3api head-object --bucket "$BUCKET" --key "$KEY"

A temporary restored copy expires automatically. Delete the archived object only if retention and backup policy permit it.

Next, we will learn Build a private S3 backup bucket from the CLI.

Official AWS CLI reference