backup_4.py 388 B

123456789
  1. def upload(path, key):
  2. """Upload file to Amazon S3"""
  3. s3_client = boto3.resource(
  4. 's3',
  5. aws_access_key_id=CONFIG['aws']['s3']['access-key'],
  6. aws_secret_access_key=CONFIG['aws']['s3']['secret-access-key']
  7. )
  8. s3_client.meta.client.upload_file(path, CONFIG['aws']['s3']['bucket'],
  9. time.strftime("%Y/%m/%d/") + key)