Esempi per Network Manager con la AWS CLI - AWS Command Line Interface

Esempi per Network Manager con la AWS CLI

Gli esempi di codice seguenti mostrano come eseguire azioni e implementare scenari comuni utilizzando l’AWS Command Line Interface con Network Manager.

Le operazioni sono estratti di codice da programmi più grandi e devono essere eseguite nel contesto. Sebbene le operazioni mostrino come richiamare le singole funzioni del servizio, è possibile visualizzarle contestualizzate negli scenari correlati.

Ogni esempio include un link al codice sorgente completo, dove è possibile trovare le istruzioni su come configurare ed eseguire il codice nel contesto.

Argomenti

Operazioni

L’esempio di codice seguente mostra come utilizzare associate-customer-gateway.

AWS CLI

Come associare un gateway del cliente

L’esempio associate-customer-gateway seguente associa il gateway del cliente cgw-11223344556677889 nella rete globale specificata al dispositivo device-07f6fd08867abc123.

aws networkmanager associate-customer-gateway \ --customer-gateway-arn arn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-11223344556677889 \ --global-network-id global-network-01231231231231231 \ --device-id device-07f6fd08867abc123 \ --region us-west-2

Output:

{ "CustomerGatewayAssociation": { "CustomerGatewayArn": "arn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-11223344556677889", "GlobalNetworkId": "global-network-01231231231231231", "DeviceId": "device-07f6fd08867abc123", "State": "PENDING" } }

Per ulteriori informazioni, consulta Customer Gateway Associations nella Guida di Transit Gateway network manager.

L’esempio di codice seguente mostra come utilizzare associate-link.

AWS CLI

Come associare un link

L’esempio associate-link seguente associa il link link-11112222aaaabbbb1 al dispositivo device-07f6fd08867abc123. Il link e il dispositivo si trovano nella rete globale specificata.

aws networkmanager associate-link \ --global-network-id global-network-01231231231231231 \ --device-id device-07f6fd08867abc123 \ --link-id link-11112222aaaabbbb1 \ --region us-west-2

Output:

{ "LinkAssociation": { "GlobalNetworkId": "global-network-01231231231231231", "DeviceId": "device-07f6fd08867abc123", "LinkId": "link-11112222aaaabbbb1", "LinkAssociationState": "PENDING" } }

Per ulteriori informazioni, consulta Device and Link Associations nella Guida di Transit Gateway network manager.

  • Per informazioni dettagliate sull’API, consulta AssociateLink in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare create-core-network.

AWS CLI

Come creare una rete core

L’esempio create-core-network seguente crea una rete core utilizzando una descrizione facoltativa e tag all’interno di una rete globale AWS Cloud WAN.

aws networkmanager create-core-network \ --global-network-id global-network-cdef-EXAMPLE22222 \ --description "Main headquarters location" \ --tags Key=Name,Value="New York City office"

Output:

{ "CoreNetwork": { "GlobalNetworkId": "global-network-cdef-EXAMPLE22222", "CoreNetworkId": "core-network-cdef-EXAMPLE33333", "CoreNetworkArn": "arn:aws:networkmanager::987654321012:core-network/core-network-cdef-EXAMPLE33333", "Description": "Main headquarters location", "CreatedAt": "2022-01-10T19:53:59+00:00", "State": "AVAILABLE", "Tags": [ { "Key": "Name", "Value": "New York City office" } ] } }

Per ulteriori informazioni, consulta Global and core networks nella Guida per l’utente di AWS Cloud WAN.

  • Per informazioni dettagliate sull’API, consulta CreateCoreNetwork in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare create-device.

AWS CLI

Come creare un dispositivo

L’esempio create-device seguente crea un dispositivo nella rete globale specificata. I dettagli del dispositivo includono una descrizione, il tipo, il fornitore, il modello e il numero di serie.

aws networkmanager create-device --global-network-id global-network-01231231231231231 \ --description "New York office device" \ --type "office device" \ --vendor "anycompany" \ --model "abcabc" \ --serial-number "1234" \ --region us-west-2

Output:

{ "Device": { "DeviceId": "device-07f6fd08867abc123", "DeviceArn": "arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123", "GlobalNetworkId": "global-network-01231231231231231", "Description": "New York office device", "Type": "office device", "Vendor": "anycompany", "Model": "abcabc", "SerialNumber": "1234", "CreatedAt": 1575554005.0, "State": "PENDING" } }

Per ulteriori informazioni, consulta Working with Devices nella Guida di Transit Gateway network manager.

  • Per informazioni dettagliate sull’API, consulta CreateDevice in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare create-global-network.

AWS CLI

Come creare una rete globale

L’esempio create-global-network seguente crea una nuova rete globale. Lo stato iniziale al momento della creazione è PENDING.

aws networkmanager create-global-network

Output:

{ "GlobalNetwork": { "GlobalNetworkId": "global-network-00a77fc0f722dae74", "GlobalNetworkArn": "arn:aws:networkmanager::987654321012:global-network/global-network-00a77fc0f722dae74", "CreatedAt": "2022-03-14T20:31:56+00:00", "State": "PENDING" } }
  • Per informazioni dettagliate sull’API, consulta CreateGlobalNetwork in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare create-link.

AWS CLI

Come creare un collegamento

L’esempio create-link seguente crea un link nella rete globale specificata. Il link include una descrizione e i dettagli sul tipo di link, sulla larghezza di banda e sul provider. L’ID del sito indica il sito a cui è associato il link.

aws networkmanager create-link \ --global-network-id global-network-01231231231231231 \ --description "VPN Link" \ --type "broadband" \ --bandwidth UploadSpeed=10,DownloadSpeed=20 \ --provider "AnyCompany" \ --site-id site-444555aaabbb11223 \ --region us-west-2

Output:

{ "Link": { "LinkId": "link-11112222aaaabbbb1", "LinkArn": "arn:aws:networkmanager::123456789012:link/global-network-01231231231231231/link-11112222aaaabbbb1", "GlobalNetworkId": "global-network-01231231231231231", "SiteId": "site-444555aaabbb11223", "Description": "VPN Link", "Type": "broadband", "Bandwidth": { "UploadSpeed": 10, "DownloadSpeed": 20 }, "Provider": "AnyCompany", "CreatedAt": 1575555811.0, "State": "PENDING" } }

Per ulteriori informazioni, consulta Working with Links nella Guida di Transit Gateway network manager.

  • Per informazioni dettagliate sull’API, consulta CreateLink in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare create-site.

AWS CLI

Come creare un sito

L’esempio create-site seguente crea un sito nella rete globale specificata. I dettagli del sito includono una descrizione e informazioni sulla posizione.

aws networkmanager create-site \ --global-network-id global-network-01231231231231231 \ --description "New York head office" \ --location Latitude=40.7128,Longitude=-74.0060 \ --region us-west-2

Output:

{ "Site": { "SiteId": "site-444555aaabbb11223", "SiteArn": "arn:aws:networkmanager::123456789012:site/global-network-01231231231231231/site-444555aaabbb11223", "GlobalNetworkId": "global-network-01231231231231231", "Description": "New York head office", "Location": { "Latitude": "40.7128", "Longitude": "-74.0060" }, "CreatedAt": 1575554300.0, "State": "PENDING" } }

Per ulteriori informazioni, consulta Working with Sites nella Guida di Transit Gateway network manager.

  • Per informazioni dettagliate sull’API, consulta CreateSite in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare create-vpc-attachment.

AWS CLI

Come creare un collegamento VPC

L’esempio create-vpc-attachment seguente crea un collegamento VPC con supporto IPv6 in una rete core.

aws networkmanager create-vpc-attachment \ --core-network-id core-network-0fab62fe438d94db6 \ --vpc-arn arn:aws:ec2:us-east-1:987654321012:vpc/vpc-09f37f69e2786eeb8 \ --subnet-arns arn:aws:ec2:us-east-1:987654321012:subnet/subnet-04ca4e010857e7bb7 \ --Ipv6Support=true

Output:

{ "VpcAttachment": { "Attachment": { "CoreNetworkId": "core-network-0fab62fe438d94db6", "AttachmentId": "attachment-05e1da6eba87a06e6", "OwnerAccountId": "987654321012", "AttachmentType": "VPC", "State": "CREATING", "EdgeLocation": "us-east-1", "ResourceArn": "arn:aws:ec2:us-east-1:987654321012:vpc/vpc-09f37f69e2786eeb8", "Tags": [], "CreatedAt": "2022-03-10T20:59:14+00:00", "UpdatedAt": "2022-03-10T20:59:14+00:00" }, "SubnetArns": [ "arn:aws:ec2:us-east-1:987654321012:subnet/subnet-04ca4e010857e7bb7" ], "Options": { "Ipv6Support": true } } }

Per ulteriori informazioni, consulta Create an attachment nella Guida per l’utente di Cloud WAN.

  • Per informazioni dettagliate sull’API, consulta CreateVpcAttachment in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare delete-attachment.

AWS CLI

Come eliminare un collegamento

L’esempio delete-attachment seguente elimina un collegamento Connect.

aws networkmanager delete-attachment \ --attachment-id attachment-01feddaeae26ab68c

Output:

{ "Attachment": { "CoreNetworkId": "core-network-0f4b0a9d5ee7761d1", "AttachmentId": "attachment-01feddaeae26ab68c", "OwnerAccountId": "987654321012", "AttachmentType": "CONNECT", "State": "DELETING", "EdgeLocation": "us-east-1", "ResourceArn": "arn:aws:networkmanager::987654321012:attachment/attachment-02c3964448fedf5aa", "CreatedAt": "2022-03-15T19:18:41+00:00", "UpdatedAt": "2022-03-15T19:28:59+00:00" } }

Per ulteriori informazioni, consulta Delete attachments nella Guida per l’utente di Cloud WAN.

  • Per informazioni dettagliate sull’API, consulta DeleteAttachment in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare delete-bucket-analytics-configuration.

AWS CLI

Come eliminare una configurazione di analisi per un bucket

L’esempio delete-bucket-analytics-configuration seguente rimuove la configurazione di analisi per il bucket e l’ID specificati.

aws s3api delete-bucket-analytics-configuration \ --bucket amzn-s3-demo-bucket \ --id 1

Questo comando non produce alcun output.

L’esempio di codice seguente mostra come utilizzare delete-bucket-metrics-configuration.

AWS CLI

Come eliminare una configurazione delle metriche per un bucket

L’esempio delete-bucket-metrics-configuration seguente rimuove la configurazione delle metriche per il bucket e l’ID specificati.

aws s3api delete-bucket-metrics-configuration \ --bucket amzn-s3-demo-bucket \ --id 123

Questo comando non produce alcun output.

L’esempio di codice seguente mostra come utilizzare delete-core-network.

AWS CLI

Come eliminare una rete core

L’esempio delete-core-network seguente elimina una rete core da una rete globale Cloud WAN.

aws networkmanager delete-core-network \ --core-network-id core-network-0fab62fe438d94db6

Output:

{ "CoreNetwork": { "GlobalNetworkId": "global-network-0d59060f16a73bc41", "CoreNetworkId": "core-network-0fab62fe438d94db6", "Description": "Main headquarters location", "CreatedAt": "2021-12-09T18:31:11+00:00", "State": "DELETING", "Segments": [ { "Name": "dev", "EdgeLocations": [ "us-east-1" ], "SharedSegments": [] } ], "Edges": [ { "EdgeLocation": "us-east-1", "Asn": 64512, "InsideCidrBlocks": [] } ] } }

Per ulteriori informazioni, consulta Core networks nella Guida per l’utente di Cloud WAN.

  • Per informazioni dettagliate sull’API, consulta DeleteCoreNetwork in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare delete-device.

AWS CLI

Come eliminare un dispositivo

L’esempio delete-device seguente elimina il dispositivo specificato dalla rete globale specificata.

aws networkmanager delete-device \ --global-network-id global-network-01231231231231231 \ --device-id device-07f6fd08867abc123 \ --region us-west-2

Output:

{ "Device": { "DeviceId": "device-07f6fd08867abc123", "DeviceArn": "arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123", "GlobalNetworkId": "global-network-01231231231231231", "Description": "New York office device", "Type": "office device", "Vendor": "anycompany", "Model": "abcabc", "SerialNumber": "1234", "SiteId": "site-444555aaabbb11223", "CreatedAt": 1575554005.0, "State": "DELETING" } }

Per ulteriori informazioni, consulta Working with Devices nella Guida di Transit Gateway network manager.

  • Per informazioni dettagliate sull’API, consulta DeleteDevice in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare delete-global-network.

AWS CLI

Come eliminare una rete globale

L’esempio delete-global-network seguente elimina una rete globale.

aws networkmanager delete-global-network \ --global-network-id global-network-052bedddccb193b6b

Output:

{ "GlobalNetwork": { "GlobalNetworkId": "global-network-052bedddccb193b6b", "GlobalNetworkArn": "arn:aws:networkmanager::987654321012:global-network/global-network-052bedddccb193b6b", "CreatedAt": "2021-12-09T18:19:12+00:00", "State": "DELETING" } }
  • Per informazioni dettagliate sull’API, consulta DeleteGlobalNetwork in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare delete-link.

AWS CLI

Come eliminare un link

L’esempio delete-link seguente elimina il link specificato dalla rete globale specificata.

aws networkmanager delete-link \ --global-network-id global-network-01231231231231231 \ --link-id link-11112222aaaabbbb1 \ --region us-west-2

Output:

{ "Link": { "LinkId": "link-11112222aaaabbbb1", "LinkArn": "arn:aws:networkmanager::123456789012:link/global-network-01231231231231231/link-11112222aaaabbbb1", "GlobalNetworkId": "global-network-01231231231231231", "SiteId": "site-444555aaabbb11223", "Description": "VPN Link", "Type": "broadband", "Bandwidth": { "UploadSpeed": 20, "DownloadSpeed": 20 }, "Provider": "AnyCompany", "CreatedAt": 1575555811.0, "State": "DELETING" } }

Per ulteriori informazioni, consulta Working with Links nella Guida di Transit Gateway network manager.

  • Per informazioni dettagliate sull’API, consulta DeleteLink in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare delete-public-access-block.

AWS CLI

Come eliminare la configurazione di blocco dell’accesso pubblico per un bucket

L’esempio delete-public-access-block seguente rimuove la configurazione di blocco dell’accesso pubblico nel bucket specificato.

aws s3api delete-public-access-block \ --bucket amzn-s3-demo-bucket

Questo comando non produce alcun output.

L’esempio di codice seguente mostra come utilizzare delete-site.

AWS CLI

Come eliminare un sito

L’esempio delete-site seguente elimina il sito specificato (site-444555aaabbb11223) nella rete globale specificata.

aws networkmanager delete-site \ --global-network-id global-network-01231231231231231 \ --site-id site-444555aaabbb11223 \ --region us-west-2

Output:

{ "Site": { "SiteId": "site-444555aaabbb11223", "SiteArn": "arn:aws:networkmanager::123456789012:site/global-network-01231231231231231/site-444555aaabbb11223", "GlobalNetworkId": "global-network-01231231231231231", "Description": "New York head office", "Location": { "Latitude": "40.7128", "Longitude": "-74.0060" }, "CreatedAt": 1575554300.0, "State": "DELETING" } }

Per ulteriori informazioni, consulta Working with Sites nella Guida di Transit Gateway network manager.

  • Per informazioni dettagliate sull’API, consulta DeleteSite in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare deregister-transit-gateway.

AWS CLI

Come annullare la registrazione di un gateway di transito da una rete globale

L’esempio deregister-transit-gateway seguente annulla la registrazione del gateway di transito specificato nella rete globale specificata.

aws networkmanager deregister-transit-gateway \ --global-network-id global-network-01231231231231231 \ --transit-gateway-arn arn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-123abc05e04123abc \ --region us-west-2

Output:

{ "TransitGatewayRegistration": { "GlobalNetworkId": "global-network-01231231231231231", "TransitGatewayArn": "arn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-123abc05e04123abc", "State": { "Code": "DELETING" } } }

Per ulteriori informazioni, consulta Transit Gateway Registrations nella Guida di Transit Gateway network manager.

L’esempio di codice seguente mostra come utilizzare describe-global-networks.

AWS CLI

Come descrivere le reti globali

L’esempio describe-global-networks seguente descrive tutte le reti globali nell’account.

aws networkmanager describe-global-networks \ --region us-west-2

Output:

{ "GlobalNetworks": [ { "GlobalNetworkId": "global-network-01231231231231231", "GlobalNetworkArn": "arn:aws:networkmanager::123456789012:global-network/global-network-01231231231231231", "Description": "Company 1 global network", "CreatedAt": 1575553525.0, "State": "AVAILABLE" } ] }

L’esempio di codice seguente mostra come utilizzare disassociate-customer-gateway.

AWS CLI

Come dissociare un gateway del cliente

L’esempio disassociate-customer-gateway seguente dissocia il gateway del cliente specificato (cgw-11223344556677889) dalla rete globale specificata.

aws networkmanager disassociate-customer-gateway \ --global-network-id global-network-01231231231231231 \ --customer-gateway-arn arn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-11223344556677889 \ --region us-west-2

Output:

{ "CustomerGatewayAssociation": { "CustomerGatewayArn": "arn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-11223344556677889", "GlobalNetworkId": "global-network-01231231231231231", "DeviceId": "device-07f6fd08867abc123", "State": "DELETING" } }

Per ulteriori informazioni, consulta Customer Gateway Associations nella Guida di Transit Gateway network manager.

L’esempio di codice seguente mostra come utilizzare disassociate-link.

AWS CLI

Come dissociare un link

L’esempio disassociate-link seguente dissocia il link specificato dal dispositivo device-07f6fd08867abc123 nella rete globale specificata.

aws networkmanager disassociate-link \ --global-network-id global-network-01231231231231231 \ --device-id device-07f6fd08867abc123 \ --link-id link-11112222aaaabbbb1 \ --region us-west-2

Output:

{ "LinkAssociation": { "GlobalNetworkId": "global-network-01231231231231231", "DeviceId": "device-07f6fd08867abc123", "LinkId": "link-11112222aaaabbbb1", "LinkAssociationState": "DELETING" } }

Per ulteriori informazioni, consulta Device and Link Associations nella Guida di Transit Gateway network manager.

  • Per informazioni dettagliate sull’API, consulta DisassociateLink in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare get-bucket-analytics-configuration.

AWS CLI

Come recuperare la configurazione di analisi per un bucket con un ID specifico

L’esempio get-bucket-analytics-configuration seguente visualizza la configurazione di analisi per il bucket e l’ID specificati.

aws s3api get-bucket-analytics-configuration \ --bucket amzn-s3-demo-bucket \ --id 1

Output:

{ "AnalyticsConfiguration": { "StorageClassAnalysis": {}, "Id": "1" } }

L’esempio di codice seguente mostra come utilizzare get-bucket-metrics-configuration.

AWS CLI

Come recuperare la configurazione delle metriche per un bucket con un ID specifico

L’esempio get-bucket-metrics-configuration seguente visualizza la configurazione delle metriche per il bucket e l’ID specificati.

aws s3api get-bucket-metrics-configuration \ --bucket amzn-s3-demo-bucket \ --id 123

Output:

{ "MetricsConfiguration": { "Filter": { "Prefix": "logs" }, "Id": "123" } }

L’esempio di codice seguente mostra come utilizzare get-customer-gateway-associations.

AWS CLI

Come ottenere le associazioni del gateway del cliente

L’esempio get-customer-gateway-associations seguente ottiene le associazioni del gateway del cliente per la rete globale specificata.

aws networkmanager get-customer-gateway-associations \ --global-network-id global-network-01231231231231231 \ --region us-west-2

Output:

{ "CustomerGatewayAssociations": [ { "CustomerGatewayArn": "arn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-11223344556677889", "GlobalNetworkId": "global-network-01231231231231231", "DeviceId": "device-07f6fd08867abc123", "State": "AVAILABLE" } ] }

L’esempio di codice seguente mostra come utilizzare get-devices.

AWS CLI

Come ottenere i tuoi dispositivi

L’esempio get-devices seguente ottiene i dispositivi nella rete globale specificata.

aws networkmanager get-devices \ --global-network-id global-network-01231231231231231 \ --region us-west-2

Output:

{ "Devices": [ { "DeviceId": "device-07f6fd08867abc123", "DeviceArn": "arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123", "GlobalNetworkId": "global-network-01231231231231231", "Description": "NY office device", "Type": "office device", "Vendor": "anycompany", "Model": "abcabc", "SerialNumber": "1234", "CreatedAt": 1575554005.0, "State": "AVAILABLE" } ] }
  • Per informazioni dettagliate sull’API, consulta GetDevices in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare get-link-associations.

AWS CLI

Come ottenere le associazioni dei link

L’esempio get-link-associations seguente ottiene le associazioni dei link nella rete globale specificata.

aws networkmanager get-link-associations \ --global-network-id global-network-01231231231231231 \ --region us-west-2

Output:

{ "LinkAssociations": [ { "GlobalNetworkId": "global-network-01231231231231231", "DeviceId": "device-07f6fd08867abc123", "LinkId": "link-11112222aaaabbbb1", "LinkAssociationState": "AVAILABLE" } ] }
  • Per informazioni dettagliate sull’API, consulta GetLinkAssociations in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare get-links.

AWS CLI

Come ottenere i tuoi link

L’esempio get-links seguente ottiene i link nella rete globale specificata.

aws networkmanager get-links \ --global-network-id global-network-01231231231231231 \ --region us-west-2

Output:

{ "Links": [ { "LinkId": "link-11112222aaaabbbb1", "LinkArn": "arn:aws:networkmanager::123456789012:link/global-network-01231231231231231/link-11112222aaaabbbb1", "GlobalNetworkId": "global-network-01231231231231231", "SiteId": "site-444555aaabbb11223", "Description": "VPN Link", "Type": "broadband", "Bandwidth": { "UploadSpeed": 10, "DownloadSpeed": 20 }, "Provider": "AnyCompany", "CreatedAt": 1575555811.0, "State": "AVAILABLE" } ] }
  • Per informazioni dettagliate sull’API, consulta GetLinks in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare get-object-retention.

AWS CLI

Come recuperare la configurazione di conservazione degli oggetti per un oggetto

L’esempio get-object-retention seguente recupera la configurazione di conservazione degli oggetti per l’oggetto specificato.

aws s3api get-object-retention \ --bucket amzn-s3-demo-bucket-with-object-lock \ --key doc1.rtf

Output:

{ "Retention": { "Mode": "GOVERNANCE", "RetainUntilDate": "2025-01-01T00:00:00.000Z" } }
  • Per informazioni dettagliate sull’API, consulta GetObjectRetention in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare get-public-access-block.

AWS CLI

Come impostare o modificare la configurazione di blocco dell’accesso pubblico per un bucket

L’esempio get-public-access-block seguente visualizza la configurazione di blocco dell’accesso pubblico per il bucket specificato.

aws s3api get-public-access-block --bucket amzn-s3-demo-bucket

Output:

{ "PublicAccessBlockConfiguration": { "IgnorePublicAcls": true, "BlockPublicPolicy": true, "BlockPublicAcls": true, "RestrictPublicBuckets": true } }
  • Per informazioni dettagliate sull’API, consulta GetPublicAccessBlock in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare get-sites.

AWS CLI

Come ottenere i tuoi siti

L’esempio get-sites seguente ottiene i siti nella rete globale specificata.

aws networkmanager get-sites \ --global-network-id global-network-01231231231231231 \ --region us-west-2

Output:

{ "Sites": [ { "SiteId": "site-444555aaabbb11223", "SiteArn": "arn:aws:networkmanager::123456789012:site/global-network-01231231231231231/site-444555aaabbb11223", "GlobalNetworkId": "global-network-01231231231231231", "Description": "NY head office", "Location": { "Latitude": "40.7128", "Longitude": "-74.0060" }, "CreatedAt": 1575554528.0, "State": "AVAILABLE" } ] }
  • Per informazioni dettagliate sull’API, consulta GetSites in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare get-transit-gateway-registrations.

AWS CLI

Come ottenere le registrazioni dei gateway di transito

L’esempio get-transit-gateway-registrations seguente ottiene i gateway di transito registrati nella rete globale specificata.

aws networkmanager get-transit-gateway-registrations \ --global-network-id global-network-01231231231231231 \ --region us-west-2

Output:

{ "TransitGatewayRegistrations": [ { "GlobalNetworkId": "global-network-01231231231231231", "TransitGatewayArn": "arn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-123abc05e04123abc", "State": { "Code": "AVAILABLE" } } ] }

L’esempio di codice seguente mostra come utilizzare get-vpc-attachment.

AWS CLI

Come ottenere un collegamento VPC

L’esempio get-vpc-attachment seguente restituisce informazioni su un collegamento VPC.

aws networkmanager get-vpc-attachment \ --attachment-id attachment-03b7ea450134787da

Output:

{ "VpcAttachment": { "Attachment": { "CoreNetworkId": "core-network-0522de1b226a5d7b3", "AttachmentId": "attachment-03b7ea450134787da", "OwnerAccountId": "987654321012", "AttachmentType": "VPC", "State": "CREATING", "EdgeLocation": "us-east-1", "ResourceArn": "arn:aws:ec2:us-east-1:987654321012:vpc/vpc-a7c4bbda", "Tags": [ { "Key": "Name", "Value": "DevVPC" } ], "CreatedAt": "2022-03-11T17:48:58+00:00", "UpdatedAt": "2022-03-11T17:48:58+00:00" }, "SubnetArns": [ "arn:aws:ec2:us-east-1:987654321012:subnet/subnet-202cde6c", "arn:aws:ec2:us-east-1:987654321012:subnet/subnet-e5022dba", "arn:aws:ec2:us-east-1:987654321012:subnet/subnet-2387ae02", "arn:aws:ec2:us-east-1:987654321012:subnet/subnet-cda9dffc" ], "Options": { "Ipv6Support": false } } }

Per ulteriori informazioni, consulta Attachments nella Guida per l’utente di Cloud WAN.

  • Per informazioni dettagliate sull’API, consulta GetVpcAttachment in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare list-bucket-analytics-configurations.

AWS CLI

Come recuperare un elenco di configurazioni di analisi per un bucket

L’esempio list-bucket-analytics-configurations seguente recupera un elenco di configurazioni di analisi per il bucket specificato.

aws s3api list-bucket-analytics-configurations \ --bucket amzn-s3-demo-bucket

Output:

{ "AnalyticsConfigurationList": [ { "StorageClassAnalysis": {}, "Id": "1" } ], "IsTruncated": false }

L’esempio di codice seguente mostra come utilizzare list-bucket-metrics-configurations.

AWS CLI

Come recuperare un elenco di configurazioni di metriche per un bucket

L’esempio list-bucket-metrics-configurations seguente recupera un elenco di configurazioni di metriche per il bucket specificato.

aws s3api list-bucket-metrics-configurations \ --bucket amzn-s3-demo-bucket

Output:

{ "IsTruncated": false, "MetricsConfigurationList": [ { "Filter": { "Prefix": "logs" }, "Id": "123" }, { "Filter": { "Prefix": "tmp" }, "Id": "234" } ] }

L’esempio di codice seguente mostra come utilizzare list-tags-for-resource.

AWS CLI

Come elencare i tag per una risorsa

L’esempio list-tags-for-resource seguente elenca i tag per la risorsa dispositivo specificata (device-07f6fd08867abc123).

aws networkmanager list-tags-for-resource \ --resource-arn arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123 \ --region us-west-2

Output:

{ "TagList": [ { "Key": "Network", "Value": "Northeast" } ] }
  • Per informazioni dettagliate sull'API, consulta ListTagsForResource nella Documentazione di riferimento dei comandi della AWS CLI.

L’esempio di codice seguente mostra come utilizzare put-bucket-metrics-configuration.

AWS CLI

Come impostare una configurazione delle metriche per un bucket

L’esempio put-bucket-metrics-configuration seguente imposta una configurazione della metrica con ID 123 per il bucket specificato.

aws s3api put-bucket-metrics-configuration \ --bucket amzn-s3-demo-bucket \ --id 123 \ --metrics-configuration '{"Id": "123", "Filter": {"Prefix": "logs"}}'

Questo comando non produce alcun output.

L’esempio di codice seguente mostra come utilizzare put-object-retention.

AWS CLI

Come impostare una configurazione di conservazione degli oggetti per un oggetto

L’esempio put-object-retention seguente imposta una configurazione di conservazione degli oggetti per l’oggetto specificato fino al 01/01/2025.

aws s3api put-object-retention \ --bucket amzn-s3-demo-bucket-with-object-lock \ --key doc1.rtf \ --retention '{ "Mode": "GOVERNANCE", "RetainUntilDate": "2025-01-01T00:00:00" }'

Questo comando non produce alcun output.

  • Per informazioni dettagliate sull’API, consulta PutObjectRetention in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare put-public-access-block.

AWS CLI

Come impostare la configurazione di blocco dell’accesso pubblico per un bucket

L’esempio put-public-access-block seguente imposta una configurazione di blocco dell’accesso pubblico restrittiva per il bucket specificato.

aws s3api put-public-access-block \ --bucket amzn-s3-demo-bucket \ --public-access-block-configuration "BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true"

Questo comando non produce alcun output.

  • Per informazioni dettagliate sull’API, consulta PutPublicAccessBlock in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare register-transit-gateway.

AWS CLI

Come registrare un gateway di transito in una rete globale

L’esempio register-transit-gateway seguente registra il gateway di transito tgw-123abc05e04123abc nella rete globale specificata.

aws networkmanager register-transit-gateway \ --global-network-id global-network-01231231231231231 \ --transit-gateway-arn arn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-123abc05e04123abc \ --region us-west-2

Output:

{ "TransitGatewayRegistration": { "GlobalNetworkId": "global-network-01231231231231231", "TransitGatewayArn": "arn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-123abc05e04123abc", "State": { "Code": "PENDING" } } }

Per ulteriori informazioni, consulta Transit Gateway Registrations nella Guida di Transit Gateway network manager.

L’esempio di codice seguente mostra come utilizzare reject-attachment.

AWS CLI

Come rifiutare un collegamento

L’esempio reject-attachment seguente rifiuta una richiesta di collegamento VPC.

aws networkmanager reject-attachment \ --attachment-id attachment-03b7ea450134787da

Output:

{ "Attachment": { "CoreNetworkId": "core-network-0522de1b226a5d7b3", "AttachmentId": "attachment-03b7ea450134787da", "OwnerAccountId": "987654321012", "AttachmentType": "VPC", "State": "AVAILABLE", "EdgeLocation": "us-east-1", "ResourceArn": "arn:aws:ec2:us-east-1:987654321012:vpc/vpc-a7c4bbda", "CreatedAt": "2022-03-11T17:48:58+00:00", "UpdatedAt": "2022-03-11T17:51:25+00:00" } }

Per ulteriori informazioni, consulta Attachment acceptance nella Guida per l’utente di Cloud WAN.

  • Per informazioni dettagliate sull’API, consulta RejectAttachment in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare start-route-analysis.

AWS CLI

Come avviare l’analisi della route

L’esempio start-route-analysis seguente avvia l’analisi tra un’origine e una destinazione, inclusa l’opzione include-return-path facoltativa.

aws networkmanager start-route-analysis \ --global-network-id global-network-00aa0aaa0b0aaa000 \ --source TransitGatewayAttachmentArn=arn:aws:ec2:us-east-1:503089527312:transit-gateway-attachment/tgw-attach-0d4a2d491bf68c093,IpAddress=10.0.0.0 \ --destination TransitGatewayAttachmentArn=arn:aws:ec2:us-west-1:503089527312:transit-gateway-attachment/tgw-attach-002577f30bb181742,IpAddress=11.0.0.0 \ --include-return-path

Output:

{ "RouteAnalysis": { "GlobalNetworkId": "global-network-00aa0aaa0b0aaa000 "OwnerAccountId": "1111222233333", "RouteAnalysisId": "a1873de1-273c-470c-1a2bc2345678", "StartTimestamp": 1695760154.0, "Status": "RUNNING", "Source": { "TransitGatewayAttachmentArn": "arn:aws:ec2:us-east-1:111122223333:transit-gateway-attachment/tgw-attach-1234567890abcdef0, "TransitGatewayArn": "arn:aws:ec2:us-east-1:111122223333:transit-gateway/tgw-abcdef01234567890", "IpAddress": "10.0.0.0" }, "Destination": { "TransitGatewayAttachmentArn": "arn:aws:ec2:us-west-1:555555555555:transit-gateway-attachment/tgw-attach-021345abcdef6789", "TransitGatewayArn": "arn:aws:ec2:us-west-1:111122223333:transit-gateway/tgw-09876543210fedcba0", "IpAddress": "11.0.0.0" }, "IncludeReturnPath": true, "UseMiddleboxes": false } }

Per ulteriori informazioni, consulta Route Analyzer nella Guida per l’utente di Reti globali AWS per gateway di transito.

  • Per informazioni dettagliate sull’API, consulta StartRouteAnalysis in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare tag-resource.

AWS CLI

Come aggiungere tag a una risorsa

L’esempio tag-resource seguente applica il tag Network=Northeast al dispositivo device-07f6fd08867abc123.

aws networkmanager tag-resource \ --resource-arn arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123 \ --tags Key=Network,Value=Northeast \ --region us-west-2

Questo comando non produce alcun output.

  • Per informazioni dettagliate sull’API, consulta TagResource in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare untag-resource.

AWS CLI

Come rimuovere tag da una risorsa

L’esempio untag-resource seguente rimuove il tag con la chiave Network dal dispositivo device-07f6fd08867abc123.

aws networkmanager untag-resource \ --resource-arn arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123 ] --tag-keys Network \ --region us-west-2

Questo comando non produce alcun output.

  • Per informazioni dettagliate sull’API, consulta UntagResource in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare update-device.

AWS CLI

Come aggiornare un dispositivo

L’esempio update-device seguente aggiorna il dispositivo device-07f6fd08867abc123 specificando un ID del sito per il dispositivo.

aws networkmanager update-device \ --global-network-id global-network-01231231231231231 \ --device-id device-07f6fd08867abc123 \ --site-id site-444555aaabbb11223 \ --region us-west-2

Output:

{ "Device": { "DeviceId": "device-07f6fd08867abc123", "DeviceArn": "arn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123", "GlobalNetworkId": "global-network-01231231231231231", "Description": "NY office device", "Type": "Office device", "Vendor": "anycompany", "Model": "abcabc", "SerialNumber": "1234", "SiteId": "site-444555aaabbb11223", "CreatedAt": 1575554005.0, "State": "UPDATING" } }

Per ulteriori informazioni, consulta Working with Devices nella Guida di Transit Gateway network manager.

  • Per informazioni dettagliate sull’API, consulta UpdateDevice in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare update-global-network.

AWS CLI

Come aggiornare una rete globale

L’esempio update-global-network seguente aggiorna la descrizione per la rete globale global-network-01231231231231231.

aws networkmanager update-global-network \ --global-network-id global-network-01231231231231231 \ --description "Head offices" \ --region us-west-2

Output:

{ "GlobalNetwork": { "GlobalNetworkId": "global-network-01231231231231231", "GlobalNetworkArn": "arn:aws:networkmanager::123456789012:global-network/global-network-01231231231231231", "Description": "Head offices", "CreatedAt": 1575553525.0, "State": "UPDATING" } }

Per ulteriori informazioni, consulta Global Networks nella Guida di Transit Gateway network manager.

  • Per informazioni dettagliate sull’API, consulta UpdateGlobalNetwork in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare update-link.

AWS CLI

Come aggiornare un link

L’esempio update-link seguente aggiorna le informazioni sulla larghezza di banda per il link link-11112222aaaabbbb1.

aws networkmanager update-link \ --global-network-id global-network-01231231231231231 \ --link-id link-11112222aaaabbbb1 \ --bandwidth UploadSpeed=20,DownloadSpeed=20 \ --region us-west-2

Output:

{ "Link": { "LinkId": "link-11112222aaaabbbb1", "LinkArn": "arn:aws:networkmanager::123456789012:link/global-network-01231231231231231/link-11112222aaaabbbb1", "GlobalNetworkId": "global-network-01231231231231231", "SiteId": "site-444555aaabbb11223", "Description": "VPN Link", "Type": "broadband", "Bandwidth": { "UploadSpeed": 20, "DownloadSpeed": 20 }, "Provider": "AnyCompany", "CreatedAt": 1575555811.0, "State": "UPDATING" } }

Per ulteriori informazioni, consulta Working with Links nella Guida di Transit Gateway network manager.

  • Per informazioni dettagliate sull’API, consulta UpdateLink in AWS CLI Command Reference.

L’esempio di codice seguente mostra come utilizzare update-site.

AWS CLI

Come aggiornare un sito

L’esempio update-site seguente aggiorna la descrizione per il sito site-444555aaabbb11223 nella rete globale specificata.

aws networkmanager update-site \ --global-network-id global-network-01231231231231231 \ --site-id site-444555aaabbb11223 \ --description "New York Office site" \ --region us-west-2

Output:

{ "Site": { "SiteId": "site-444555aaabbb11223", "SiteArn": "arn:aws:networkmanager::123456789012:site/global-network-01231231231231231/site-444555aaabbb11223", "GlobalNetworkId": "global-network-01231231231231231", "Description": "New York Office site", "Location": { "Latitude": "40.7128", "Longitude": "-74.0060" }, "CreatedAt": 1575554528.0, "State": "UPDATING" } }

Per ulteriori informazioni, consulta Working with Sites nella Guida di Transit Gateway network manager.

  • Per informazioni dettagliate sull’API, consulta UpdateSite in AWS CLI Command Reference.