Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
ec2 can't access another s3 file in the same bucket

I have an S3 bucket and an EC2 with a role that access to that bucket. The ec2 can access s3://mybucket/folderA/file1, but can't access s3://mybucket/folderB/file2. I can't seem to figure out why I can access file1 but not file2 from the ec2 instance. When I try to download file2 like this:

aws s3 cp s3://mybucket/folderB/file2 /home/ec2-user/file2

I get this error:

fatal error: An error occurred (403) when calling the HeadObject operation: Forbidden

But I don't get that error when i download file1:

aws s3 cp s3://mybucket/folderA/file1 /home/ec2-user/file1

----EDIT------

I missed the 403 error...so I guess the question is why isn't it seeing the file

----EDIT-----

here is my bucket policy

{
    "Version": "1-1-1",
    "Id": "Policy111111111",
    "Statement": [
        {
            "Sid": "Sxxxxxxx1234",
            "Effect": "Deny",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": [
                "arn:aws:s3:::mybucket",
                "arn:aws:s3:::mybucket/*"
            ],
            "Condition": {
                "StringNotEquals": {
                    "aws:sourceVpc": "vpc-a8xxxxx"
                }
            }
        },
        {
            "Sid": "RequiredEncryptedPutObject",
            "Effect": "Deny",
            "Principal": "*",
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::mybucket/*",
            "Condition": {
                "StringNotEquals": {
                    "s3:x-amz-server-side-encryption": [
                        "AES256",
                        "aws:kms"
                    ]
                }
            }
        }
    ]
}
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!