When declaring and EC2 instance per two different ...
# aws
m
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?
b
The getSubnet function includes the availabilityZone so you could use that. Put the 2 subnets into a collection and then use
.apply
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
m
Thanks, I’ll look into these!
I am creating my VPC with
awsx.ec2.Vpc.fromExistingIds
, so hopefully this won’t pose a problem
b
hmmmm I think it depends, some of the crosswalk APIs expect to be passed an actual
Pulumi.Resource
instance. But if you're using APIs that accept just a Subnet ID than mixing the providers shouldn't be an issue
m
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
l
I think an alternative (homegrown) version of awsx's VPC, with AZs as a collection of subnets, would be helpful..