我无法从使用虚拟 MFA 设备配置文件的 IAM 用户账户中删除存储桶
我已经生成了会话 toekns 并将其添加到文件profile
部分~/.aws/credentials
。并将配置文件配置添加到~/.aws/config
文件中
❯ cat config
[default]
output = json
region = us-east-1
[mfa]
output = json
region = us-east-1
和
[default]
aws_access_key_id = XXXXXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[mfa]
aws_access_key_id = XXXXXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXXXXXXXX
aws_session_token = XXXXXXXXXXXXXXXXXXXXX
当我运行命令删除此存储桶时(它是空的)
❯ aws s3 rm s3://iac-bucket --recursive --region us-east-1 --endpoint-url https://s3.us-east-1.amazonaws.com --profile mfa
fatal error: An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied
此外,存储桶不会显示在管理控制台中,也不会显示在ls
命令中
❯ aws s3 mb s3://iac-bucket --profile mfa
没有输出,并且
❯ aws s3 ls s3://iac-bucket --profile mfa --region us-east-1 --endpoint-url https://s3.us-east-1.amazonaws.com
An error occurred (AccessDenied) when calling the ListObjectsV2 operation: Access Denied
我通过一个组将以下策略附加到该用户
如何删除此存储桶?为什么它根本不显示?我知道它的存在是因为
❯ aws s3 mb s3://iac-bucket --profile mfa --region us-east-1 --endpoint-url https://s3.us-east-1.amazonaws.com
make_bucket failed: s3://iac-bucket An error occurred (BucketAlreadyExists) when calling the CreateBucket operation: The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.
来自存储桶命名规则。具有该名称的存储桶很可能是由不受您控制的其他帐户创建的。这就是它不显示的原因。AFAIK 除了为您的存储桶选择不同的名称之外,没有其他方法可以解决此问题。