Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

213
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!