Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set a pre existing keypair instead of creating a new one #158

Open
alouini333 opened this issue Oct 24, 2024 · 3 comments
Open

Set a pre existing keypair instead of creating a new one #158

alouini333 opened this issue Oct 24, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@alouini333
Copy link

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?

@LeoDiazL LeoDiazL added the enhancement New feature or request label Oct 25, 2024
@LeoDiazL
Copy link
Contributor

Hi @alouini333 ! thanks for opening up an issue!

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? 🤔 )

Thanks again!

@alouini333
Copy link
Author

Hi @LeoDiazL, thanks for your reply.
I would be happy to contribute if possible, any ideas where should I start to dig in?

@LeoDiazL
Copy link
Contributor

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!

Leo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants