Skip to content

Instantly share code, notes, and snippets.

@dasgoll
Created October 17, 2023 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dasgoll/5599435741eb95243d9b05c81725d68a to your computer and use it in GitHub Desktop.
Save dasgoll/5599435741eb95243d9b05c81725d68a to your computer and use it in GitHub Desktop.
force delete S3 bucket in aws
export AWS_PROFILE=k2k
bucket_name="k2k-dev-vpc-flow-logs-s3serverlogs"
aws s3api put-bucket-versioning --bucket ${bucket_name} --versioning-configuration Status=Enabled --region eu-central-1
delete-bucket -p k2k -f -b ${bucket_name} -r eu-central-1 ; aws s3 rm s3://${bucket_name} --region eu-central-1
An error occurred (NoSuchBucket) when calling the PutBucketVersioning operation: The specified bucket does not exist
➡️ Disabling Bucket Versioning if enabled
➡️ Collecting objects to delete
Error deleting bucket: NoSuchBucket
fatal error: An error occurred (NoSuchBucket) when calling the ListObjectsV2 operation: The specified bucket does not exist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment