AWS S3 thumbnail "Access denied" - amazon-web-services

I followed Tutorial: Using an Amazon S3 trigger to create thumbnail images - AWS Lambda to create a thumbnail for my images.
However, when I try to access the images in bucket-resized I get an Access Denied.

That tutorial does not create 'public' objects.
If you want the resized objects to be public, you would either need to:
Create a Bucket Policy on the 'resized' bucket that grants s3:GetObject access for the bucket (see Bucket policy examples - Granting read-only permission to an anonymous user), OR
When uploading the object, use ACL='public-read', which will make the individual objects public
To make the bucket or objects public, you will also need to disable S3 Block Public Access on the bucket.

check if the thumbnail is generated successfully
check your bucket has public accessibility enabled
check if the generated file thumbnail has public read permission

Related

Insufficient permissions to list objects for bucket "XXXX" while deleting AWS S3 bucket

I got accidentally locked out of the AWS S3 bucket by not meeting certain conditions. I accidentally set bucket policies that explicitly deny access to any requests outside the allowed IP addresses. Now I am not able to either list objects, view the permissions, or anything inside the bucket and completely locked out of it.
How can I regain access to the bucket?
Here are some of the error screenshots:
Insufficient Permissions to list oBjects for a bucket while trying to delete the bucket
Objects Page
Permission Page
You can do this as a root user as explained in the following AWS docs:
I accidentally denied everyone access to my Amazon S3 bucket. How do I regain access?

can't view S3 Bucket image object from EC2 hosted website

I created an IAM role that gives full access to the S3 Bucket and attached it to the EC2 instance. However, I am unable to view the image when I try to view it from the EC2 hosted website. I keep getting a 403 Forbidden code.
Below is the IAM role and the policy attached:
It is seen that GetObject is enabled:
But the error still persists:
Any advice on how to solve this? Thank you for reading.
The URL you are using to access the object does not appear to include any security information (bucket.s3.amazonaws.com/cat1.jpg). Thus, it is simply an 'anonymous' request to S3, and since the object is private, S3 will deny the request.
The mere fact that the request is being sent from an Amazon EC2 instance that has been assigned an IAM Role is not sufficient to obtain access to the object via an anonymous URL.
To allow a browser to access a private Amazon S3 object, your application should generate an Amazon S3 pre-signed URLs. This is a time-limited URL that includes security information that identifies you as the requester and includes a signature that permits access to the private object.
Alternatively, code running on the instance can use an AWS SDK to make an API call to S3 to access the object (eg GetObject()). This will succeed because the AWS SDK will use the credentials provided by the IAM Role.

Allow CloudFront to access S3 origin while also having S3 bucket Block all public access?

I am trying to setup the S3 buckets I want my CloudFront distribution to access.
From my client I use AWS mobile SDK to upload to S3. When clients consume files from S3 I hit CloudFront and things worked until I made this change:
When I created the distribution, I had CloudFront update the bucket policy to have the OAI included in the principal:
So, then I thought I could run GET calls on CloudFront, because CloudFront has the OAI setup and S3 bucket reflects that.
However, I keep getting Access denied:
What else do I need to do to secure down the bucket and only allow CloudFront to read and allow my client app to be able to upload files to it using the SDK configured with the poolId I have setup for it?. Unless I leave the "Block all public access" unchecked, I get access denied via CloudFront.
Unfortunately according to the documentation the following is stated:
Amazon S3 Block Public Access must be disabled on the bucket.
This is because it will ignore the bucket policy due to the Block public and cross-account access to buckets and objects through any public bucket or access point policies value.
Unless your bucket policy also allows anonymous GetObject by default your objects will not be public.

How to solve s3 access denied on file added to s3 bucket from another account?

I have two accounts, A and B. A has a S3 bucket, B has a lambda function which sends a csv to S3 bucket in account A. I am creating these resources using terraform.
After I login to Account A, I am able to see the file added, but not able to Download or Open the file, it says Access Denied. I see the below in the Properties section of the file.
I did not add any encryption to the file or bucket.
By default, an S3 object is owned by the AWS account that uploaded it. This is true even when the bucket is owned by another account. To get access to the object, the object owner must explicitly grant you (the bucket owner) access.
The object owner can grant the bucket owner full control of the object by updating the access control list (ACL) of the object. The object owner can update the ACL either during a put or copy operation, or after the object is added to the bucket.
Please refer to this guide in order to resolve this issue and apply the required permissions.
It also links to a description how to use a bucket policy to ensure that any objects uploaded to your bucket by another account sets the ACL as "bucket-owner-full-control".

S3 Bucket objects access denied for existing one

I had configured my bucket with public access to all my objects
But older files is still not public.
If i access my old objects i'm getting access denied.
I have to manually change them to public no other option for me.Currently i have 5000 objects inside my bucket.Manually changing them is not possible
Is there any other thing to change in my bucket configuration from the default one..
You can use aws cli command to achieve that.Use aws s3api put-object-acl.
Description :
uses the acl subresource to set the access control list (ACL)
permissions for an object that already exists in a bucket.
Be aware that the put-object-acl command is for a single object only. In case you want to run it recursively, take a look at this thread.
More about How can I grant public read access to some objects in my Amazon S3 bucket?