Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda