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-gatewayseguente associa il gateway del clientecgw-11223344556677889nella rete globale specificata al dispositivodevice-07f6fd08867abc123.aws networkmanager associate-customer-gateway \ --customer-gateway-arnarn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-11223344556677889\ --global-network-idglobal-network-01231231231231231\ --device-iddevice-07f6fd08867abc123\ --regionus-west-2Output:
{ "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.
-
Per informazioni dettagliate sull’API, consulta AssociateCustomerGateway
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare associate-link.
- AWS CLI
-
Come associare un link
L’esempio
associate-linkseguente associa il linklink-11112222aaaabbbb1al dispositivodevice-07f6fd08867abc123. Il link e il dispositivo si trovano nella rete globale specificata.aws networkmanager associate-link \ --global-network-idglobal-network-01231231231231231\ --device-iddevice-07f6fd08867abc123\ --link-idlink-11112222aaaabbbb1\ --regionus-west-2Output:
{ "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-networkseguente 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-idglobal-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-deviceseguente 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-idglobal-network-01231231231231231\ --description"New York office device"\ --type"office device"\ --vendor"anycompany"\ --model"abcabc"\ --serial-number"1234"\ --regionus-west-2Output:
{ "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-networkseguente crea una nuova rete globale. Lo stato iniziale al momento della creazione èPENDING.aws networkmanager create-global-networkOutput:
{ "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-linkseguente 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-idglobal-network-01231231231231231\ --description"VPN Link"\ --type"broadband"\ --bandwidthUploadSpeed=10,DownloadSpeed=20\ --provider"AnyCompany"\ --site-idsite-444555aaabbb11223\ --regionus-west-2Output:
{ "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-siteseguente crea un sito nella rete globale specificata. I dettagli del sito includono una descrizione e informazioni sulla posizione.aws networkmanager create-site \ --global-network-idglobal-network-01231231231231231\ --description"New York head office"\ --locationLatitude=40.7128,Longitude=-74.0060\ --regionus-west-2Output:
{ "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-attachmentseguente crea un collegamento VPC con supporto IPv6 in una rete core.aws networkmanager create-vpc-attachment \ --core-network-idcore-network-0fab62fe438d94db6\ --vpc-arnarn:aws:ec2:us-east-1:987654321012:vpc/vpc-09f37f69e2786eeb8\ --subnet-arnsarn:aws:ec2:us-east-1:987654321012:subnet/subnet-04ca4e010857e7bb7\ --Ipv6Support=trueOutput:
{ "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-attachmentseguente elimina un collegamento Connect.aws networkmanager delete-attachment \ --attachment-idattachment-01feddaeae26ab68cOutput:
{ "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-configurationseguente rimuove la configurazione di analisi per il bucket e l’ID specificati.aws s3api delete-bucket-analytics-configuration \ --bucketamzn-s3-demo-bucket\ --id1Questo comando non produce alcun output.
-
Per informazioni dettagliate sull’API, consulta DeleteBucketAnalyticsConfiguration
in AWS CLI Command Reference.
-
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-configurationseguente rimuove la configurazione delle metriche per il bucket e l’ID specificati.aws s3api delete-bucket-metrics-configuration \ --bucketamzn-s3-demo-bucket\ --id123Questo comando non produce alcun output.
-
Per informazioni dettagliate sull’API, consulta DeleteBucketMetricsConfiguration
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare delete-core-network.
- AWS CLI
-
Come eliminare una rete core
L’esempio
delete-core-networkseguente elimina una rete core da una rete globale Cloud WAN.aws networkmanager delete-core-network \ --core-network-idcore-network-0fab62fe438d94db6Output:
{ "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-deviceseguente elimina il dispositivo specificato dalla rete globale specificata.aws networkmanager delete-device \ --global-network-idglobal-network-01231231231231231\ --device-iddevice-07f6fd08867abc123\ --regionus-west-2Output:
{ "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-networkseguente elimina una rete globale.aws networkmanager delete-global-network \ --global-network-idglobal-network-052bedddccb193b6bOutput:
{ "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-linkseguente elimina il link specificato dalla rete globale specificata.aws networkmanager delete-link \ --global-network-idglobal-network-01231231231231231\ --link-idlink-11112222aaaabbbb1\ --regionus-west-2Output:
{ "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-blockseguente rimuove la configurazione di blocco dell’accesso pubblico nel bucket specificato.aws s3api delete-public-access-block \ --bucketamzn-s3-demo-bucketQuesto comando non produce alcun output.
-
Per informazioni dettagliate sull’API, consulta DeletePublicAccessBlock
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare delete-site.
- AWS CLI
-
Come eliminare un sito
L’esempio
delete-siteseguente elimina il sito specificato (site-444555aaabbb11223) nella rete globale specificata.aws networkmanager delete-site \ --global-network-idglobal-network-01231231231231231\ --site-idsite-444555aaabbb11223\ --regionus-west-2Output:
{ "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-gatewayseguente annulla la registrazione del gateway di transito specificato nella rete globale specificata.aws networkmanager deregister-transit-gateway \ --global-network-idglobal-network-01231231231231231\ --transit-gateway-arnarn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-123abc05e04123abc\ --regionus-west-2Output:
{ "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.
-
Per informazioni dettagliate sull’API, consulta DeregisterTransitGateway
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare describe-global-networks.
- AWS CLI
-
Come descrivere le reti globali
L’esempio
describe-global-networksseguente descrive tutte le reti globali nell’account.aws networkmanager describe-global-networks \ --regionus-west-2Output:
{ "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" } ] }-
Per informazioni dettagliate sull’API, consulta DescribeGlobalNetworks
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare disassociate-customer-gateway.
- AWS CLI
-
Come dissociare un gateway del cliente
L’esempio
disassociate-customer-gatewayseguente dissocia il gateway del cliente specificato (cgw-11223344556677889) dalla rete globale specificata.aws networkmanager disassociate-customer-gateway \ --global-network-idglobal-network-01231231231231231\ --customer-gateway-arnarn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-11223344556677889\ --regionus-west-2Output:
{ "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.
-
Per informazioni dettagliate sull’API, consulta DisassociateCustomerGateway
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare disassociate-link.
- AWS CLI
-
Come dissociare un link
L’esempio
disassociate-linkseguente dissocia il link specificato dal dispositivodevice-07f6fd08867abc123nella rete globale specificata.aws networkmanager disassociate-link \ --global-network-idglobal-network-01231231231231231\ --device-iddevice-07f6fd08867abc123\ --link-idlink-11112222aaaabbbb1\ --regionus-west-2Output:
{ "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-configurationseguente visualizza la configurazione di analisi per il bucket e l’ID specificati.aws s3api get-bucket-analytics-configuration \ --bucketamzn-s3-demo-bucket\ --id1Output:
{ "AnalyticsConfiguration": { "StorageClassAnalysis": {}, "Id": "1" } }-
Per informazioni dettagliate sull’API, consulta GetBucketAnalyticsConfiguration
in AWS CLI Command Reference.
-
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-configurationseguente visualizza la configurazione delle metriche per il bucket e l’ID specificati.aws s3api get-bucket-metrics-configuration \ --bucketamzn-s3-demo-bucket\ --id123Output:
{ "MetricsConfiguration": { "Filter": { "Prefix": "logs" }, "Id": "123" } }-
Per informazioni dettagliate sull’API, consulta GetBucketMetricsConfiguration
in AWS CLI Command Reference.
-
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-associationsseguente ottiene le associazioni del gateway del cliente per la rete globale specificata.aws networkmanager get-customer-gateway-associations \ --global-network-idglobal-network-01231231231231231\ --regionus-west-2Output:
{ "CustomerGatewayAssociations": [ { "CustomerGatewayArn": "arn:aws:ec2:us-west-2:123456789012:customer-gateway/cgw-11223344556677889", "GlobalNetworkId": "global-network-01231231231231231", "DeviceId": "device-07f6fd08867abc123", "State": "AVAILABLE" } ] }-
Per informazioni dettagliate sull’API, consulta GetCustomerGatewayAssociations
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-devices.
- AWS CLI
-
Come ottenere i tuoi dispositivi
L’esempio
get-devicesseguente ottiene i dispositivi nella rete globale specificata.aws networkmanager get-devices \ --global-network-idglobal-network-01231231231231231\ --regionus-west-2Output:
{ "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-associationsseguente ottiene le associazioni dei link nella rete globale specificata.aws networkmanager get-link-associations \ --global-network-idglobal-network-01231231231231231\ --regionus-west-2Output:
{ "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-linksseguente ottiene i link nella rete globale specificata.aws networkmanager get-links \ --global-network-idglobal-network-01231231231231231\ --regionus-west-2Output:
{ "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-retentionseguente recupera la configurazione di conservazione degli oggetti per l’oggetto specificato.aws s3api get-object-retention \ --bucketamzn-s3-demo-bucket-with-object-lock\ --keydoc1.rtfOutput:
{ "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-blockseguente visualizza la configurazione di blocco dell’accesso pubblico per il bucket specificato.aws s3api get-public-access-block --bucketamzn-s3-demo-bucketOutput:
{ "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-sitesseguente ottiene i siti nella rete globale specificata.aws networkmanager get-sites \ --global-network-idglobal-network-01231231231231231\ --regionus-west-2Output:
{ "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-registrationsseguente ottiene i gateway di transito registrati nella rete globale specificata.aws networkmanager get-transit-gateway-registrations \ --global-network-idglobal-network-01231231231231231\ --regionus-west-2Output:
{ "TransitGatewayRegistrations": [ { "GlobalNetworkId": "global-network-01231231231231231", "TransitGatewayArn": "arn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-123abc05e04123abc", "State": { "Code": "AVAILABLE" } } ] }-
Per informazioni dettagliate sull’API, consulta GetTransitGatewayRegistrations
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-vpc-attachment.
- AWS CLI
-
Come ottenere un collegamento VPC
L’esempio
get-vpc-attachmentseguente restituisce informazioni su un collegamento VPC.aws networkmanager get-vpc-attachment \ --attachment-idattachment-03b7ea450134787daOutput:
{ "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-configurationsseguente recupera un elenco di configurazioni di analisi per il bucket specificato.aws s3api list-bucket-analytics-configurations \ --bucketamzn-s3-demo-bucketOutput:
{ "AnalyticsConfigurationList": [ { "StorageClassAnalysis": {}, "Id": "1" } ], "IsTruncated": false }-
Per informazioni dettagliate sull’API, consulta ListBucketAnalyticsConfigurations
in AWS CLI Command Reference.
-
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-configurationsseguente recupera un elenco di configurazioni di metriche per il bucket specificato.aws s3api list-bucket-metrics-configurations \ --bucketamzn-s3-demo-bucketOutput:
{ "IsTruncated": false, "MetricsConfigurationList": [ { "Filter": { "Prefix": "logs" }, "Id": "123" }, { "Filter": { "Prefix": "tmp" }, "Id": "234" } ] }-
Per informazioni dettagliate sull’API, consulta ListBucketMetricsConfigurations
in AWS CLI Command Reference.
-
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-resourceseguente elenca i tag per la risorsa dispositivo specificata (device-07f6fd08867abc123).aws networkmanager list-tags-for-resource \ --resource-arnarn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123\ --regionus-west-2Output:
{ "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-configurationseguente imposta una configurazione della metrica con ID 123 per il bucket specificato.aws s3api put-bucket-metrics-configuration \ --bucketamzn-s3-demo-bucket\ --id123\ --metrics-configuration '{"Id": "123", "Filter": {"Prefix": "logs"}}'Questo comando non produce alcun output.
-
Per informazioni dettagliate sull’API, consulta PutBucketMetricsConfiguration
in AWS CLI Command Reference.
-
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-retentionseguente imposta una configurazione di conservazione degli oggetti per l’oggetto specificato fino al 01/01/2025.aws s3api put-object-retention \ --bucketamzn-s3-demo-bucket-with-object-lock\ --keydoc1.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-blockseguente imposta una configurazione di blocco dell’accesso pubblico restrittiva per il bucket specificato.aws s3api put-public-access-block \ --bucketamzn-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-gatewayseguente registra il gateway di transitotgw-123abc05e04123abcnella rete globale specificata.aws networkmanager register-transit-gateway \ --global-network-idglobal-network-01231231231231231\ --transit-gateway-arnarn:aws:ec2:us-west-2:123456789012:transit-gateway/tgw-123abc05e04123abc\ --regionus-west-2Output:
{ "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.
-
Per informazioni dettagliate sull’API, consulta RegisterTransitGateway
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare reject-attachment.
- AWS CLI
-
Come rifiutare un collegamento
L’esempio
reject-attachmentseguente rifiuta una richiesta di collegamento VPC.aws networkmanager reject-attachment \ --attachment-idattachment-03b7ea450134787daOutput:
{ "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-analysisseguente avvia l’analisi tra un’origine e una destinazione, inclusa l’opzioneinclude-return-pathfacoltativa.aws networkmanager start-route-analysis \ --global-network-idglobal-network-00aa0aaa0b0aaa000\ --sourceTransitGatewayAttachmentArn=arn:aws:ec2:us-east-1:503089527312:transit-gateway-attachment/tgw-attach-0d4a2d491bf68c093,IpAddress=10.0.0.0\ --destinationTransitGatewayAttachmentArn=arn:aws:ec2:us-west-1:503089527312:transit-gateway-attachment/tgw-attach-002577f30bb181742,IpAddress=11.0.0.0\ --include-return-pathOutput:
{ "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-resourceseguente applica il tagNetwork=Northeastal dispositivodevice-07f6fd08867abc123.aws networkmanager tag-resource \ --resource-arnarn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123\ --tagsKey=Network,Value=Northeast\ --regionus-west-2Questo 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-resourceseguente rimuove il tag con la chiaveNetworkdal dispositivodevice-07f6fd08867abc123.aws networkmanager untag-resource \ --resource-arnarn:aws:networkmanager::123456789012:device/global-network-01231231231231231/device-07f6fd08867abc123]--tag-keysNetwork\ --regionus-west-2Questo 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-deviceseguente aggiorna il dispositivodevice-07f6fd08867abc123specificando un ID del sito per il dispositivo.aws networkmanager update-device \ --global-network-idglobal-network-01231231231231231\ --device-iddevice-07f6fd08867abc123\ --site-idsite-444555aaabbb11223\ --regionus-west-2Output:
{ "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-networkseguente aggiorna la descrizione per la rete globaleglobal-network-01231231231231231.aws networkmanager update-global-network \ --global-network-idglobal-network-01231231231231231\ --description"Head offices"\ --regionus-west-2Output:
{ "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-linkseguente aggiorna le informazioni sulla larghezza di banda per il linklink-11112222aaaabbbb1.aws networkmanager update-link \ --global-network-idglobal-network-01231231231231231\ --link-idlink-11112222aaaabbbb1\ --bandwidthUploadSpeed=20,DownloadSpeed=20\ --regionus-west-2Output:
{ "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-siteseguente aggiorna la descrizione per il sitosite-444555aaabbb11223nella rete globale specificata.aws networkmanager update-site \ --global-network-idglobal-network-01231231231231231\ --site-idsite-444555aaabbb11223\ --description"New York Office site"\ --regionus-west-2Output:
{ "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.
-