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

aws_cdk.aws_ec2 NatInstanceProvider: missing require_imdsv2 #23803

Open
2 tasks
iamgabeortiz opened this issue Jan 24, 2023 · 2 comments
Open
2 tasks

aws_cdk.aws_ec2 NatInstanceProvider: missing require_imdsv2 #23803

iamgabeortiz opened this issue Jan 24, 2023 · 2 comments
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2

Comments

@iamgabeortiz
Copy link

Describe the feature

Can we get the require_imdsv2 parameter added to the aws_cdk.aws_ec2 NatInstanceProvider resource?
This was resolved for EC2 and ASG here: Support setting EC2 instance metadata to require token (IMDSv2) #5137

#16051
#16052

Use Case

The AWS Foundational Security Best Practices v1.0.0 for Security Hub will produce a finding for the NAT instances under EC2.8: EC2 instances should use Instance Metadata Service Version 2 (IMDSv2)

Proposed Solution

No response

Other Information

No response

Acknowledgements

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

CDK version used

2.61.1 (build d319d9c)

Environment details (OS name and version, etc.)

WSL: Ubuntu 20.04.5 LTS (Focal Fossa)

@iamgabeortiz iamgabeortiz added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jan 24, 2023
@github-actions github-actions bot added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Jan 24, 2023
@peterwoodworth
Copy link
Contributor

peterwoodworth commented Feb 14, 2023

Thanks for the request, we could certainly add the option to specify this, would just need to add the setting and a way to toggle it here

const natInstance = new Instance(sub, 'NatInstance', {
instanceType: this.props.instanceType,
machineImage,
sourceDestCheck: false, // Required for NAT
vpc: options.vpc,
vpcSubnets: { subnets: [sub] },
securityGroup: this._securityGroup,
role,
keyName: this.props.keyName,
});

I am marking this issue as p2, which means that we are unable to work on this immediately.

We use +1s to help prioritize our work, and are happy to revaluate this issue based on community feedback. You can reach out to the cdk.dev community on Slack to solicit support for reprioritization.

@peterwoodworth peterwoodworth added p2 effort/small Small work item – less than a day of effort and removed needs-triage This issue or PR still needs to be triaged. labels Feb 14, 2023
lpizzinidev added a commit to lpizzinidev/aws-cdk that referenced this issue Feb 23, 2023
@davemssavage
Copy link

I've just encountered this issue, it'd be nice to have a fix as per the merge request that appears to have got dropped, in the interim adding the following:

cdk.Aspects.of(stack).add(new ec2.InstanceRequireImdsv2Aspect())

to my app seems to work as a catch all to ensure the nat instance is set to IMDSv2: Required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants