0

I'm storing files in Amazon S3 and want to view them in HTML in an iframe src but I'm having trouble constructing the URL required to access files from S3. I'm using Python's Boto library, and my permission settings allow for public access. This is what I tried...

https://[BUCKET_NAME].s3.amazonaws.com/[UNIQUE_KEY]?AWSAccessKeyId=xxxxxxxxxxxxx

However, this is throwing an error.

<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>0A115D93B8454F2F</RequestId>
<HostId>
YxcOdP2zYWw8Vl1p137Ipaqrcx3sPN68PEFRb8H9Kv5XlyRtye7xB0ZuVB/mvDWp
</HostId>
</Error>

UPDATE: There were some issues with the public settings, which are now fixed but when I enter the above in the iframe src, my browser starts downloading the file. I want to simply view it!

Suraj Kapoor
  • 1,615
  • 4
  • 22
  • 34

1 Answers1

1

You should assign content_type correctly when uploading file to S3. If browser recognizes the file content-type, it shows the file instead of store the file. See how to assign content-type here: http://boto.readthedocs.org/en/latest/ref/s3.html#module-boto.s3.key

petertc
  • 3,607
  • 1
  • 31
  • 36