如何通过AWS CLI生成预签名的S3 URL [英] How to Generate a Presigned S3 URL via AWS CLI

查看:681
本文介绍了如何通过AWS CLI生成预签名的S3 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用AWS CLI为S3存储桶中的对象创建预签名URL?

Is there a way to create presigned URL for objects in S3 bucket using AWS CLI?

我知道可以使用SDK来完成,但是使用CLI可以吗?

I know that could be done using SDK, but is it possible with CLI?

我在其中一个AWS文档中找到了它,但是无法完成命令:

I found this on one of the AWS docs, but can't complete the command:

s3cmd signurl s3://BUCKET/OBJECT <expiry_epoch|+expiry_offset>

有帮助吗?

推荐答案

您尝试看到s3前缀?

为Amazon S3对象生成一个预签名URL.这允许任何人 谁接收到预签名的URL以使用HTTP检索S3对象 GET请求.对于sigv4请求,需要配置区域

Generate a pre-signed URL for an Amazon S3 object. This allows anyone who receives the pre-signed URL to retrieve the S3 object with an HTTP GET request. For sigv4 requests the region needs to be configured explicitly.

这将生成一个将在3600秒内失效的URL(默认值)

This will generate a URL that will expire in 3600 seconds (default)

aws s3 presign s3://mybucket/myobject

这将生成一个将在300秒后失效的URL

This will generate a URL that will expire in 300 seconds

aws s3 presign s3://mybucket/myobject  --expires-in 300

输出

https://mybucket.s3.amazonaws.com/myobject?AWSAccessKeyId=AKIAJXXXXXXXXXXXXXXX&Expires=1503602631&Signature=ibOGfAovnhIF13DALdAgsdtg2s%3D

这篇关于如何通过AWS CLI生成预签名的S3 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆