简体   繁体   English

`调用 ListBuckets 操作时发生错误(InvalidToken):提供的令牌格式不正确或无效。`w/`aws s3 ls`

[英]`An error occurred (InvalidToken) when calling the ListBuckets operation: The provided token is malformed or otherwise invalid.` w/`aws s3 ls`

I successfully authenticate with 2 factor but when using aws s3 ls I keep getting我成功地通过 2 个因素进行了身份验证,但是在使用aws s3 ls时,我不断得到

An error occurred (InvalidToken) when calling the ListBuckets operation: The provided token is malformed or otherwise invalid.调用 ListBuckets 操作时发生错误 (InvalidToken):提供的令牌格式不正确或无效。

And I do have admin rights.而且我确实有管理员权限。

Issue was that I wasn't passing the --region in. eg aws s3 --region us-gov-west-1 ls .问题是我没有传入--region 。例如aws s3 --region us-gov-west-1 ls I suppose this could be set with an ENV variable too.我想这也可以用 ENV 变量设置。 That error message is a candidate for improvement.该错误消息是改进的候选者。

This error also occurs when aws cli reads the aws_session_token and aws_security_token declared in the ~/.aws file, which might be associated to a previously used account.aws cli读取~/.aws文件中声明的aws_session_tokenaws_security_token时,也会发生此错误,这可能与以前使用的帐户相关联。 Removing both and leaving just the key and the credentials associated to the account where the bucket is will force aws to establish the connection.删除两者并只留下与存储桶所在帐户关联的密钥和凭据将强制aws建立连接。

Please delete .aws/credentials file from your users account and reconfigure your aws cli.请从您的用户帐户中删除.aws/credentials文件并重新配置您的 aws cli。 If you already associated with another account then there are high chances of this type of error.如果您已经与另一个帐户相关联,那么发生此类错误的可能性很高。

Run aws configure运行 aws 配置

  1. You may leave access key and access key id blank if you have an IAM role attached如果您附加了 IAM 角色,您可以将访问密钥和访问密钥 ID 留空

  2. Set value for 'region'设置“区域”的值

Now you will be able to successfully run 'aws s3 ls'现在您将能够成功运行“aws s3 ls”

Else run 'aws s3 ls --region '否则运行'aws s3 ls --region'

在 .aws 凭据文件中删除会话令牌,它将起作用

If you are using AWS Single Sign-on you can pass --profile <profile_name> and it should solve the issue如果您使用的是 AWS Single Sign-on,您可以传递--profile <profile_name>它应该可以解决问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 AWS Lambda,调用 PutObject 操作时发生错误 (InvalidToken):提供的令牌格式错误或无效 - AWS Lambda, An error occurred (InvalidToken) when calling the PutObject operation: The provided token is malformed or otherwise invalid 提供的令牌格式错误或无效 - The provided token is malformed or otherwise invalid AWS S3 ListBuckets 操作:拒绝访问 - AWS S3 ListBuckets operation: Access Denied AWS boto3 - 调用 GetObject 操作时出现 InvalidToken 错误 - AWS boto3 - InvalidToken Error when calling the GetObject operation 致命错误:调用ListObjects操作时发生错误(403): 恢复AWS S3同步 - fatal error: An error occurred (403) when calling the ListObjects operation: Forbidden | Resuming an aws s3 sync AWS S3:调用 GetObject 操作时发生错误 (AccessDenied):拒绝访问 - AWS S3: An error occurred (AccessDenied) when calling the GetObject operation: Access Denied AWS S3 和 Django 返回“调用 PutObject 操作时发生错误 (AccessDenied)” - AWS S3 and Django returns "An error occurred (AccessDenied) when calling the PutObject operation" AWS BOTO3 S3 python - 调用 HeadObject 操作时发生错误 (404):未找到 - AWS BOTO3 S3 python - An error occurred (404) when calling the HeadObject operation: Not Found AWS s3 cp命令返回:调用ListObjects操作时发生错误(InvalidRequest) - AWS s3 cp command returns: An error occurred (InvalidRequest) when calling the ListObjects operation AWS CLI S3 调用 HeadObject 操作时发生客户端错误 (403):禁止访问 - AWS CLI S3 A client error (403) occurred when calling the HeadObject operation: Forbidden
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM