(vpc): Access the Internet Gateway for a VPC loaded via "ec2.Vpc.fromLookup"
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Description
Add the ability to look up the Internet Gateway for a VPC loaded via `Vpc.fromLookup`.
### Use Case
I'd like to be able to add a subnet route like this:
```javascript
const vpc = ec2.Vpc.fromLookup(this, 'vpc', { 'vpc-XXXXXXXX' });
const subnet = ...;
subnet.addRoute('IgwRoute', {
routerType: ec2.RouterType.GATEWAY,
routerId: vpc.internetGatewayId,
destinationCidrBlock: "0.0.0.0/0",
})
```
but `vpc.internetGatewayId` comes back as `undefined` for me. Is this expected?
### Proposed Solution
I believe there is some relevant context here:
https://github.com/aws/aws-cdk/issues/5327#issuecomment-961894054
### Other information
_No response_
### Acknowledge
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
Contributor guide
Research direction
Start by tracing the Vpc.fromLookup entry point and the internetGatewayId property; the issue's example shows the lookup and route use case. Review the linked issue comment for context, and consider the work done when a looked-up VPC exposes its Internet Gateway ID for the shown route configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100