I'm trying to create an S3 pre-signed URL in my JavaScript code using:
var params = {Bucket: 'myBucketName', Key: 'key', Expires: 60};
var url = s3.getSignedUrl('getObject', params);
console.log('The URL is ', url);
After executing, my console log shows:
The URL is .mp3...
but I think it should be showing:
The URL is .mp3...
Why would it place the S3 bucket name before "s3.amazonaws" in the URL?
In the past it was working fine using this method. Has the AWS SDK changed?
I'm trying to create an S3 pre-signed URL in my JavaScript code using:
var params = {Bucket: 'myBucketName', Key: 'key', Expires: 60};
var url = s3.getSignedUrl('getObject', params);
console.log('The URL is ', url);
After executing, my console log shows:
The URL is https://myBucketName.s3.amazonaws./myAudioFile.mp3...
but I think it should be showing:
The URL is https://s3.amazonaws./myBucketName/myAudioFile.mp3...
Why would it place the S3 bucket name before "s3.amazonaws." in the URL?
In the past it was working fine using this method. Has the AWS SDK changed?
Share Improve this question edited Oct 25, 2018 at 20:04 jarmod 79k18 gold badges130 silver badges135 bronze badges asked Oct 25, 2018 at 17:56 HackbrewHackbrew 5132 gold badges12 silver badges26 bronze badges 4- 1 Your bucket is accessible either way. Is this causing a problem? – Brad Commented Oct 25, 2018 at 19:57
- 1 Note that bucket.s3.amazonaws./cat.png is a virtual-hosted–style URL, while s3.amazonaws./bucket/cat.png is a path-style URL. Both are valid. – jarmod Commented Oct 25, 2018 at 20:06
-
Both are valid only for buckets in us-east-1. Path-style must reference the regional endpoint, otherwise, e.g.
https://s3.us-east-3.amazonaws./example-bucket
for us-east-2. – Michael - sqlbot Commented Oct 26, 2018 at 0:43 - What is the actual problem you are experiencing? – Michael - sqlbot Commented Oct 26, 2018 at 0:44
1 Answer
Reset to default 3That's the format of signedURL for AWS s3 bucket. When AWS form a signed user for getObject
or putObject
this format remain same.
Format for AWS signed url is:
https://
bucketName
provided. this isBucket
.s3.amazonaws./
fileName
provided. This isKey
Since we can't change the format of coding or URL or function provided by AWS, thus more important then format is Does URL does what you want it to do? Is this URL able to download s3 file and expire after 60 seconds?
Do follow these docs over AWS signed URL.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745047193a4608171.html
评论列表(0条)