Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

aws s3 ls filter storage class(STANDARD)

How to list files but I want to list all standard class only.

I want to exclude glacier class.

Currently here is my command:

aws s3 ls s3://Videos/Action/ --human-readable --summarize
like image 971
jojo Avatar asked Feb 23 '17 09:02

jojo


People also ask

Which storage class will you prefer for your S3 instance?

S3 Standard-IA offers the high durability, high throughput, and low latency of S3 Standard, with a low per GB storage price and per GB retrieval charge. This combination of low cost and high performance make S3 Standard-IA ideal for long-term storage, backups, and as a data store for disaster recovery files.

What is the resilience SLA for the S3 standard storage class?

S3 Standard is designed for 99.99% availability and Standard - IA is designed for 99.9% availability. Both are backed by the Amazon S3 Service Level Agreement.

What data should be stored on S3 standard?

You can store virtually any kind of data in any format. Please refer to the Amazon Web Services Licensing Agreement for details. Q: How much data can I store in Amazon S3? The total volume of data and number of objects you can store are unlimited.

What is the best storage class in S3 bucket and why?

S3 Intelligent Tiering (S3 Intelligent-Tiering) S3 Intelligent Tiering storage class is designed to optimize storage costs by automatically moving data to the most cost-effective storage access tier, without performance impact or operational overhead.


1 Answers

The aws s3 ls command doesn't display the Storage Class, but you can do it with this command:

aws s3api list-objects-v2 --bucket Videos --prefix Action --query "Contents[?StorageClass=='STANDARD'].Key" --output text

The output is tab-separated, so you may have to massage the output to get it in your desired format, eg:

aws s3api list-objects-v2 --bucket Videos --prefix Action --query "Contents[?StorageClass=='STANDARD'].Key" --output text | sed 's/\t/\n/g'

To gain an understanding of how to selectively use the --query command, see:

  • How to Filter the Output with the --query Option
  • JMESPath Tutorial
like image 135
John Rotenstein Avatar answered Oct 23 '22 22:10

John Rotenstein