Utilizzare DescribeCustomerGateways con una CLI - AWS Esempi di codice SDK

Sono disponibili altri esempi AWS SDK nel repository AWS Doc SDK Examples. GitHub

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Utilizzare DescribeCustomerGateways con una CLI

Gli esempi di codice seguenti mostrano come utilizzare DescribeCustomerGateways.

CLI
AWS CLI

Come descrivere i gateway del cliente

Questo esempio descrive i gateway del cliente.

Comando:

aws ec2 describe-customer-gateways

Output:

{ "CustomerGateways": [ { "CustomerGatewayId": "cgw-b4dc3961", "IpAddress": "203.0.113.12", "State": "available", "Type": "ipsec.1", "BgpAsn": "65000" }, { "CustomerGatewayId": "cgw-0e11f167", "IpAddress": "12.1.2.3", "State": "available", "Type": "ipsec.1", "BgpAsn": "65534" } ] }

Come descrivere un gateway del cliente specifico

Questo esempio descrive il gateway del cliente specificato.

Comando:

aws ec2 describe-customer-gateways --customer-gateway-ids cgw-0e11f167

Output:

{ "CustomerGateways": [ { "CustomerGatewayId": "cgw-0e11f167", "IpAddress": "12.1.2.3", "State": "available", "Type": "ipsec.1", "BgpAsn": "65534" } ] }
PowerShell
Strumenti per PowerShell V4

Esempio 1: questo esempio descrive il gateway del cliente specificato.

Get-EC2CustomerGateway -CustomerGatewayId cgw-1a2b3c4d

Output:

BgpAsn : 65534 CustomerGatewayId : cgw-1a2b3c4d IpAddress : 203.0.113.12 State : available Tags : {} Type : ipsec.1

Esempio 2: questo esempio descrive qualsiasi gateway del cliente il cui stato è “pending” (In sospeso) o “available” (Disponibile).

$filter = New-Object Amazon.EC2.Model.Filter $filter.Name = "state" $filter.Values = @( "pending", "available" ) Get-EC2CustomerGateway -Filter $filter

Esempio 3: questo esempio descrive tutti i gateway del cliente specificato.

Get-EC2CustomerGateway
Strumenti per V5 PowerShell

Esempio 1: questo esempio descrive il gateway del cliente specificato.

Get-EC2CustomerGateway -CustomerGatewayId cgw-1a2b3c4d

Output:

BgpAsn : 65534 CustomerGatewayId : cgw-1a2b3c4d IpAddress : 203.0.113.12 State : available Tags : {} Type : ipsec.1

Esempio 2: questo esempio descrive qualsiasi gateway del cliente il cui stato è “pending” (In sospeso) o “available” (Disponibile).

$filter = New-Object Amazon.EC2.Model.Filter $filter.Name = "state" $filter.Values = @( "pending", "available" ) Get-EC2CustomerGateway -Filter $filter

Esempio 3: questo esempio descrive tutti i gateway del cliente specificato.

Get-EC2CustomerGateway