Filter and delete aws s3 object.
➜  ~ aws s3api list-objects --bucket fake-bucket --query 'Contents[?LastModified>=`2018-10-04` ].{Key:Key}' --prefix "2018-10-04" --output text |  xargs -I {} aws  s3 rm s3://fake-bucket/{}                                                                                           
delete: s3://fake-bucket/2018-10-04T19:00-0zdoEmH9Mp7Y897MGMIy.log
delete: s3://fake-bucket/2018-10-04T19:00-16FZUUHHZZkWisbJhyn2.log
delete: s3://fake-bucket/2018-10-04T19:00-3Uw2gy2OyjgkMvhStPfE.log


serkan haytac

AWS Certified Solutions Architect - Associate
AWS Certified Developer - Associate
AWS Certified SysOps Administrator - Associate
Gists
Resources
One liners