1
2
3 from starcluster.logger import log
4
5 from base import CmdBase
6
7
9 """
10 createkey [options] <name>
11
12 Create a new Amazon EC2 keypair
13 """
14 names = ['createkey', 'ck']
15
17 parser.add_option("-o", "--output-file", dest="output_file",
18 action="store", type="string", default=None,
19 help="Save the new keypair to a file")
20
21
22
23
25 if len(args) != 1:
26 self.parser.error("please provide a key name")
27 name = args[0]
28 ofile = self.opts.output_file
29 kp = self.ec2.create_keypair(name, output_file=ofile)
30 log.info("Successfully created keypair: %s" % name)
31 log.info("fingerprint: %s" % kp.fingerprint)
32 log.info("contents: \n%s" % kp.material)
33 if ofile:
34 log.info("keypair written to %s" % ofile)
35