简体   繁体   中英

AWS CDN create signed url for specific S3 object version

Is it possible to create a signed URL for S3 object with particular version. The idea is to have the same image name but different signed url for all the versions of the image.

Yes.

Here are some sample pre-signed URLs that point to a particular object version, with old and new signature format:

http://mybucket.s3-ap-southeast-2.amazonaws.com/cat.jpg?versionId=XXX&AWSAccessKeyId=YYY&Expires=1458463363&Signature=ZZZ

https://s3-ap-southeast-2.amazonaws.com/mybucket/cat.jpg?versionId=XXX&X-Amz-Date=20160319T084413Z&X-Amz-Expires=300&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Signature=VVV3&X-Amz-Credential=YYY/20160319/ap-southeast-2/s3/aws4_request&X-Amz-SignedHeaders=Host&x-amz-security-token=ZZZ

You can see this in action in the S3 console -- just create a versioned file, then choose Actions/Open. It will generate a signed URL for the given version of the object.

As to how to code this... I'm not sure! However, I did verify that a signature for one version will not work with another version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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