s3 inventory Atena query


I have s3 inventory service setup done. I have imported data into Athena as CSV format. Is there a way that I can query number of objects in a particularly directory in Athena ?

asked 2 years ago933 views
1 Answer


You can run something like

select count(key) from <your_table>
where key like 'your_prefix%'

Lets say you have 3 objects

  • prefix1/prefix2/object1.txt
  • prefix1/prefix2/object2.txt
  • prefix1/prefix3/object3.txt
select count(key) from <your_table>
where key like 'prefix1/prefix2/%'

This would return 2

Check out this blog post for more examples


profile pictureAWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions