EC2 instance launched S3 Endpoint subnet unable to list bucket object with endpoint bucket policy - amazon-s3

I have created S3endpoint and added it to route table of a subnet.
Subnet has route to internet and able to open AWS console.
Next a bucket is created with bucket policy limiting access to it through VPC endpoint.
I have IAM user which has full permission to this bucket.
When i access the S3 bucket through S3 console webpage there is an error 'Access Denied' but i am able to upload files to the bucket.
Does S3 endpoint imply that only access will be through AWS CLI \SDKs? and console access is limited?

Does S3 endpoint imply that only access will be through AWS CLI \SDKs?
and console access is limited?
My understanding is that any calls done in the AWS Console will not use the endpoint setup within the VPC, even if you're accessing it via an EC2 instance within the VPC. This is because the UI within the AWS Console does not directly access the S3 API Endpoint, but instead goes through a proxy to reach the endpoint.
If you need to access the S3 bucket via the AWS Console, you'll need to amend your bucket policy.

Related

ALB logging to S3 bucket: Access Denied

Why do I keep getting the following error? I'm simply trying to turn on logging for an application load balancer and specifying an S3 bucket to log to.
I'm logged in as root and have permissions on the bucket set to allow root (me) to perform all operations.
Does its bucket policy allow Elastic Load Balancing account ID?
Attach a policy to your S3 bucket - Enable access logs for your Application Load Balancer - Elastic Load Balancing
For the Regions in the list below, use the following policy, which grants permissions to the specified Elastic Load Balancing account ID.

S3 hosted website only accessible via Private Endpoint

I have a task to host a website on S3 which is only accessible via the private link.
I created the website, and I am able to access it using the public link
Link --> http://mywebsite.com.s3-website-us-east-1.amazonaws.com
I also created a VPC interface endpoint to access the bucket privately over the VPN. I got the DNS name from the Interface endpoint as
*.vpce-xxxxx-xxx.s3.us-east-1.vpce.amazonaws.com
I did the nslookup on the mywebsite.com.vpce-xxxxx-xxx.s3.us-east-1.vpce.amazonaws.com and is getting the correct IP addresses of the ENI's
When I try to access the webite thru the VPC Interface endpoint I am getting bucket does not exist. What I am doing wrong ?
I am using this url to access the bucket.
Link : http://mywebsite.com.vpce-xxxxx-xxx.s3.us-east-1.vpce.amazonaws.com
For this POC my bucket policy is wide open so there is no restriction on the bucket policy.
Looks like this isn't supported.
https://docs.aws.amazon.com/AmazonS3/latest/userguide/privatelink-interface-endpoints.html#accessing-bucket-and-aps-from-interface-endpoints
AWS PrivateLink for Amazon S3 does not support the following:
Federal Information Processing Standard (FIPS) endpoints
Website endpoints
Legacy global endpoints
Using CopyObject API or UploadPartCopy API between buckets in different AWS Regions
Transport Layer Security (TLS) 1.0

How to access Amazon S3 bucket to the Kubernetes pods using IAM roles instead of Access key & secret keys?

I am trying to mount S3 bucket using s3fs-fuse to the Kubernetes pod. My S3 bucket is protected by IAM roles and i dont have Access Keys and Secret Keys to access S3 bucket. I know how to access a S3bucket from the Kubernetes pod using Access & Secrets Keys, but how do we access S3 bucket using IAM roles ?
Does anyone has suggestion on doing this ?
You use the IRSA system, attaching an IAM role to a Kubernetes service account and then attaching that K8s SA to your pod. See https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html for a starting point.

AWS CLI - how to get when the file was changed

A client is uploading data we use to AWS S3. I need to find out when the uploads took place in the last week (or month). How could I go about that? If I use aws s3 ls path I get only the date of the last change.
To obtain historical information about Amazon S3 API calls, you can use AWS CloudTrail.
From Logging Amazon S3 API Calls by Using AWS CloudTrail - Amazon Simple Storage Service:
Amazon S3 is integrated with AWS CloudTrail, a service that provides a record of actions taken by a user, role, or an AWS service in Amazon S3. CloudTrail captures a subset of API calls for Amazon S3 as events, including calls from the Amazon S3 console and from code calls to the Amazon S3 APIs.
To use object-level logging, see: How Do I Enable Object-Level Logging for an S3 Bucket with AWS CloudTrail Data Events? - Amazon Simple Storage Service

How protect Amazon S3 via Basic Authentification

I am new to S3 and am wonding how I could protect access to S3 or cloud front via Basic Authentification while installing a private certificate into Chrome, that allows access. Is there anything like this?
It is not possible to use Basic Authentication with Amazon S3 nor Amazon CloudFront.
Amazon S3 access can be controlled via one or more of:
Access Control List on the object level
Amazon S3 Bucket Policy
AWS Identity and Access Management (IAM) Policy
Amazon CloudFront has its own method of controlling access via signed URLs and signed cookies.