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

feat(ec2): add nitro enclave and hibernation settings to the Instance Construct #30228

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

mazyu36
Copy link
Contributor

@mazyu36 mazyu36 commented May 16, 2024

Issue # (if applicable)

N/A

Reason for this change

MIssing property in the L2 Construct

Description of changes

Add nitroEnclaveEnabled and hibernationConfigured property.

Description of how you validated changes

Added unit tests and integ tests.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team May 16, 2024 04:30
@github-actions github-actions bot added p2 repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK labels May 16, 2024
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label May 16, 2024
Copy link
Contributor

@go-to-k go-to-k left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I made some comments!

packages/aws-cdk-lib/aws-ec2/README.md Show resolved Hide resolved
packages/aws-cdk-lib/aws-ec2/lib/instance.ts Outdated Show resolved Hide resolved
packages/aws-cdk-lib/aws-ec2/lib/instance.ts Outdated Show resolved Hide resolved
packages/aws-cdk-lib/aws-ec2/lib/instance.ts Outdated Show resolved Hide resolved
packages/aws-cdk-lib/aws-ec2/lib/instance.ts Outdated Show resolved Hide resolved
*
* @default false
*/
readonly hibernationConfigured?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change to hibernationEnabled to match enclaveEnabled? (HibernationOptionsProperty in L1 has the configured, but ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the property name.

packages/aws-cdk-lib/aws-ec2/lib/instance.ts Show resolved Hide resolved
[true, true],
[false, false],
])('given nitroEnclaveEnabled %p', (given: boolean, expected: boolean) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

it needs to change the sentence If we change the parameter name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to match the parameter name.

[true, true],
[false, false],
])('given hibernationConfigured %p', (given: boolean, expected: boolean) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to match the parameter name.

});

test('throw if AWS Nitro Enclaves and hibernation are enabled', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to use parameter names in the sentence.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the sentence to match parameter names.

mazyu36 and others added 11 commits May 23, 2024 20:45
Co-authored-by: k.goto (Kenta Goto) <24818752+go-to-k@users.noreply.github.com>
Co-authored-by: k.goto (Kenta Goto) <24818752+go-to-k@users.noreply.github.com>
Co-authored-by: k.goto (Kenta Goto) <24818752+go-to-k@users.noreply.github.com>
Co-authored-by: k.goto (Kenta Goto) <24818752+go-to-k@users.noreply.github.com>
Co-authored-by: k.goto (Kenta Goto) <24818752+go-to-k@users.noreply.github.com>
Co-authored-by: k.goto (Kenta Goto) <24818752+go-to-k@users.noreply.github.com>
Co-authored-by: k.goto (Kenta Goto) <24818752+go-to-k@users.noreply.github.com>
Co-authored-by: k.goto (Kenta Goto) <24818752+go-to-k@users.noreply.github.com>
Co-authored-by: k.goto (Kenta Goto) <24818752+go-to-k@users.noreply.github.com>
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label May 23, 2024
@mazyu36
Copy link
Contributor Author

mazyu36 commented May 23, 2024

@go-to-k
Thank you for your review!
I've addressed all your comments.

Copy link
Contributor

@go-to-k go-to-k left a comment

Choose a reason for hiding this comment

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

Please check the last comment (That is very very minor)!

packages/aws-cdk-lib/aws-ec2/README.md Show resolved Hide resolved
Co-authored-by: k.goto (Kenta Goto) <24818752+go-to-k@users.noreply.github.com>
Copy link
Contributor

@go-to-k go-to-k left a comment

Choose a reason for hiding this comment

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

Thanks!

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label May 23, 2024
@shikha372 shikha372 self-assigned this May 24, 2024
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: rename file to integ.instance-nitro-enclaves-hibernation.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry typo. I fixed it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @mazyu36 , i see some of the files updated but not all in your last commit, you'll first need to rename the integ test file name to integ.instance-nitoro-enclaves-hibernation.ts, build and then run it to update file and its snapshot.

File name is still integ.instance-nitoro-envlaves-hibernation.ts
...-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-nitoro-envlaves-hibernation.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@shikha372
Thanks.
I think the link you provided seems to be an old commit.
I renamed a integ test and reran it at this commit.

And in last commit, all files appear to be renamed.

I would appreciate it if you could point out any misunderstandings on my part.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank mazyu, followed your last commit link, main integ test file name is still incorrect here

Copy link
Contributor Author

@mazyu36 mazyu36 Jun 1, 2024

Choose a reason for hiding this comment

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

Oops... I misspelled "enclaves" too, sorry about that.​​​​​​​​​​​​​​​​

@shikha372
Copy link
Contributor

Thanks @mazyu36 for your contribution, looking at the documentation for this feature, shall we add some instance type based checks to ensure that this property is enabled only for specific type of instance ?
https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html#nitro-enclave-reqs

@mazyu36
Copy link
Contributor Author

mazyu36 commented May 25, 2024

@shikha372
Thank you for the review.
I had also considered adding validation, but due to the large number of instance types that would be excluded based on the requirements conditions, making it complex, and the fact that LaunchTemplate already has a similar setting implemented but no specific validation, I decided to leave it out this time as well.

However, I thought it would be inconsiderate to have no information at all, so I added an explanation and a link to the docs for enclaveEnabled. What do you think?

Since I couldn't come up with many other good ideas, I would appreciate your feedback if you have any better suggestions.

@shikha372
Copy link
Contributor

f instance types that would be excluded based on the requirements conditions, making it complex, and the fact that LaunchTemplate already has a similar setting implemented but no specific validation, I decided to leave it out this time as w

I see, thank you @mazyu36 for your contribution. Clear documentation will help in this case.

@mazyu36
Copy link
Contributor Author

mazyu36 commented May 31, 2024

@shikha372
Thank you.
I have added a note to the README with a link regarding the requirements for instances.

If you have any better suggestions, I would appreciate your comments.

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: filename

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed it.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label May 31, 2024
@mergify mergify bot dismissed shikha372’s stale review June 1, 2024 03:11

Pull request has been modified.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 2a5b073
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jun 1, 2024
@mazyu36
Copy link
Contributor Author

mazyu36 commented Jun 1, 2024

@shikha372
Thank you for the review. Sorry for making you go back and forth so many times.
I have revised the integ test again.​​​​​​​​​​​​​​​​

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2 pr/needs-maintainer-review This PR needs a review from a Core Team Member repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants