问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/36098263/aws-cdn-create-signed-url-for-specific-s3-object-version