[GO SDK V2] NAT gateway - get availability zone

0

Hello,

I'm trying to determine the availability zone of a NAT gateway in an account, not just for one, but for a list of NAT gateways one after another.

As far as I understand, when calling ec2Client.DescribeNatGateways() the NAT's availability zone is not provided.

In order to get the AZ, I'm doing another API call to ec2Client.DescribeSubnets with the NAT's subnet ID, Only then the AZ is in the output.

As I'm making a multiple API calls, this could be time-consuming.

I was wondering what is the most efficient way to determine the NAT's AZ?

Thank you,

Ori Adler

2回答
1
承認された回答

You can pull the list of AZs from the ENIs. Here is the CLI:

aws ec2 describe-network-interfaces --filters Name=interface-type,Values=nat_gateway --query NetworkInterfaces[*].AvailabilityZone
profile pictureAWS
エキスパート
kentrad
回答済み 2年前
0

The response to DescribeNatGateways does include the subnet id which can be used with DescribeSubnets to determine the availability zone.

profile pictureAWS
エキスパート
回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ