Cloudfront: Do the files in my origin bucket need to be publicly readable - amazon-s3

I currently serve files on S3 that are private. I would like to serve files via Cloudfront but I keep getting an AccessDenied error. I have tried multiple combinations
With and without Cloud front key pairs
With and without AWS access keys
But nothing works. Do the files on my S3 bucket need to be publicly readable and then I just restrict access to them via Cloudfront by setting bucket policies?
Thanks

Yes. There is no inherent connection between S3 and CloudFront. From the perspective of S3, CloudFront is just another "user" trying to access the content. Therefore, the S3 bucket has to give permission to CloudFront to access the content. Keep in mind that there is no way to set permissions on the CloudFront distribution so your content will be publicly available that way.

Related

How is security done at folder level within a single bucket in aws s3?

I am very naive at AWS s3. Recently, we have a requirement of using the AWS s3 bucket for storing big files. I wanted to know, How do we do security at folder level within a single bucket in s3? Do S3 takes care of that? If yes, by what means? I understand that. they do encryption and decryption of data, but that does not suffice. We are a service provider, where multiple tenants would be using the same bucket. How folder within AWS bucket can be isolated with security? For one bucket there will be single access-key, but what about a folder in a bucket?
You should use a bucket policy to restrict/Allow user access to the folder. You can do this using the S3 Console or you can assign an IAM role to the user. Please take a look at the link for more details.
https://aws.amazon.com/blogs/security/writing-iam-policies-grant-access-to-user-specific-folders-in-an-amazon-s3-bucket/

How do I host a static website on S3 with an ACL?

I'm currently hosting a project of mine on S3 and that results in a URL like: https://s3.eu-central-1.amazonaws.com/my-project/index.html
Using Cloudfront, I'm able to make this a lot nicer so that I can access this page using https://my-project.com/. I can add an ACL to this url so that only certain IPs can access it, but the bucket itself will still be wide open to the world. How would I also apply the ACL to the bucket?

Attach S3 bucket to URL endpoint

How can I attach an S3 bucket to an URL on my site. I tried but could not get it to work.
For instance my URL is:
mysite.com/media
And my S3 bucket should be linked directly to the above URL?
You're going to want to use CloudFront in front of S3. This will allow you to use your domain and serve content from S3.
Check out Using CloudFront with Amazon S3 for details on how to do it.

Users Unable to Access S3 Image

Originally I have:
a Bucket (Singapore) , and then I copied this bucket to another region using the AWS CLI.
But the problem is that the resulted images in the new bucket is not accessible via web.
Any thoughts?
p.s: I had never set any policy to both buckets before.
By default, all content in an Amazon S3 bucket is private.
You can grant access to Amazon S3 objects in several ways:
Object-level ACLs: You can make individual files public by ticking the Read permission in the S3 console. This applies only to the specific file.
Bucket Policy: This is applied to the bucket, which assigns permissions to the whole bucket or paths within the bucket. For example, make all objects public. (See Example bucket policies)
IAM Policy: You can create a policy and apply it to a specific IAM User or IAM Group. The policy can grant access to specific buckets or paths within buckets, similar to the Bucket Policy.
Pre-Signed URLs: These can be generated by applications to grant time-limited access to objects stored in Amazon S3.
So, if you think that your users should able to access the files in your bucket, make sure you have granted access via one of the above methods.

What are Best practices for delivering user-generated content sharing service globally from Amazon S3?

What are the issues for using Amazon S3 to store user-uploaded photos and video and delivering these to users around the world. One user's uploads may be viewed by users in any location. Is this the use-case for using Amazon CloudFront?
We really want a Global S3 bucket - why oh why has amazon set up regions!!
cheers
You already have the answer. That's exactly what CloudFront is for.
Its pretty trivial to 'link' CloudFront to your bucket, which then means your content is served from multiple edge locations around the world.
Like S3, you can public or private ditributions and you can now use the new Identity and Access Management (IAM) to protect your content too.