Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ec2): choose NAT instance v2 machineImage cpuType automatically…
… from instanceType (#30558) ### Issue # (if applicable) n/a ### Reason for this change When configuring NAT instance v2, currently we have to set machineImage manually when we want to use a graviton instance. Like this: ```ts const vpc = new Vpc(this, 'Vpc', { natGatewayProvider: NatProvider.instanceV2({ instanceType: InstanceType.of(InstanceClass.T4G, InstanceSize.NANO), // we should be able to omit this line! machineImage: MachineImage.latestAmazonLinux2023({ cpuType: AmazonLinuxCpuType.ARM_64 }), }), }); ``` This can be easily avoided if Nat instance v2 construct decides which cpu type to use for the given instance type. ### Description of changes Use `instanceType.architecture` to choose cpu type of a machine image. Now we can remove the redundant code: ```ts const vpc = new Vpc(this, 'Vpc', { natGatewayProvider: NatProvider.instanceV2({ instanceType: InstanceType.of(InstanceClass.T4G, InstanceSize.NANO), }), }); ``` ### Description of how you validated changes Added an integ test. ### Checklist - [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information