I need to extract the list of files present inside a tar file stored in S3 bucket using AWS CLI. I should not download the file and extract it to list the file. I only need the file list. I tried the select-object-content S3 api command. But it is throwing random errors.
The command I tried is
aws s3api select-object-content --bucket my-temp-files --key S3_temp_compression_test/20230216.tar --expression "select s from S3Object s where s.key like '%.tar'" --expression-type "SQL" --input-serialization '{"CSV": {"FileHeaderInfo": "Use"}, "CompressionType": "NONE"}' --output-serialization '{"CSV": {}}' | tar -xOf - | tr ' ' '\n'
Suggest whether there are any other options that I can approach.