Fook
Fook

Reputation: 5550

Does CloudFront support versioned origins?

I have a versioned S3 bucket as my origin. Is this the correct format for accessing a specific version of an object from CloudFront?

http://example.cloudfront.net/files/file.pdf?verisonId=[id]

It is ignoring versionId and always serving the head object.

My S3 Bucket Policy allows the following actions for CloudFront:

s3:GetObjectVersion

s3:GetObject

I've searched and searched but can't seem to find any documentation on this. How do I specify a versionId in a CloudFront URL?

Upvotes: 1

Views: 567

Answers (1)

Fook
Fook

Reputation: 5550

I figured this out. In CloudFront go to Distributions > Behaviors. Set "Forward Query Strings" to Yes. This will allow CloudFront to pass versionId to S3 and cache the correct version.

Note that you also only need the s3:GetObject bucket policy action to make this work.

Upvotes: 2

Related Questions