Skip to content

Instantly share code, notes, and snippets.

@yashh
Created July 27, 2010 19:02
Show Gist options
  • Save yashh/492684 to your computer and use it in GitHub Desktop.
Save yashh/492684 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import os
from datetime import date
pem_file = '/path/to/file.pem'
cert_file = '/path/to/cert-file.pem'
user_id = 'xxxxxxxx'
platform = 'i386' # change this on large instance
bucket = 'amazon_bucketname'
access_key = 'xxxxxxxxxxxxxxxx'
secret_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
ec2_path = '/usr/bin/ec2-ami-tools-1.3-45758/bin/' #use trailing slash
# DO NOT EDIT BELOW THIS
days = ('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'sturday', 'sunday')
manifest = days[date.today().weekday()]
step_1 = 'rm -f /mnt/%s*' % (manifest,)
step_2 = '%sec2-bundle-vol -p %s -d /mnt -k %s -c %s -u %s -r %s' % (ec2_path, manifest, pem_file, cert_file, user_id, platform)
step_3 = '%sec2-upload-bundle -b %s -m /mnt/%s.manifest.xml -a %s -s %s' % (ec2_path, bucket, manifest, access_key, secret_key)
print step_1
#os.system(step_1)
print step_2
#os.system(step_2)
print step_3
#os.system(step_3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment