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

149
Views
How to prevent direct access to Amazon S3?

This is my bucket policy:

{
    "Version": "2012-10-17",
    "Id": "Policy3451901640290",
    "Statement": [
        {
            "Sid": "Stmt3451901619319",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::bucket1/*"
        }
    ]
}

And this is my cors:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>DELETE</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <ExposeHeader>ETag</ExposeHeader>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

All files inside my bucket must be reading accessible for everyone but only viewable through my website, Is there a simple way to deny direct access to S3?

UPDATE

I tried to add this to my policy:

"Condition":{
        "StringLike":{"aws:Referer":["http://www.example.com/*","http://example.com/*"]}
      } 

Anyway I can access all my files outside of my website directly through S3 instead I would like something like this:

Suppose I have this file on my bucket:

https://s3-eu-west-1.amazonaws.com/bucket1/example.jpg

If a user go to that link now he/she can see that image. Instead I would like to be accessible only from my website.

Let's say on my example.com I have this:

<img src="https://s3-eu-west-1.amazonaws.com/bucket1/example.jpg" />
about 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!