Closed c2xbrhdj6u4qs15 closed 7 years ago
For now, you can not directly do that with awless. However, this can be done with bash one-liners:
To empty a s3bucket, replace your-bucket
(2 times) with the name of the bucket you want to empty and run:
awless list s3objects --filter bucket=your-bucket --format tsv | tail -n +2 | cut -f 1 | xargs -n1 awless delete s3object bucket=your-bucket name=
When you have checked that the output is correct (it attempts to delete the correct objects), add the -f
flag to awless delete s3object
, in order to disable the confirmation prompt.
To empty a registry, i.e. delete all the repositories of an account registry, replace your-account
with the ID of the account of the ECR registry. Note that you can know your account with awless whoami --account-only
and if you want to empty the registry of your current account, you can omit this parameter:
awless list repositories --filter account=your-account --format tsv | tail -n +2 | cut -f 1 | xargs -n1 awless delete repository force=true account=your-account name=
When you have checked that the output is correct (it attempts to delete the correct objects), add the -f
flag to awless delete repository
, in order to disable the confirmation prompt.
Thanks for your response. I am going to try this out. Regards
Hi,
I am wondering how to empty an S3Bucket or a ECR Registry to be able to delete the Bucket or the ECR Registry?
Thanks in advance