A simple python script that uploads a file to a s3 bucket.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
upload_s3.py

README.md

upload_s3

A simple python script that uploads a file to a s3 bucket under a randomly generated key, randomly generated key with a specified extension, or under a given key (optionally with an extension).

Place AWS access credentials in the following lines. Make sure to specify a valid bucket name.

  # AWS ACCESS DETAILS
  AWS_ACCESS_KEY_ID = '<AWS_ACCESS_KEY_ID>'
  AWS_SECRET_ACCESS_KEY = '<AWS_SECRET_ACCESS_KEY>'
  BUCKET = '<BUCKET_NAME>'

Usuage

upload_s3.py usage: python upload_s3.py <filename> [file_extension or file_key]

  •    `filename` is the path to the file to upload [REQUIRED]
    
  •    `file_extension` is a string that specifies any valid file extension (starts with a '.') {OPTIONAL}
    
  •    `file_key` is the key that the file will be stored in s3 under {OPTIONAL}
    

Requirements

The only third party dependency for this script is the boto library. To get boto use the following command:

pip install boto

Boto Documentation