小编Con*_*boy的帖子

从 s3 检索文件失败,并显示“提供的令牌已过期”。不过,相同的文件适用于 AWS CLI

当我尝试从 s3 检索文件时遇到问题。我能够按预期连接到 s3 存储桶,但是当我尝试检索文件时,出现以下错误。 凭证是从我的中获取的./aws/credentials我可以使用 AWS CLI 从本地下载相同的文件。 有什么想法这里可能有什么问题吗?

Error: 
awsError
code = ExpiredToken
message = The provided token has expired.
statusCode = 400

Result, err := client.GetObject(&s3.GetObjectInput{
        Bucket:              &bucket,
        Key:                 &Key,
        ResponseContentType: aws.String("application/json"),
    })
    if err != nil {
        logger.Errorf("Unable to retrieve file the file", err.Error())
        return nil, http.StatusInternalServerError
    }

Run Code Online (Sandbox Code Playgroud)

amazon-s3 amazon-web-services

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

amazon-s3 ×1

amazon-web-services ×1