· 7 years ago · Jun 02, 2018, 06:52 AM
1#!/usr/bin/python
2
3import os
4
5from datetime import date
6
7pem_file = '/path/to/file.pem'
8cert_file = '/path/to/cert-file.pem'
9user_id = 'xxxxxxxx'
10platform = 'i386' # change this on large instance
11bucket = 'amazon_bucketname'
12
13access_key = 'xxxxxxxxxxxxxxxx'
14secret_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
15ec2_path = '/usr/bin/ec2-ami-tools-1.3-45758/bin/' #use trailing slash
16
17# DO NOT EDIT BELOW THIS
18
19days = ('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'sturday', 'sunday')
20manifest = days[date.today().weekday()]
21
22step_1 = 'rm -f /mnt/%s*' % (manifest,)
23step_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)
24step_3 = '%sec2-upload-bundle -b %s -m /mnt/%s.manifest.xml -a %s -s %s' % (ec2_path, bucket, manifest, access_key, secret_key)
25
26print step_1
27#os.system(step_1)
28print step_2
29#os.system(step_2)
30print step_3
31#os.system(step_3)