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