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

Replace cdk-ec2-key-pair with CfnKeyPair construct to generate ec2 key pair #390

Merged
merged 1 commit into from
Feb 21, 2024

Conversation

rishabh6788
Copy link
Collaborator

Description

Replace cdk-ec2-key-pair with CfnKeyPair construct to generate ec2 key pair.
aws-cdk-lib provides CfnKeyPair construct to generate ec2 key-pairs. The private key is saved to AWS Systems Manager Parameter Store, using a parameter with the following name: /ec2/keypair/{key_pair_id}. See https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.CfnKeyPair.html for more details.

Issues Resolved

List any issues this PR will resolve, e.g. Closes [...].

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@@ -53,46 +53,48 @@ OpenSearch Continuous Integration is an open source CI system for OpenSearch and

### Dev Deployment
1. Setup your local machine to credentials to deploy to the AWS Account
1. Deploy the bootstrap stack by running the following command that sets up required resources to create the stacks. [More info](https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
2. Deploy the bootstrap stack by running the following command that sets up required resources to create the stacks. [More info](https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can keep these 1/1/1 as they will render as 1/2/3 😄

secretName: 'jenkins-agent-node-key-pair',
description: 'ssh key for jenkins main node to connect to agent nodes',
});
Tags.of(keyPairSecret).add('jenkins:credentials:type', 'sshUserPrivateKey');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we need this tag for both secret as well as actual ec2 key pair?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to add this tag so that jenkins can read this and use it as ssh key, isnt it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tag is mandatory for the secret but not for the actual key-pair.
Don't see any issue with adding the same tag to key-pair as well.

@rishabh6788 rishabh6788 merged commit f2abb8c into opensearch-project:main Feb 21, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants