[cs615asa] Creating KeyPair and Security Group on-the-fly

Nick Smith nsmith1 at stevens.edu
Thu Mar 27 12:02:25 EDT 2014


Being as we've been fighting with getting the KeyPair + Security Group 
to work, and I think we settled on getting it from EC2_BACKUP_FLAGS_AWS, 
I decided to implement a no-nonsense approach to skip this problem. We 
only need to connect to an instance briefly before it is destroyed, so 
we can simply create a KeyPair and Security Group on-the-fly to use with 
the remote instance, and then forget about the KeyPair when we're done. 
This is the approach taken by packer <http://www.packer.io/> to create 
EC2 instances for building system images, and I think it works very well 
in this case too.

My code to implement this is working, linked below, written in Python 
using Boto.
https://gist.github.com/nsmith448/d5a757b7bb880a9cb1c3

Comments are very welcome.

Thanks,
Nick S

Relevant documentation:
Boto EC2 KeyPairs: 
https://boto.readthedocs.org/en/latest/ref/ec2.html#module-boto.ec2.keypair
Boto EC2 Security Groups: 
https://boto.readthedocs.org/en/latest/security_groups.html
My code is adapted from: 
https://github.com/garnaat/paws/blob/master/ec2_launch_instance.py
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.stevens.edu/mailman/private/cs615asa/attachments/20140327/1578dcc2/attachment.html>


More information about the cs615asa mailing list