목표 : 버킷 삭제
문제점
- 홈페이지에서 삭제시 객체가 있어서 삭제가 안된다고 나옴
- 객체 삭제 실행해도 삭제가 안됨
- 홈페이지에서 삭제 실패
OS
macOS 12.3.1 ( M1 )
최종 해결 방법
- aws cli 접근을 위해 사용자 발급
- awscli 설치
- awscli 연결 설정
- python3.6 설치
- python 라이브러리 AWS SDK (boto3==1.9.66) 사용
- 아래 python 코드 실행
#!/usr/bin/env python
import boto3
s3 = boto3.resource('s3')
bucket = s3.Bucket('photo-album') # 자신의 버킷 이름
bucket.object_versions.all().delete()
1. aws cli 접근을 위해 사용자 발급 방법
https://lovit.github.io/aws/2019/01/30/aws_s3_iam_awscli/
AWS CLI (Command Line Interface) 를 이용하여 S3 버킷 다루기 (파일 업로드, 폴더 동기화) 및 AWS IAM 등록
이전 포스트에서 AWS S3 에 버킷을 만들고 Web UI 를 이용하여 파일을 업로드, 공유하였습니다. 이번에는 AWS CLI 를 이용하여 로컬과 S3 bucket 을 동기화 시킵니다. CLI 는 terminal 환경에서 AWS 를 이용할
lovit.github.io
2. python 코드 정보
https://stackoverflow.com/a/41399166
How do I delete a versioned bucket in AWS S3 using the CLI?
I have tried both s3cmd: $ s3cmd -r -f -v del s3://my-versioned-bucket/ And the AWS CLI: $ aws s3 rm s3://my-versioned-bucket/ --recursive But both of these commands simply add DELETE markers t...
stackoverflow.com
시도해본 정보
awscli로 삭제해보려 했느나 (실패)
$ aws s3 rb s3://photo-album --force
remove_bucket failed: s3://photo-album An error occurred (BucketNotEmpty) when calling the DeleteBucket operation: The bucket you tried to delete is not empty. You must delete all versions in the bucket.
위와같은 결과를 받음