When declaring and EC2 instance per two different ...
# aws
When declaring and EC2 instance per two different availability zones, I need to determine which private subnet id in the VPC is available in the availability zone for that EC2 instance. Is there a way to do this by interrogating the resources?
The getSubnet function includes the availabilityZone so you could use that. Put the 2 subnets into a collection and then use
to narrow it to the single desired subnet
actually even better: this function can be provided filters and takes in a VPC ID so you can provide an availability zone filter and receive only the desired Subnet ID in return
Thanks, I’ll look into these!
I am creating my VPC with
, so hopefully this won’t pose a problem
hmmmm I think it depends, some of the crosswalk APIs expect to be passed an actual
instance. But if you're using APIs that accept just a Subnet ID than mixing the providers shouldn't be an issue
The cloudformation template that creates the VPC is tagging the subnets appropriately enough that I should be able to filter specifically how I need! Thanks again.
🙌 1
I think an alternative (homegrown) version of awsx's VPC, with AZs as a collection of subnets, would be helpful..