I created a NAT instance using AWS CDK.
const nat_instance_provider = ec2.NatProvider.instance({
instanceType: new ec2.InstanceType('t3.micro')
});
Then I created an elastic IP.
const elastic_ip = new ec2.CfnEIP(this, "elastic_ip");
Now I need to associate the ec2 instance with the elastic IP.
let ec2Assoc = new ec2.CfnEIPAssociation(this, "Ec2Association", {
eip: elastic_ip.ref,
instanceId: <EC2 ID> ???
});
The issue I'm facing is that so far I couldn't find a way to get the instance ID and I feel this is a limitation but I might be missing something.