Elastic IP association for generated NAT in VPC
See original GitHub issue🚀 Feature Request
General Information
- 👋 I may be able to implement this feature request
- ⚠️ This feature might incur a breaking change
Description
It would be great to be able to create a NAT gateway and associate an EIP with it. Currently I create a VPC and that automatically generates a NAT for me. But it’s not possible to alter the NAT or to associate an EIP with the generated NAT.
My use case is that I need a Fargate outbound request mapped to a static IP. This IP will be whitelisted in our on-premise datacenter.
Proposed Solution
new Vpc(this, "myVpc", {
maxAzs: 2,
cidr: '10.0.0.0/16',
natGateways: 1,
allocationIDs: ['eipalloc-12abcde34a5fab67']
subnetConfiguration: [
{
cidrMask: 24,
name: 'sonar_nat_lb',
subnetType: SubnetType.PUBLIC
},
{
cidrMask: 24,
name: 'sonar_fargate',
subnetType: SubnetType.PRIVATE
}
]
});
Allocation ID can be optional as the NAT Gateway will default create its own EIP.
Environment
- CDK CLI Version: 1.8.0
- Module Version: 1.8.0
- OS: all
- Language: TypeScript
Other information
On a sidenote, it is also not possible to create an EIP with CDK, but that’s a different feature-request.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:12 (2 by maintainers)
Top Results From Across the Web
Associate Elastic IP addresses with resources in your VPC
Use Elastic IP addresses to remap public IPv4 addresses between instances in your VPC. ... see Connect to the internet or other networks...
Read more >Allocate Elastic IPs for NAT Gateways - Trend Micro
Ensure that an Elastic IP (EIP) is allocated for each NAT gateway that you want to deploy within your AWS account.
Read more >Why does a AWS NAT Gateway require an ElasticIP?
As the image in the question indicates, the Elastic IP (EIP) is an association. It is the IGW that is translating the NATG's...
Read more >NAT Gateway Archives - Jayendra's Cloud Certification Blog
cannot associate an elastic IP address with a private NAT gateway. internet gateway can be attached to a VPC with a private NAT...
Read more >AWS VPC Tutorial Part III Elastic IP and NAT - Studytrails
We will build a NAT gateway, however, the gateway needs an IP address. AWS provides Elastic IP addresses, that you can create on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@xian13 @rix0rrr @logemann
A raw example using a
NatProvider.
Here only one EIP was created using the console. It needs some improvements in order to manage more EIPs and options.After contacting AWS Support for CDK issues, I got this working by using this code after the VPC creation: