首页 > 解决方案 > 如何为 S3 存储桶中的对象(JSON 文件)创建可下载的 URL?

问题描述

我有一个对象保存在 s3 存储桶中。我想为该对象创建一个可下载的 URL。我用generate_presigned_url, 作为:

s3_client = boto3.client('s3')

json_url = s3_client.generate_presigned_url('get_object',
    Params={'Bucket': <bucket_name>, 'Key': <json_file>}, ExpiresIn=86400)

但是,当我单击提供的 url 时,我收到以下错误:

<Error>
    <Code> SignatureDoesNotMatch </Code> 
    <Message> The request    signature we calculated does not match the signature you provided.    Check your key and signing method. ... 
...
</Error>

任何想法?

标签: pythonamazon-web-servicesamazon-s3downloadboto3

解决方案


推荐阅读