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

134
Visualizações
Make all keys in s3 bucket private

I have a bucket with 10^6 keys in it. I want to make all objects in it private.

I tried s3cmd which fails after sometime. I tried it with boto3, but it is painfully slow.

import boto3

boto3.setup_default_session(aws_access_key_id=access_key_id, aws_secret_access_key=secret_access_key)
s3_client = boto3.client('s3')
s3_resource = boto3.resource('s3')

bucket = s3_resource.Bucket(bucket_name)
bucket_acl = bucket.Acl()

i = 0

for object_summary in bucket.objects.all():
    i += 1
    object_acl = object_summary.Acl()
    if i % 100 == 1:
        print('{} {}'.format(i, object_summary.key))

    object_acl.put(ACL='private')

Is there any way to do batch operation or do everything private by setting some bucket policy.

Any other suggestion is also welcome.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Unfortunately i did not find a good solution. I decided to run it for 70 hours with nohup in background.

A possible solution I thought was to split keys in bucket into multiple sets and run them using multiple threads.

But in the end I just waited 70 hours.

over 4 years ago · Santiago Trujillo Relatório

0

You don't need to do anything. Objects in Amazon S3 are private by default.

Things that make them public are:

  • Bucket Polices on the bucket containing the objects
  • Permissions granted to Users, Groups and Roles in Amazon IAM
  • Permissions applied specifically to each object ("ACLs")
over 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