doufu7835 2019-02-06 17:58
浏览 132

多年无法预签名URL?

Signature Version 4 is maximum for a week. In Python I did:

s3_client = boto3.client('s3',
                         aws_access_key_id=access_key,
                         aws_secret_access_key=secret_key,
                         config=botocore.client.Config(signature_version='s3')
                         )

    return s3_client.generate_presigned_url(
        'get_object',
        Params={
            'Bucket': bucket_name,
            'Key': key
        },
        ExpiresIn=400000000)  # this is a max: ~ten years

But for Go I found only func (*Request) Presign:

req, _ := s3Client.GetObjectRequest(&s3.GetObjectInput{
    Bucket: aws.String(bucketName),
    Key:    &key,
})
tenYears := time.Now().AddDate(10, 0, 0).Sub(time.Now())
url, err := req.Presign(tenYears)

HTTP response for such URL is: AuthorizationQueryParametersError: X-Amz-Expires must be less than a week (in seconds); that is, the given X-Amz-Expires must be less than 604800 seconds.

No way to presign URL in Go using AWS SDK for years?

  • 写回答

1条回答 默认 最新

  • duandi4815 2019-02-06 18:09
    关注

    If you want to pre-sign URL for longer than a week, then your use case for pre-signed URLs is not valid. According to the spec it is really just one week.

    Pre-signed URLs are often used to serve content from S3 to authenticated users only.

    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?