Commit f7c5f34
committed
fix: support Amazon Linux 2023 for NAT instance
CDK's NatInstanceProviderV2 uses the `route` command in its default
user data, which requires the net-tools package. However, Amazon Linux
2023 (the default AMI for NatInstanceProviderV2) doesn't have net-tools
pre-installed, causing NAT instances to fail silently.
This change provides custom user data that uses `ip route` instead of
`route` to determine the default network interface, ensuring NAT
functionality works correctly on AL2023.
Reference: https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-ec2/lib/nat.ts1 parent 74a5642 commit f7c5f34
3 files changed
Lines changed: 28 additions & 9 deletions
File tree
- cdk
- lib
- test/__snapshots__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
59 | 75 | | |
60 | 76 | | |
61 | 77 | | |
62 | 78 | | |
63 | 79 | | |
64 | 80 | | |
| 81 | + | |
65 | 82 | | |
66 | 83 | | |
67 | 84 | | |
| |||
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2716 | 2716 | | |
2717 | 2717 | | |
2718 | 2718 | | |
2719 | | - | |
2720 | | - | |
2721 | | - | |
2722 | | - | |
| 2719 | + | |
| 2720 | + | |
| 2721 | + | |
| 2722 | + | |
| 2723 | + | |
2723 | 2724 | | |
2724 | 2725 | | |
2725 | 2726 | | |
| |||
Lines changed: 5 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2548 | 2548 | | |
2549 | 2549 | | |
2550 | 2550 | | |
2551 | | - | |
2552 | | - | |
2553 | | - | |
2554 | | - | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
2555 | 2556 | | |
2556 | 2557 | | |
2557 | 2558 | | |
| |||
0 commit comments