1

I am working with python and jupyter notebook and am getting a 'No credentials' error when using the following code:

import boto3
s3 = boto3.resource('s3')
bucket = s3.Bucket('my-bucket')

I have awscli installed into my notebook with:

pip install awscli --user 

I have also tried adding:

aws configure

but that gave me a syntax error. I also have aws cli installed in my laptop, even though I am working in a jupyter notebook. Thank you!

  • 2
    Does this answer your question? [How to specify credentials when connecting to boto3 S3?](https://stackoverflow.com/questions/45981950/how-to-specify-credentials-when-connecting-to-boto3-s3) – Chris Jul 14 '20 at 17:37

1 Answers1

2

You can set credentials with the following commands:

!aws configure set aws_access_key_id $ID
!aws configure set aws_secret_access_key $KEY
!aws configure set default.region $REGION

Baris Simsek
  • 71
  • 1
  • 8