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

129
Visualizações
aws policy for read/write to a file within a bucket

I have the following s3 structure:

bucket name: test-bucket

file: test.json

And I have the following aws policy:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "s3:PutObject",
            "Action": "s3:GetObject",
            "Action": "s3:DeleteObject",
            "Action": "s3:ListBucket",
            "Resource": "arn:aws:s3:::test-bucket"
        }
    ]
}

And this policy is attached to a user with access key 123.

When I try to put or get the test.json in the test-bucket using the sdk as this:

BasicAWSCredentials awsCreds = new BasicAWSCredentials("123", "secretKeyId");
s3Client = AmazonS3ClientBuilder.standard()
                        .withCredentials(new AWSStaticCredentialsProvider(awsCreds))
                        .withRegion("US-EAST-1")
                        .build();
s3Client.putObject(new PutObjectRequest("test-bucket", "test.json", file));

This will give the access deny problem.

If I change the policy's resource to

 "Resource": "*"

then it will work. I just want to make sure the resource I put is in correct format. What went wrong?

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

You need to let amazon know that beside your bucket you also want to access content of your bucket.

So change resource from:

"Resource": "arn:aws:s3:::test-bucket"

To something like:

"Resource": [
    "arn:aws:s3:::test-bucket",
    "arn:aws:s3:::test-bucket/*"
]
about 4 years ago · Santiago Trujillo Relatório
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