As part of a cloud init script for an EC2 instance, I want to generate a private & public key for a user created on the new instance and then copy the public key over to another server in the same private network. The question is the best way to do this since at the time of copy there will not be a straightforward way to copy something over to the other network.
The only thing I can think of is creating a user just for copying certificates and storing the private key for that user in the AMI used for generating that instance but I'm not very enthusiastic about it.