Can I use boto3 anonymously?

MRocklin picture MRocklin · Jan 19, 2016 · Viewed 7.1k times · Source

With boto I could connect to public S3 buckets without credentials by passing the anon= keyword argument.

s3 = boto.connect_s3(anon=True)

Is this possible with boto3?

Answer

Jordon Phillips picture Jordon Phillips · Jan 19, 2016

Yes. Your credentials are used to sign all the requests you send out, so what you have to do is configure the client to not perform the signing step at all. You can do that as follows:

import boto3
from botocore import UNSIGNED
from botocore.client import Config

s3 = boto3.client('s3', config=Config(signature_version=UNSIGNED))
# Use the client