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

223
Vistas
Unable to connect to S3 using BOTO

I am trying to connect S3 using boto.

I am able to list S3 bucket details using s3 CLI commands but boto is unable to establish connection

boto version: 2.46.1 Python Version: 2.7.12

My code is as follows and the error message is "[Errno 104] Connection reset by peer"

#!/home/python-workdir/python-2.7.12/bin/python
import os, sys
import math
import boto
from boto.s3.key import Key
import boto.s3.connection

AWS_ACCESS_KEY_ID = 'XXXXXXXXXXXXXXXXXXXXX'
AWS_SECRET_ACCESS_KEY = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY'
Bucketname = 'bucket/private/im/poc/master/1/testbucket'

conn = boto.s3.connect_to_region('ap-southeast-2',
       aws_access_key_id=AWS_ACCESS_KEY_ID,
       aws_secret_access_key=AWS_SECRET_ACCESS_KEY,
       calling_format = boto.s3.connection.OrdinaryCallingFormat(),
       )
print "conn success"
bucket = conn.get_bucket(Bucketname)
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Since you've play with AWS CLI, why don't you start changing your code to boto3, use the ~/.aws/* credentials setup ?

First, if you use aws cli to do this, this include the prefix

aws s3 ls s3://bucket/private/im/poc/master/1/testbucket

So the code should be something like this

import boto3
Bucketname = 'bucket'
prefix = '/private/im/poc/master/1/testbucket'
s3 = boto3.resource("s3")
mybucket = s3.Bucket(Bucketname)
all_object = mybucket.objects.all() 
over 4 years ago · Santiago Trujillo Denunciar
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