Utilizzare CreateInternetGateway con una CLI - Esempi di codice per SDK AWS

Sono disponibili altri esempi per SDK AWS nel repository GitHub della documentazione degli esempi per SDK AWS.

Utilizzare CreateInternetGateway con una CLI

Gli esempi di codice seguenti mostrano come utilizzare CreateInternetGateway.

Gli esempi di operazioni sono estratti di codice da programmi più grandi e devono essere eseguiti nel contesto. Puoi vedere questa azione nel contesto nei seguenti esempi di codice:

CLI
AWS CLI

Come creare un gateway Internet

L’esempio create-internet-gateway seguente crea un gateway Internet con il tag Name=my-igw.

aws ec2 create-internet-gateway \ --tag-specifications ResourceType=internet-gateway,Tags=[{Key=Name,Value=my-igw}]

Output:

{ "InternetGateway": { "Attachments": [], "InternetGatewayId": "igw-0d0fb496b3994d755", "OwnerId": "123456789012", "Tags": [ { "Key": "Name", "Value": "my-igw" } ] } }

Per ulteriori informazioni, consulta Gateway Internet nella Guida per l’utente di Amazon VPC.

PowerShell
Strumenti per PowerShell V4

Esempio 1: questo esempio crea un gateway Internet.

New-EC2InternetGateway

Output:

Attachments InternetGatewayId Tags ----------- ----------------- ---- {} igw-1a2b3c4d {}
  • Per informazioni dettagliate sull’API, consulta CreateInternetGateway nella documentazione di riferimento dei cmdlet di AWS Strumenti per PowerShell (V4).

Strumenti per PowerShell V5

Esempio 1: questo esempio crea un gateway Internet.

New-EC2InternetGateway

Output:

Attachments InternetGatewayId Tags ----------- ----------------- ---- {} igw-1a2b3c4d {}
  • Per informazioni dettagliate sull’API, consulta CreateInternetGateway nella documentazione di riferimento dei cmdlet di AWS Strumenti per PowerShell (V5).