Skip to content

Instantly share code, notes, and snippets.

@jworl
Created August 30, 2019 00:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jworl/148754e3fe1ad76232173d8582595abe to your computer and use it in GitHub Desktop.
Save jworl/148754e3fe1ad76232173d8582595abe to your computer and use it in GitHub Desktop.
import boto3
access_key = "YOURACCESSKEYHERE"
secret_key = "YOURSECRETKEYHERE"
bucket = "YOURBUCKETNAMEHERE"
filename = "YOURFILENAME.ova"
full_path = "/path/to/your/file/"
conn = boto3.client('s3', 'us-east-1',
endpoint_url="http://ceph-s3.services.dmtio.net",
aws_access_key_id = access_key,
aws_secret_access_key = secret_key)
#This will create a new bucket for you
conn.create_bucket(Bucket=bucket)
#This will upload the file to your newly created bucket
conn.upload_file('{}{}'.format(full_path, filename), bucket, filename)
#This will generate a URL for us to download within 24 hours
download_url = conn.generate_presigned_url('get_object', Params = {'Bucket': bucket, 'Key': filename}, ExpiresIn = 28800)
#copy this address and send it to me
print(download_url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment