Cloudfront + S3 permissions - ruby-on-rails

Some background. I'm using Rails + Carrierwave + S3 + Cloudfront.
I have a bucket and in the bucket there are many files. All the files are public. There is one file in particular. I can go to it on the S3 Console, select it, click on properties, and click on the link. It's a photo, so the photo will appear. I'm assuming that because I can do this, the photo has the correct public permissions.
I have a Cloudfront distribution pointing to this bucket. The Restrict Bucket Access is set to NO.
When I try to look at the photo through Cloudfront I get the error:
<Error>
<script/>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>blah</RequestId>
<HostId>
blahblahblah
</HostId>
</Error>
This is driving me absolutely bonkers. If anyone has any suggestions, I'd greatly appreciate it!

Related

403 Forbidden Error for accessing images on google cloud bucket after transferred from one bucket to another

Actually I am using google cloud bucket for image upload in my rails app. I am using paper clip for image upload. I have used bucket name "abcd-old". I uploaded some of the images through app. It was working fine. But as of now I transffered the content of "abcd-old" bucket to new bucket "abcd-new". Also set the same permission as it was for old one. But now images are broken in the app. it shows "403 forbidden error". If I upload new image that will work. But old I mean transffered images are broken. Please help me on this.
This is the error I am getting
<Error>
<Code>AccessDenied</Code>
<Message>Access denied.</Message>
<Details>
Anonymous users does not have storage.objects.list access to bucket abcd-new.
</Details>
</Error>
We can resolve this issue by command line
gsutil -m acl -r set public-read gs://abcd-new
Please go through this link for more details http://tekhoow.blogspot.in/2015/12/soving-accessdenied-on-google-cloud.html

I've uploaded an image for my website on s3 but it doesn't display on my website

I've uploaded an image for my website on s3 but it doesn't display on my website. It works fine on my localhost, as the picture is in my assests/images folder of my Rails 5 app, but not on Heroku. When I inspect my page, I do see an error for the file my code is looking for: Failed to load resource: the server responded with a status of 404 (Not Found) .I do believe I have my Heroku set up right with my amazon s3 bucket because I can see users' pictures being sent to it. I'm looking to use this picture as a background for part of my landing page. Any help would be great, thanks.
I made the image inside my 's3 bucket' public so that it could be accessed by my website. Also, I changed my url for the image in my Rails app to the new url provided by amazon s3.

iOS AWS S3 Transfer Utility not uploading

I've implemented this tutorial exactly, and i'm able to successfully upload an image to a s3 bucket using the uploadData method (the completion handler block runs with error=nil). My problem is that I can't see the file in the bucket when i'm looking through the AWS console, so I'm not sure if the image was uploaded successfully and due to wrong permissions or something like that I can't find it or if the image was not really uploaded.
Any idea what's wrong ?
Edit -
I've added permissions to the S3 bucket in the role policy of the new Cognito pool id that I've created for the client authentication purposes, but still no help.
Edit 2 -
I've also opened permissions on the bucket itself to everyone.
Make sure your bucket was created in the same region as your Cognito pool ids.

How to display a paperclip image in an email?

I have a photo saved for a user.
I want to be able to send them an email and include their photo.
In the actionmailer email view I have
<%= image_tag #user.photo.url(:medium) %>
The photo's filename is included in the email as text.
How do I embed/show the actual photo?
Paperclip is used to add the photo and AWS S3 is used to store the photo.
The link looks almost correct except for a few numbers at the end
http://s3.amazonaws.com/applicantlabs/applications/photos/000/000/011/medium/breakingnews-img_2x-ipad.png?1431789984
and when I click on the link the page displays the following error
<Error>
<Code>PermanentRedirect</Code>
<Message>
The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.
</Message>
<Bucket>applicantlabs</Bucket>
<Endpoint>applicantlabs.s3.amazonaws.com</Endpoint>
<RequestId>30457ECCCF09A</RequestId>
<HostId>
igkrUR0P/wes3aqpT7nAj2U7KXK91Qs+RBxwufjex15MPN5z1UCK8F2WSg6q0
</HostId>
</Error>
To use this Paperclip S3 setup my S3 bucket had to be of type "US Standard". As this was a new app with no images in the bucket, I just created a new "US Standard" S3 bucket.

Amazon S3 file request error

I am currently attempting to implement Amazon S3 into my rails application but am walking into an issue.
The gems i am using is CarrierWave and Fog.
This is the error i get when i try visit a file/image url.
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>42B0F41E7EF92ACC</RequestId>
<HostId>ESYXvkVKxnsu32LjfcsiErZ27IK44ItREPB68sBBHXqWHtzkN9fnc04oj8IzCEFg</HostId>
</Error>
This is the url my app is serving to view the image
https://vapenz-images.s3.amazonaws.com/uploads/product_image/image/2/Capture.PNG?AWSAccessKeyId=AKIAIEWRNU2VPG5SF7XQ&Signature=GcjA%2Bx46Q9wU%2BuaffhfCTLbLuAY%3D&Expires=1414545697
And here is a picture of the permissions.
My rails app currently can upload a image to s3 but it cant view them, i am quite lost.
Thanks for the help!

Resources