简体   繁体   English

使用 aws cli 将 S3 object url 上传到存储桶后,如何获取它?

[英]How to get S3 object url after it's been uploaded to a bucket using aws cli?

I have a file which needs to be uploaded to an s3 bucket which has public read access.我有一个文件需要上传到具有公共读取访问权限的 s3 存储桶。

I need to use that s3 object's url somewhere else after uploading the file.上传文件后,我需要在其他地方使用该 s3 对象的 url 。

How do I get the url of the s3 object after it's been uploaded to the bucket? s3 object的url上传到bucket后如何获取?

I'm using aws-cli to upload the file:我正在使用 aws-cli 上传文件:

aws s3 cp local_file s3_location

I'm looking probably for something like https://s3_bucket-region.amazonaws.com/folder/filename.format我可能正在寻找类似https://s3_bucket-region.amazonaws.com/folder/filename.format

You can construct the URL Path-style access , you have all the information.您可以构建 URL 路径式访问,您拥有所有信息。

https://bucket-name.s3.Region.amazonaws.com/key name

In this example, my-bucket is the bucket name, US West (Oregon) is the Region, and puppy.png is the key name在本例中,my-bucket 为存储桶名称,US West (Oregon) 为 Region,puppy.png 为键名

https://my-bucket.s3.us-west-2.amazonaws.com/puppy.png

NOTE : path-style URLs style will be deprecated soon. NOTE :路径样式的 URL 样式将很快被弃用。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM