[cs615asa] ec2 key name for hw6

Jan Schaumann jschauma at stevens.edu
Wed Mar 30 22:07:37 EDT 2016


marc bassil <mbassil at stevens.edu> wrote:
 
> When creating a new aws instance, the aws cli requires a key name to be
> passed in as an argument. Do we assume that the user will pass the
> correct one for their instance in the env variable?

You can do this in (at least) one of two ways:

1) Use whatever the user has set as the default ssh key; this requires
the user to have a default keypair configured in AWS and your program
assumes that the user has configured their ~/.ssh/config file to make
use of that key for all AWS related hosts (or has it in the ssh agent,
or the key is the default keyname ~/.ssh/id_rsa)

This works, and the use of the environment variables allows the user to
influence the behaviour of ssh / aws to select the right key.  It is a
bit fragile however.

2) Your program generates a new ssh keypair and uses that for all
interactions with AWS.  Since you generate the keypair, you have full
control of the key's name, location etc.

This is a bit more reliable, but requires more code.


In either case, your program should not need to parse any configuration
files.

-Jan


More information about the cs615asa mailing list