Sono disponibili altri esempi per SDK AWS nel repository GitHub della documentazione degli esempi per SDK AWS
Utilizzare CreateVpnGateway con una CLI
Gli esempi di codice seguenti mostrano come utilizzare CreateVpnGateway.
- CLI
-
- AWS CLI
-
Come creare un gateway privato virtuale
Questo esempio crea un gateway privato virtuale.
Comando:
aws ec2 create-vpn-gateway --typeipsec.1Output:
{ "VpnGateway": { "AmazonSideAsn": 64512, "State": "available", "Type": "ipsec.1", "VpnGatewayId": "vgw-9a4cacf3", "VpcAttachments": [] } }Come creare un gateway privato virtuale con un ASN specifico per il lato Amazon
Questo esempio crea un gateway privato virtuale e specifica l’Autonomous System Number (ASN) per il lato Amazon della sessione BGP.
Comando:
aws ec2 create-vpn-gateway --typeipsec.1--amazon-side-asn65001Output:
{ "VpnGateway": { "AmazonSideAsn": 65001, "State": "available", "Type": "ipsec.1", "VpnGatewayId": "vgw-9a4cacf3", "VpcAttachments": [] } }-
Per informazioni dettagliate sull’API, consulta CreateVpnGateway
in AWS CLI Command Reference.
-
- PowerShell
-
- Strumenti per PowerShell V4
-
Esempio 1: questo esempio crea il gateway privato virtuale specificato.
New-EC2VpnGateway -Type ipsec.1Output:
AvailabilityZone : State : available Tags : {} Type : ipsec.1 VpcAttachments : {} VpnGatewayId : vgw-1a2b3c4d-
Per informazioni dettagliate sull’API, consulta CreateVpnGateway nella documentazione di riferimento dei cmdlet di AWS Strumenti per PowerShell (V4).
-
- Strumenti per PowerShell V5
-
Esempio 1: questo esempio crea il gateway privato virtuale specificato.
New-EC2VpnGateway -Type ipsec.1Output:
AvailabilityZone : State : available Tags : {} Type : ipsec.1 VpcAttachments : {} VpnGatewayId : vgw-1a2b3c4d-
Per informazioni dettagliate sull’API, consulta CreateVpnGateway nella documentazione di riferimento dei cmdlet di AWS Strumenti per PowerShell (V5).
-