You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi everyone, I lately had a use case where I need to set a specific key pair to created EC2 instances.
Is there a way to set a pre existing keypair instead of creating a new pair each time?
The text was updated successfully, but these errors were encountered:
Sadly, there is not such option at the moment. It's something that we thought at some point, but didn't have the need or time to solve it.
The only thing I can think of right now, and probably won't solve your issue, is the use of the aws_ec2_create_keypair_sm option.
That would create a secret in secret manager where you could retrieve your ssh key from.
Either way, I'll leave this issue open and tag it. Would love to have the option to add a second pair of keys that are static. ( or even more than a second one? 🤔 )
Hi @alouini333, sorry for the delay in the answer.
So ... looked up for different options, and there is one that might work for you.
We have aws_ec2_user_data_file that allows you to inject anything during the first boot. That way you could add the keys to the instance in order to gain ssh access using pre-existing keys.
Now ... contributing to this action is not that easy ... (we really like them, but this case is a bit hard)
This GH Action relies on a bigger action, called commons.
That is the base of a lot of our actions.
From there, you could go to the EC2 module and see how we handle the keys. I'll keep this issue open until I have the bandwidth to take care of this and make it happen, because I do think this is worthy.
Once again, thanks for opening an issue and having the intention to contribute!
Hi everyone, I lately had a use case where I need to set a specific key pair to created EC2 instances.
Is there a way to set a pre existing keypair instead of creating a new pair each time?
The text was updated successfully, but these errors were encountered: