AWS 文档 SDK 示例
将 DescribeInternetGateways 与 CLI 配合使用
以下代码示例演示如何使用 DescribeInternetGateways。
操作示例是大型程序的代码摘录,必须在上下文中运行。在以下代码示例中,您可以查看此操作的上下文:
- CLI
-
- AWS CLI
-
描述互联网网关
以下
describe-internet-gateways示例描述了指定的互联网网关。aws ec2 describe-internet-gateways \ --internet-gateway-idsigw-0d0fb496b3EXAMPLE输出:
{ "InternetGateways": [ { "Attachments": [ { "State": "available", "VpcId": "vpc-0a60eb65b4EXAMPLE" } ], "InternetGatewayId": "igw-0d0fb496b3EXAMPLE", "OwnerId": "123456789012", "Tags": [ { "Key": "Name", "Value": "my-igw" } ] } ] }有关更多信息,请参阅《Amazon VPC 用户指南》中的互联网网关。
-
有关 API 详细信息,请参阅《AWS CLI 命令参考》中的 DescribeInternetGateways
。
-
- PowerShell
-
- Tools for PowerShell V4
-
示例 1:此示例描述指定的互联网网关。
Get-EC2InternetGateway -InternetGatewayId igw-1a2b3c4d输出:
Attachments InternetGatewayId Tags ----------- ----------------- ---- {vpc-1a2b3c4d} igw-1a2b3c4d {}示例 2:此示例描述所有互联网网关。
Get-EC2InternetGateway输出:
Attachments InternetGatewayId Tags ----------- ----------------- ---- {vpc-1a2b3c4d} igw-1a2b3c4d {} {} igw-2a3b4c5d {}-
有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V4)》中的 DescribeInternetGateways。
-
- Tools for PowerShell V5
-
示例 1:此示例描述指定的互联网网关。
Get-EC2InternetGateway -InternetGatewayId igw-1a2b3c4d输出:
Attachments InternetGatewayId Tags ----------- ----------------- ---- {vpc-1a2b3c4d} igw-1a2b3c4d {}示例 2:此示例描述所有互联网网关。
Get-EC2InternetGateway输出:
Attachments InternetGatewayId Tags ----------- ----------------- ---- {vpc-1a2b3c4d} igw-1a2b3c4d {} {} igw-2a3b4c5d {}-
有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference (V5)》中的 DescribeInternetGateways。
-
DescribeInstances
DescribeKeyPairs