question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add ability to add EC2 key-pair

See original GitHub issue

Please add the ability to create EC2 key pairs via CDK.

Use Case

I would like not to have to interact with AWS Console at all. Want my keys git-versioned and manageable from CDK.

Proposed Solution

key = aws_ec2.KeyPair(
    key_name="autoscaled",
    public_key="ssh-rsa AAAABBBBBCCC...",
)

Other

Couldn’t find a way how to do that in documentation. I believe this is not doable with CDK right now.

Seems the only way is to manually add key-pair via web Console and use key_name string parameter for the EC2 machine: https://stackoverflow.com/questions/57572065/how-can-i-access-an-ec2-instance-created-by-cdk

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:43
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
danil-smirnovcommented, Nov 13, 2021

Would be great to have

3reactions
UsernameAlvarezcommented, Mar 1, 2021

Also I need this feature when I create a newly instance so I don’t need to interact with the AWS Console. It would be great!!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon EC2 key pairs and Linux instances
You can use Amazon EC2 to create your key pairs. You can also use a third-party tool to create your key pairs, and...
Read more >
Add Keypair to existing EC2 instance - Stack Overflow
Create a key-value pair from EC2 -> Key Pairs (Under NETWORK & SECURITY tab); Go to Elasticbeanstalk and click on your application; Go...
Read more >
How to Add a New Key Pair to an AWS EC2 Instance for ...
Login to your AWS Management Console, then go to EC2 Management Console. After that go to “Network & Security” in the navigation pane...
Read more >
How To Change AWS EC2 Key Pair - ClayDesk E-Learning Blog
Instructions From AWS EC2 Support · Change pem login · go to your EC2 Console · Under NETWORK & SECURITY, click on Key...
Read more >
Adding Keypair to existing EC2 instance | Edureka Community
No you can't. The reason is KeyPair associated to an instance cannot be replicated or replaced. It is a one time thing. There...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found