Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

151
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda