amazon s3 - boto3 S3 upload using aws key -
the boto3 documentation recommend configure key command line. if there anyway can put aws key python source code? below code reference.
if have aws cli, can use interactive configure command set credentials , default region: aws configure follow prompts , generate configuration files in correct locations you. import boto3 s3 = boto3.resource('s3') bucket = s3.bucket('my-bucket') obj in bucket.objects.all(): print(obj.key)
see under 'method parameters' in official documentation;
from boto3.session import session session = session(aws_access_key_id='<your access key id>', aws_secret_access_key='<your secret key>', region_name='<region name>') _s3 = session.resource("s3") _bucket = _s3.bucket(<bucket name>) _bucket.download_file(key=<key>, filename=<filename>)
Comments
Post a Comment