Seleziona le tue preferenze relative ai cookie

Utilizziamo cookie essenziali e strumenti simili necessari per fornire il nostro sito e i nostri servizi. Utilizziamo i cookie prestazionali per raccogliere statistiche anonime in modo da poter capire come i clienti utilizzano il nostro sito e apportare miglioramenti. I cookie essenziali non possono essere disattivati, ma puoi fare clic su \"Personalizza\" o \"Rifiuta\" per rifiutare i cookie prestazionali.

Se sei d'accordo, AWS e le terze parti approvate utilizzeranno i cookie anche per fornire utili funzionalità del sito, ricordare le tue preferenze e visualizzare contenuti pertinenti, inclusa la pubblicità pertinente. Per continuare senza accettare questi cookie, fai clic su \"Continua\" o \"Rifiuta\". Per effettuare scelte più dettagliate o saperne di più, fai clic su \"Personalizza\".

VPCEsempi di reticoli utilizzando AWS CLI

Modalità Focus
VPCEsempi di reticoli utilizzando AWS CLI - AWS Command Line Interface

Questa documentazione è valida AWS CLI solo per la versione 1. Per la documentazione relativa alla versione 2 di AWS CLI, consulta la Guida per l'utente della versione 2.

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à.

Questa documentazione è valida AWS CLI solo per la versione 1. Per la documentazione relativa alla versione 2 di AWS CLI, consulta la Guida per l'utente della versione 2.

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à.

I seguenti esempi di codice mostrano come eseguire azioni e implementare scenari comuni utilizzando AWS Command Line Interface with VPC Lattice.

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

Ogni esempio include un collegamento al codice sorgente completo, in cui è possibile trovare istruzioni su come configurare ed eseguire il codice nel contesto.

Argomenti

Azioni

Il seguente esempio di codice mostra come utilizzarecreate-listener.

AWS CLI

Per creare un ascoltatore

L'create-listeneresempio seguente crea un HTTPS listener con una regola predefinita che inoltra il traffico al gruppo target VPC Lattice specificato.

aws vpc-lattice create-listener \ --name my-service-listener \ --protocol HTTPS \ --port 443 \ --service-identifier svc-0285b53b2eEXAMPLE \ --default-action file://listener-config.json

Contenuto di listener-config.json.

{ "forward": { "targetGroups": [ { "targetGroupIdentifier": "tg-0eaa4b9ab4EXAMPLE" } ] } }

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE/listener/listener-07cc7fb0abEXAMPLE", "defaultAction": { "forward": { "targetGroups": [ { "targetGroupIdentifier": "tg-0eaa4b9ab4EXAMPLE", "weight": 100 } ] } }, "id": "listener-07cc7fb0abEXAMPLE", "name": "my-service-listener", "port": 443, "protocol": "HTTPS", "serviceArn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "serviceId": "svc-0285b53b2eEXAMPLE" }

Per ulteriori informazioni, consulta Listeners nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command CreateListenerReference.

Il seguente esempio di codice mostra come utilizzarecreate-listener.

AWS CLI

Per creare un ascoltatore

L'create-listeneresempio seguente crea un HTTPS listener con una regola predefinita che inoltra il traffico al gruppo target VPC Lattice specificato.

aws vpc-lattice create-listener \ --name my-service-listener \ --protocol HTTPS \ --port 443 \ --service-identifier svc-0285b53b2eEXAMPLE \ --default-action file://listener-config.json

Contenuto di listener-config.json.

{ "forward": { "targetGroups": [ { "targetGroupIdentifier": "tg-0eaa4b9ab4EXAMPLE" } ] } }

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE/listener/listener-07cc7fb0abEXAMPLE", "defaultAction": { "forward": { "targetGroups": [ { "targetGroupIdentifier": "tg-0eaa4b9ab4EXAMPLE", "weight": 100 } ] } }, "id": "listener-07cc7fb0abEXAMPLE", "name": "my-service-listener", "port": 443, "protocol": "HTTPS", "serviceArn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "serviceId": "svc-0285b53b2eEXAMPLE" }

Per ulteriori informazioni, consulta Listeners nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command CreateListenerReference.

Il seguente esempio di codice mostra come utilizzarecreate-service-network-service-association.

AWS CLI

Per creare un'associazione di servizi

L'create-service-network-service-associationesempio seguente associa il servizio specificato alla rete di servizi specificata.

aws vpc-lattice create-service-network-service-association \ --service-identifier svc-0285b53b2eEXAMPLE \ --service-network-identifier sn-080ec7dc93EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkserviceassociation/snsa-0e16955a8cEXAMPLE", "createdBy": "123456789012", "dnsEntry": { "domainName": "my-lattice-service-0285b53b2eEXAMPLE.7d67968.vpc-lattice-svcs.us-east-2.on.aws", "hostedZoneId": "Z09127221KTH2CEXAMPLE" }, "id": "snsa-0e16955a8cEXAMPLE", "status": "CREATE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Gestire le associazioni di servizi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarecreate-service-network-service-association.

AWS CLI

Per creare un'associazione di servizi

L'create-service-network-service-associationesempio seguente associa il servizio specificato alla rete di servizi specificata.

aws vpc-lattice create-service-network-service-association \ --service-identifier svc-0285b53b2eEXAMPLE \ --service-network-identifier sn-080ec7dc93EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkserviceassociation/snsa-0e16955a8cEXAMPLE", "createdBy": "123456789012", "dnsEntry": { "domainName": "my-lattice-service-0285b53b2eEXAMPLE.7d67968.vpc-lattice-svcs.us-east-2.on.aws", "hostedZoneId": "Z09127221KTH2CEXAMPLE" }, "id": "snsa-0e16955a8cEXAMPLE", "status": "CREATE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Gestire le associazioni di servizi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarecreate-service-network-vpc-association.

AWS CLI

Per creare un'VPCassociazione

L'create-service-network-vpc-associationesempio seguente associa il vpc specificato alla rete di servizi specificata. Il gruppo di sicurezza specificato controlla quali risorse in VPC possono accedere alla rete di servizi e ai relativi servizi.

aws vpc-lattice create-service-network-vpc-association \ --vpc-identifier vpc-0a1b2c3d4eEXAMPLE \ --service-network-identifier sn-080ec7dc93EXAMPLE \ --security-group-ids sg-0aee16bc6cEXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkvpcassociation/snva-0821fc8631EXAMPLE", "createdBy": "123456789012", "id": "snva-0821fc8631EXAMPLE", "securityGroupIds": [ "sg-0aee16bc6cEXAMPLE" ], "status": "CREATE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Gestire VPC le associazioni nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarecreate-service-network-vpc-association.

AWS CLI

Per creare un'VPCassociazione

L'create-service-network-vpc-associationesempio seguente associa il vpc specificato alla rete di servizi specificata. Il gruppo di sicurezza specificato controlla quali risorse in VPC possono accedere alla rete di servizi e ai relativi servizi.

aws vpc-lattice create-service-network-vpc-association \ --vpc-identifier vpc-0a1b2c3d4eEXAMPLE \ --service-network-identifier sn-080ec7dc93EXAMPLE \ --security-group-ids sg-0aee16bc6cEXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkvpcassociation/snva-0821fc8631EXAMPLE", "createdBy": "123456789012", "id": "snva-0821fc8631EXAMPLE", "securityGroupIds": [ "sg-0aee16bc6cEXAMPLE" ], "status": "CREATE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Gestire VPC le associazioni nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarecreate-service-network.

AWS CLI

Per creare una rete di servizi

L'create-service-networkesempio seguente crea una rete di servizi con il nome specificato.

aws vpc-lattice create-service-network \ --name my-service-network

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "authType": "NONE", "id": "sn-080ec7dc93EXAMPLE", "name": "my-service-network" }

Per ulteriori informazioni, consulta Service networks nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarecreate-service-network.

AWS CLI

Per creare una rete di servizi

L'create-service-networkesempio seguente crea una rete di servizi con il nome specificato.

aws vpc-lattice create-service-network \ --name my-service-network

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "authType": "NONE", "id": "sn-080ec7dc93EXAMPLE", "name": "my-service-network" }

Per ulteriori informazioni, consulta Service networks nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarecreate-service.

AWS CLI

Per creare un servizio

L'create-serviceesempio seguente crea un servizio con il nome specificato.

aws vpc-lattice create-service \ --name my-lattice-service

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "authType": "NONE", "dnsEntry": { "domainName": "my-lattice-service-0285b53b2eEXAMPLE.1a2b3c4.vpc-lattice-svcs.us-east-2.on.aws", "hostedZoneId": "Z09127221KTH2CEXAMPLE" }, "id": "svc-0285b53b2eEXAMPLE", "name": "my-lattice-service", "status": "CREATE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Services in VPC Lattice nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command CreateServiceReference.

Il seguente esempio di codice mostra come utilizzarecreate-service.

AWS CLI

Per creare un servizio

L'create-serviceesempio seguente crea un servizio con il nome specificato.

aws vpc-lattice create-service \ --name my-lattice-service

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "authType": "NONE", "dnsEntry": { "domainName": "my-lattice-service-0285b53b2eEXAMPLE.1a2b3c4.vpc-lattice-svcs.us-east-2.on.aws", "hostedZoneId": "Z09127221KTH2CEXAMPLE" }, "id": "svc-0285b53b2eEXAMPLE", "name": "my-lattice-service", "status": "CREATE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Services in VPC Lattice nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command CreateServiceReference.

Il seguente esempio di codice mostra come utilizzarecreate-target-group.

AWS CLI

Esempio 1: Per creare un gruppo target di tipo INSTANCE

L'create-target-groupesempio seguente crea un gruppo target con il nome, il tipo e la configurazione specificati.

aws vpc-lattice create-target-group \ --name my-lattice-target-group-instance \ --type INSTANCE \ --config file://tg-config.json

Contenuto di tg-config.json.

{ "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "config": { "healthCheck": { "enabled": true, "healthCheckIntervalSeconds": 30, "healthCheckTimeoutSeconds": 5, "healthyThresholdCount": 5, "matcher": { "httpCode": "200" }, "path": "/", "protocol": "HTTPS", "protocolVersion": "HTTP1", "unhealthyThresholdCount": 2 }, "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }, "id": "tg-0eaa4b9ab4EXAMPLE", "name": "my-lattice-target-group-instance", "status": "CREATE_IN_PROGRESS", "type": "INSTANCE" }

Esempio 2: creare un gruppo target di tipo IP

L'create-target-groupesempio seguente crea un gruppo target con il nome, il tipo e la configurazione specificati.

aws vpc-lattice create-target-group \ --name my-lattice-target-group-ip \ --type IP \ --config file://tg-config.json

Contenuto di tg-config.json.

{ "ipAddressType": "IPV4", "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "config": { "healthCheck": { "enabled": true, "healthCheckIntervalSeconds": 30, "healthCheckTimeoutSeconds": 5, "healthyThresholdCount": 5, "matcher": { "httpCode": "200" }, "path": "/", "protocol": "HTTPS", "protocolVersion": "HTTP1", "unhealthyThresholdCount": 2 }, "ipAddressType": "IPV4", "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }, "id": "tg-0eaa4b9ab4EXAMPLE", "name": "my-lattice-target-group-ip", "status": "CREATE_IN_PROGRESS", "type": "IP" }

Esempio 3: Per creare un gruppo target di tipo LAMBDA

L'create-target-groupesempio seguente crea un gruppo target con il nome, il tipo e la configurazione specificati.

aws vpc-lattice create-target-group \ --name my-lattice-target-group-lambda \ --type LAMBDA

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "id": "tg-0eaa4b9ab4EXAMPLE", "name": "my-lattice-target-group-lambda", "status": "CREATE_IN_PROGRESS", "type": "LAMBDA" }

Esempio 4: Per creare un gruppo target di tipo ALB

L'create-target-groupesempio seguente crea un gruppo target con il nome, il tipo e la configurazione specificati.

aws vpc-lattice create-target-group \ --name my-lattice-target-group-alb \ --type ALB \ --config file://tg-config.json

Contenuto di tg-config.json.

{ "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "config": { "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }, "id": "tg-0eaa4b9ab4EXAMPLE", "name": "my-lattice-target-group-alb", "status": "CREATE_IN_PROGRESS", "type": "ALB" }

Per ulteriori informazioni, consulta Target groups nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarecreate-target-group.

AWS CLI

Esempio 1: Per creare un gruppo target di tipo INSTANCE

L'create-target-groupesempio seguente crea un gruppo target con il nome, il tipo e la configurazione specificati.

aws vpc-lattice create-target-group \ --name my-lattice-target-group-instance \ --type INSTANCE \ --config file://tg-config.json

Contenuto di tg-config.json.

{ "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "config": { "healthCheck": { "enabled": true, "healthCheckIntervalSeconds": 30, "healthCheckTimeoutSeconds": 5, "healthyThresholdCount": 5, "matcher": { "httpCode": "200" }, "path": "/", "protocol": "HTTPS", "protocolVersion": "HTTP1", "unhealthyThresholdCount": 2 }, "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }, "id": "tg-0eaa4b9ab4EXAMPLE", "name": "my-lattice-target-group-instance", "status": "CREATE_IN_PROGRESS", "type": "INSTANCE" }

Esempio 2: creare un gruppo target di tipo IP

L'create-target-groupesempio seguente crea un gruppo target con il nome, il tipo e la configurazione specificati.

aws vpc-lattice create-target-group \ --name my-lattice-target-group-ip \ --type IP \ --config file://tg-config.json

Contenuto di tg-config.json.

{ "ipAddressType": "IPV4", "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "config": { "healthCheck": { "enabled": true, "healthCheckIntervalSeconds": 30, "healthCheckTimeoutSeconds": 5, "healthyThresholdCount": 5, "matcher": { "httpCode": "200" }, "path": "/", "protocol": "HTTPS", "protocolVersion": "HTTP1", "unhealthyThresholdCount": 2 }, "ipAddressType": "IPV4", "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }, "id": "tg-0eaa4b9ab4EXAMPLE", "name": "my-lattice-target-group-ip", "status": "CREATE_IN_PROGRESS", "type": "IP" }

Esempio 3: Per creare un gruppo target di tipo LAMBDA

L'create-target-groupesempio seguente crea un gruppo target con il nome, il tipo e la configurazione specificati.

aws vpc-lattice create-target-group \ --name my-lattice-target-group-lambda \ --type LAMBDA

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "id": "tg-0eaa4b9ab4EXAMPLE", "name": "my-lattice-target-group-lambda", "status": "CREATE_IN_PROGRESS", "type": "LAMBDA" }

Esempio 4: Per creare un gruppo target di tipo ALB

L'create-target-groupesempio seguente crea un gruppo target con il nome, il tipo e la configurazione specificati.

aws vpc-lattice create-target-group \ --name my-lattice-target-group-alb \ --type ALB \ --config file://tg-config.json

Contenuto di tg-config.json.

{ "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "config": { "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }, "id": "tg-0eaa4b9ab4EXAMPLE", "name": "my-lattice-target-group-alb", "status": "CREATE_IN_PROGRESS", "type": "ALB" }

Per ulteriori informazioni, consulta Target groups nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzaredelete-auth-policy.

AWS CLI

Per eliminare una politica di autenticazione

L'delete-auth-policyesempio seguente elimina la politica di autenticazione per il servizio specificato.

aws vpc-lattice delete-auth-policy \ --resource-identifier svc-0285b53b2eEXAMPLE

Questo comando non produce alcun output.

Per ulteriori informazioni, consulta le politiche di autenticazione nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzaredelete-auth-policy.

AWS CLI

Per eliminare una politica di autenticazione

L'delete-auth-policyesempio seguente elimina la politica di autenticazione per il servizio specificato.

aws vpc-lattice delete-auth-policy \ --resource-identifier svc-0285b53b2eEXAMPLE

Questo comando non produce alcun output.

Per ulteriori informazioni, consulta le politiche di autenticazione nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzaredelete-listener.

AWS CLI

Per eliminare un ascoltatore

L'delete-listeneresempio seguente elimina il listener specificato.

aws vpc-lattice delete-listener \ --listener-identifier listener-07cc7fb0abEXAMPLE \ --service-identifier svc-0285b53b2eEXAMPLE

Questo comando non produce alcun output.

Per ulteriori informazioni, consulta Listeners nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command DeleteListenerReference.

Il seguente esempio di codice mostra come utilizzaredelete-listener.

AWS CLI

Per eliminare un ascoltatore

L'delete-listeneresempio seguente elimina il listener specificato.

aws vpc-lattice delete-listener \ --listener-identifier listener-07cc7fb0abEXAMPLE \ --service-identifier svc-0285b53b2eEXAMPLE

Questo comando non produce alcun output.

Per ulteriori informazioni, consulta Listeners nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command DeleteListenerReference.

Il seguente esempio di codice mostra come utilizzaredelete-service-network-service-association.

AWS CLI

Per eliminare un'associazione di servizi

L'delete-service-network-service-associationesempio seguente dissocia l'associazione di servizi specificata.

aws vpc-lattice delete-service-network-service-association \ --service-network-service-association-identifier snsa-031fabb4d8EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkserviceassociation/snsa-031fabb4d8EXAMPLE", "id": "snsa-031fabb4d8EXAMPLE", "status": "DELETE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Gestire le associazioni di servizi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzaredelete-service-network-service-association.

AWS CLI

Per eliminare un'associazione di servizi

L'delete-service-network-service-associationesempio seguente dissocia l'associazione di servizi specificata.

aws vpc-lattice delete-service-network-service-association \ --service-network-service-association-identifier snsa-031fabb4d8EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkserviceassociation/snsa-031fabb4d8EXAMPLE", "id": "snsa-031fabb4d8EXAMPLE", "status": "DELETE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Gestire le associazioni di servizi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzaredelete-service-network-vpc-association.

AWS CLI

Per eliminare un'VPCassociazione

L'delete-service-network-vpc-associationesempio seguente dissocia l'associazione specificataVPC.

aws vpc-lattice delete-service-network-vpc-association \ --service-network-vpc-association-identifier snva-0821fc8631EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkvpcassociation/snva-0821fc8631EXAMPLE", "id": "snva-0821fc8631EXAMPLE", "status": "DELETE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Gestire VPC le associazioni nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzaredelete-service-network-vpc-association.

AWS CLI

Per eliminare un'VPCassociazione

L'delete-service-network-vpc-associationesempio seguente dissocia l'associazione specificataVPC.

aws vpc-lattice delete-service-network-vpc-association \ --service-network-vpc-association-identifier snva-0821fc8631EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkvpcassociation/snva-0821fc8631EXAMPLE", "id": "snva-0821fc8631EXAMPLE", "status": "DELETE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Gestire VPC le associazioni nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzaredelete-service-network.

AWS CLI

Per eliminare una rete di servizi

L'delete-service-networkesempio seguente elimina la rete di servizi specificata.

aws vpc-lattice delete-service-network \ --service-network-identifier sn-080ec7dc93EXAMPLE

Questo comando non produce alcun output.

Per ulteriori informazioni, consulta Service networks nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzaredelete-service-network.

AWS CLI

Per eliminare una rete di servizi

L'delete-service-networkesempio seguente elimina la rete di servizi specificata.

aws vpc-lattice delete-service-network \ --service-network-identifier sn-080ec7dc93EXAMPLE

Questo comando non produce alcun output.

Per ulteriori informazioni, consulta Service networks nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzaredelete-service.

AWS CLI

Per eliminare un servizio

L'delete-serviceesempio seguente elimina il servizio specificato.

aws vpc-lattice delete-service \ --service-identifier svc-0285b53b2eEXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-west-2:123456789012:service/svc-0285b53b2eEXAMPLE", "id": "svc-0285b53b2eEXAMPLE", "name": "my-lattice-service", "status": "DELETE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Services in VPC Lattice nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command DeleteServiceReference.

Il seguente esempio di codice mostra come utilizzaredelete-service.

AWS CLI

Per eliminare un servizio

L'delete-serviceesempio seguente elimina il servizio specificato.

aws vpc-lattice delete-service \ --service-identifier svc-0285b53b2eEXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-west-2:123456789012:service/svc-0285b53b2eEXAMPLE", "id": "svc-0285b53b2eEXAMPLE", "name": "my-lattice-service", "status": "DELETE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Services in VPC Lattice nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command DeleteServiceReference.

Il seguente esempio di codice mostra come utilizzaredelete-target-group.

AWS CLI

Per eliminare un gruppo target

L'delete-target-groupesempio seguente elimina il gruppo target specificato.

aws vpc-lattice delete-target-group \ --target-group-identifier tg-0eaa4b9ab4EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "id": "tg-0eaa4b9ab4EXAMPLE", "status": "DELETE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Target groups nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzaredelete-target-group.

AWS CLI

Per eliminare un gruppo target

L'delete-target-groupesempio seguente elimina il gruppo target specificato.

aws vpc-lattice delete-target-group \ --target-group-identifier tg-0eaa4b9ab4EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "id": "tg-0eaa4b9ab4EXAMPLE", "status": "DELETE_IN_PROGRESS" }

Per ulteriori informazioni, consulta Target groups nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarederegister-targets.

AWS CLI

Annullare la registrazione di un bersaglio

L'deregister-targetsesempio seguente annulla la registrazione della destinazione specificata dal gruppo di destinazione specificato.

aws vpc-lattice deregister-targets \ --targets i-07dd579bc5EXAMPLE \ --target-group-identifier tg-0eaa4b9ab4EXAMPLE

Output:

{ "successful": [ { "id": "i-07dd579bc5EXAMPLE", "port": 443 } ], "unsuccessful": [] }

Per ulteriori informazioni, consulta Registrare gli obiettivi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarederegister-targets.

AWS CLI

Annullare la registrazione di un bersaglio

L'deregister-targetsesempio seguente annulla la registrazione della destinazione specificata dal gruppo di destinazione specificato.

aws vpc-lattice deregister-targets \ --targets i-07dd579bc5EXAMPLE \ --target-group-identifier tg-0eaa4b9ab4EXAMPLE

Output:

{ "successful": [ { "id": "i-07dd579bc5EXAMPLE", "port": 443 } ], "unsuccessful": [] }

Per ulteriori informazioni, consulta Registrare gli obiettivi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzareget-auth-policy.

AWS CLI

Per ottenere informazioni su una politica di autenticazione

L'get-auth-policyesempio seguente ottiene informazioni sulla politica di autenticazione per il servizio specificato.

aws vpc-lattice get-auth-policy \ --resource-identifier svc-0285b53b2eEXAMPLE

Output:

{ "createdAt": "2023-06-07T03:51:20.266Z", "lastUpdatedAt": "2023-06-07T04:39:27.082Z", "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::123456789012:role/my-clients\"},\"Action\":\"vpc-lattice-svcs:Invoke\",\"Resource\":\"arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE\"}]}", "state": "Active" }

Per ulteriori informazioni, consulta le politiche di autenticazione nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command GetAuthPolicyReference.

Il seguente esempio di codice mostra come utilizzareget-auth-policy.

AWS CLI

Per ottenere informazioni su una politica di autenticazione

L'get-auth-policyesempio seguente ottiene informazioni sulla politica di autenticazione per il servizio specificato.

aws vpc-lattice get-auth-policy \ --resource-identifier svc-0285b53b2eEXAMPLE

Output:

{ "createdAt": "2023-06-07T03:51:20.266Z", "lastUpdatedAt": "2023-06-07T04:39:27.082Z", "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::123456789012:role/my-clients\"},\"Action\":\"vpc-lattice-svcs:Invoke\",\"Resource\":\"arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE\"}]}", "state": "Active" }

Per ulteriori informazioni, consulta le politiche di autenticazione nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command GetAuthPolicyReference.

Il seguente esempio di codice mostra come utilizzareget-listener.

AWS CLI

Per ottenere informazioni su un service listener

L'get-listeneresempio seguente ottiene informazioni sul listener specificato per il servizio specificato.

aws vpc-lattice get-listener \ --listener-identifier listener-0ccf55918cEXAMPLE \ --service-identifier svc-0285b53b2eEXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE/listener/listener-0ccf55918cEXAMPLE", "createdAt": "2023-05-07T05:08:45.192Z", "defaultAction": { "forward": { "targetGroups": [ { "targetGroupIdentifier": "tg-0ff213abb6EXAMPLE", "weight": 1 } ] } }, "id": "listener-0ccf55918cEXAMPLE", "lastUpdatedAt": "2023-05-07T05:08:45.192Z", "name": "http-80", "port": 80, "protocol": "HTTP", "serviceArn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "serviceId": "svc-0285b53b2eEXAMPLE" }

Per ulteriori informazioni, consulta Define routing nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command GetListenerReference.

Il seguente esempio di codice mostra come utilizzareget-listener.

AWS CLI

Per ottenere informazioni su un service listener

L'get-listeneresempio seguente ottiene informazioni sul listener specificato per il servizio specificato.

aws vpc-lattice get-listener \ --listener-identifier listener-0ccf55918cEXAMPLE \ --service-identifier svc-0285b53b2eEXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE/listener/listener-0ccf55918cEXAMPLE", "createdAt": "2023-05-07T05:08:45.192Z", "defaultAction": { "forward": { "targetGroups": [ { "targetGroupIdentifier": "tg-0ff213abb6EXAMPLE", "weight": 1 } ] } }, "id": "listener-0ccf55918cEXAMPLE", "lastUpdatedAt": "2023-05-07T05:08:45.192Z", "name": "http-80", "port": 80, "protocol": "HTTP", "serviceArn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "serviceId": "svc-0285b53b2eEXAMPLE" }

Per ulteriori informazioni, consulta Define routing nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command GetListenerReference.

Il seguente esempio di codice mostra come utilizzareget-service-network-service-association.

AWS CLI

Per ottenere informazioni su un'associazione di servizi

L'get-service-network-service-associationesempio seguente ottiene informazioni sull'associazione di servizi specificata.

aws vpc-lattice get-service-network-service-association \ --service-network-service-association-identifier snsa-031fabb4d8EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkserviceassociation/snsa-031fabb4d8EXAMPLE", "createdAt": "2023-05-05T21:48:16.076Z", "createdBy": "123456789012", "dnsEntry": { "domainName": "my-lattice-service-0285b53b2eEXAMPLE.7d67968.vpc-lattice-svcs.us-east-2.on.aws", "hostedZoneId": "Z09127221KTH2CEXAMPLE" }, "id": "snsa-031fabb4d8EXAMPLE", "serviceArn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "serviceId": "svc-0285b53b2eEXAMPLE", "serviceName": "my-lattice-service", "serviceNetworkArn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "serviceNetworkId": "sn-080ec7dc93EXAMPLE", "serviceNetworkName": "my-service-network", "status": "ACTIVE" }

Per ulteriori informazioni, consulta Gestire le associazioni di servizi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzareget-service-network-service-association.

AWS CLI

Per ottenere informazioni su un'associazione di servizi

L'get-service-network-service-associationesempio seguente ottiene informazioni sull'associazione di servizi specificata.

aws vpc-lattice get-service-network-service-association \ --service-network-service-association-identifier snsa-031fabb4d8EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkserviceassociation/snsa-031fabb4d8EXAMPLE", "createdAt": "2023-05-05T21:48:16.076Z", "createdBy": "123456789012", "dnsEntry": { "domainName": "my-lattice-service-0285b53b2eEXAMPLE.7d67968.vpc-lattice-svcs.us-east-2.on.aws", "hostedZoneId": "Z09127221KTH2CEXAMPLE" }, "id": "snsa-031fabb4d8EXAMPLE", "serviceArn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "serviceId": "svc-0285b53b2eEXAMPLE", "serviceName": "my-lattice-service", "serviceNetworkArn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "serviceNetworkId": "sn-080ec7dc93EXAMPLE", "serviceNetworkName": "my-service-network", "status": "ACTIVE" }

Per ulteriori informazioni, consulta Gestire le associazioni di servizi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzareget-service-network-vpc-association.

AWS CLI

Per ottenere informazioni su un'VPCassociazione

L'get-service-network-vpc-associationesempio seguente ottiene informazioni sull'VPCassociazione specificata.

aws vpc-lattice get-service-network-vpc-association \ --service-network-vpc-association-identifier snva-0821fc8631EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkvpcassociation/snva-0821fc8631EXAMPLE", "createdAt": "2023-06-06T23:41:08.421Z", "createdBy": "123456789012", "id": "snva-0c5dcb60d6EXAMPLE", "lastUpdatedAt": "2023-06-06T23:41:08.421Z", "securityGroupIds": [ "sg-0aee16bc6cEXAMPLE" ], "serviceNetworkArn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "serviceNetworkId": "sn-080ec7dc93EXAMPLE", "serviceNetworkName": "my-service-network", "status": "ACTIVE", "vpcId": "vpc-0a1b2c3d4eEXAMPLE" }

Per ulteriori informazioni, consulta Gestire VPC le associazioni nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzareget-service-network-vpc-association.

AWS CLI

Per ottenere informazioni su un'VPCassociazione

L'get-service-network-vpc-associationesempio seguente ottiene informazioni sull'VPCassociazione specificata.

aws vpc-lattice get-service-network-vpc-association \ --service-network-vpc-association-identifier snva-0821fc8631EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetworkvpcassociation/snva-0821fc8631EXAMPLE", "createdAt": "2023-06-06T23:41:08.421Z", "createdBy": "123456789012", "id": "snva-0c5dcb60d6EXAMPLE", "lastUpdatedAt": "2023-06-06T23:41:08.421Z", "securityGroupIds": [ "sg-0aee16bc6cEXAMPLE" ], "serviceNetworkArn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "serviceNetworkId": "sn-080ec7dc93EXAMPLE", "serviceNetworkName": "my-service-network", "status": "ACTIVE", "vpcId": "vpc-0a1b2c3d4eEXAMPLE" }

Per ulteriori informazioni, consulta Gestire VPC le associazioni nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzareget-service-network.

AWS CLI

Per ottenere informazioni su una rete di servizi

L'get-service-networkesempio seguente ottiene informazioni sulla rete di servizi specificata.

aws vpc-lattice get-service-network \ --service-network-identifier sn-080ec7dc93EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "authType": "AWS_IAM", "createdAt": "2023-05-05T15:26:08.417Z", "id": "sn-080ec7dc93EXAMPLE", "lastUpdatedAt": "2023-05-05T15:26:08.417Z", "name": "my-service-network", "numberOfAssociatedServices": 2, "numberOfAssociatedVPCs": 3 }

Per ulteriori informazioni, consulta Service networks nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzareget-service-network.

AWS CLI

Per ottenere informazioni su una rete di servizi

L'get-service-networkesempio seguente ottiene informazioni sulla rete di servizi specificata.

aws vpc-lattice get-service-network \ --service-network-identifier sn-080ec7dc93EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "authType": "AWS_IAM", "createdAt": "2023-05-05T15:26:08.417Z", "id": "sn-080ec7dc93EXAMPLE", "lastUpdatedAt": "2023-05-05T15:26:08.417Z", "name": "my-service-network", "numberOfAssociatedServices": 2, "numberOfAssociatedVPCs": 3 }

Per ulteriori informazioni, consulta Service networks nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzareget-service.

AWS CLI

Per ottenere informazioni su un servizio

L'get-serviceesempio seguente ottiene informazioni sul servizio specificato.

aws vpc-lattice get-service \ --service-identifier svc-0285b53b2eEXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "authType": "AWS_IAM", "createdAt": "2023-05-05T21:35:29.339Z", "dnsEntry": { "domainName": "my-lattice-service-0285b53b2eEXAMPLE.7d67968.vpc-lattice-svcs.us-east-2.on.aws", "hostedZoneId": "Z09127221KTH2CFUOHIZH" }, "id": "svc-0285b53b2eEXAMPLE", "lastUpdatedAt": "2023-05-05T21:35:29.339Z", "name": "my-lattice-service", "status": "ACTIVE" }

Per ulteriori informazioni, consulta la sezione Servizi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzareget-service.

AWS CLI

Per ottenere informazioni su un servizio

L'get-serviceesempio seguente ottiene informazioni sul servizio specificato.

aws vpc-lattice get-service \ --service-identifier svc-0285b53b2eEXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "authType": "AWS_IAM", "createdAt": "2023-05-05T21:35:29.339Z", "dnsEntry": { "domainName": "my-lattice-service-0285b53b2eEXAMPLE.7d67968.vpc-lattice-svcs.us-east-2.on.aws", "hostedZoneId": "Z09127221KTH2CFUOHIZH" }, "id": "svc-0285b53b2eEXAMPLE", "lastUpdatedAt": "2023-05-05T21:35:29.339Z", "name": "my-lattice-service", "status": "ACTIVE" }

Per ulteriori informazioni, consulta la sezione Servizi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzareget-target-group.

AWS CLI

Per ottenere informazioni su un gruppo target

L'get-target-groupesempio seguente ottiene informazioni sul gruppo target specificato, che ha un tipo di destinazione diINSTANCE.

aws vpc-lattice get-target-group \ --target-group-identifier tg-0eaa4b9ab4EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "config": { "healthCheck": { "enabled": true, "healthCheckIntervalSeconds": 30, "healthCheckTimeoutSeconds": 5, "healthyThresholdCount": 5, "matcher": { "httpCode": "200" }, "path": "/", "protocol": "HTTPS", "protocolVersion": "HTTP1", "unhealthyThresholdCount": 2 }, "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }, "createdAt": "2023-05-06T04:41:04.122Z", "id": "tg-0eaa4b9ab4EXAMPLE", "lastUpdatedAt": "2023-05-06T04:41:04.122Z", "name": "my-target-group", "serviceArns": [ "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE" ], "status": "ACTIVE", "type": "INSTANCE" }

Per ulteriori informazioni, consulta Target groups nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzareget-target-group.

AWS CLI

Per ottenere informazioni su un gruppo target

L'get-target-groupesempio seguente ottiene informazioni sul gruppo target specificato, che ha un tipo di destinazione diINSTANCE.

aws vpc-lattice get-target-group \ --target-group-identifier tg-0eaa4b9ab4EXAMPLE

Output:

{ "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-0eaa4b9ab4EXAMPLE", "config": { "healthCheck": { "enabled": true, "healthCheckIntervalSeconds": 30, "healthCheckTimeoutSeconds": 5, "healthyThresholdCount": 5, "matcher": { "httpCode": "200" }, "path": "/", "protocol": "HTTPS", "protocolVersion": "HTTP1", "unhealthyThresholdCount": 2 }, "port": 443, "protocol": "HTTPS", "protocolVersion": "HTTP1", "vpcIdentifier": "vpc-f1663d9868EXAMPLE" }, "createdAt": "2023-05-06T04:41:04.122Z", "id": "tg-0eaa4b9ab4EXAMPLE", "lastUpdatedAt": "2023-05-06T04:41:04.122Z", "name": "my-target-group", "serviceArns": [ "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE" ], "status": "ACTIVE", "type": "INSTANCE" }

Per ulteriori informazioni, consulta Target groups nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarelist-listeners.

AWS CLI

Per elencare gli ascoltatori del servizio

L'list-listenersesempio seguente elenca i listener per il servizio specificato.

aws vpc-lattice list-listeners \ --service-identifier svc-0285b53b2eEXAMPLE

Output:

{ "items": [ { "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE/listener/listener-0ccf55918cEXAMPLE", "createdAt": "2023-05-07T05:08:45.192Z", "id": "listener-0ccf55918cEXAMPLE", "lastUpdatedAt": "2023-05-07T05:08:45.192Z", "name": "http-80", "port": 80, "protocol": "HTTP" } ] }

Per ulteriori informazioni, consulta Define routing nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command ListListenersReference.

Il seguente esempio di codice mostra come utilizzarelist-listeners.

AWS CLI

Per elencare gli ascoltatori del servizio

L'list-listenersesempio seguente elenca i listener per il servizio specificato.

aws vpc-lattice list-listeners \ --service-identifier svc-0285b53b2eEXAMPLE

Output:

{ "items": [ { "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE/listener/listener-0ccf55918cEXAMPLE", "createdAt": "2023-05-07T05:08:45.192Z", "id": "listener-0ccf55918cEXAMPLE", "lastUpdatedAt": "2023-05-07T05:08:45.192Z", "name": "http-80", "port": 80, "protocol": "HTTP" } ] }

Per ulteriori informazioni, consulta Define routing nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command ListListenersReference.

Il seguente esempio di codice mostra come utilizzarelist-service-network-service-associations.

AWS CLI

Per elencare le associazioni di servizi

L'list-service-network-service-associationsesempio seguente elenca le associazioni di servizi per la rete di servizi specificata. L'--queryopzione indirizza l'output alle associazioni IDs di servizi.

aws vpc-lattice list-service-network-service-associations \ --service-network-identifier sn-080ec7dc93EXAMPLE \ --query items[*].id

Output:

[ "snsa-031fabb4d8EXAMPLE", "snsa-0e16955a8cEXAMPLE" ]

Per ulteriori informazioni, consulta Gestire le associazioni di servizi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarelist-service-network-service-associations.

AWS CLI

Per elencare le associazioni di servizi

L'list-service-network-service-associationsesempio seguente elenca le associazioni di servizi per la rete di servizi specificata. L'--queryopzione indirizza l'output alle associazioni IDs di servizi.

aws vpc-lattice list-service-network-service-associations \ --service-network-identifier sn-080ec7dc93EXAMPLE \ --query items[*].id

Output:

[ "snsa-031fabb4d8EXAMPLE", "snsa-0e16955a8cEXAMPLE" ]

Per ulteriori informazioni, consulta Gestire le associazioni di servizi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarelist-service-network-vpc-associations.

AWS CLI

Per elencare VPC le associazioni

L'list-service-network-vpc-associationsesempio seguente elenca le VPC associazioni per la rete di servizi specificata. L'--queryopzione indirizza l'output IDs alle VPC associazioni.

aws vpc-lattice list-service-network-vpc-associations \ --service-network-identifier sn-080ec7dc93EXAMPLE \ --query items[*].id

Output:

[ "snva-0821fc8631EXAMPLE", "snva-0c5dcb60d6EXAMPLE" ]

Per ulteriori informazioni, consulta Gestire VPC le associazioni nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarelist-service-network-vpc-associations.

AWS CLI

Per elencare VPC le associazioni

L'list-service-network-vpc-associationsesempio seguente elenca le VPC associazioni per la rete di servizi specificata. L'--queryopzione indirizza l'output IDs alle VPC associazioni.

aws vpc-lattice list-service-network-vpc-associations \ --service-network-identifier sn-080ec7dc93EXAMPLE \ --query items[*].id

Output:

[ "snva-0821fc8631EXAMPLE", "snva-0c5dcb60d6EXAMPLE" ]

Per ulteriori informazioni, consulta Gestire VPC le associazioni nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarelist-service-networks.

AWS CLI

Per elencare le reti di servizio

L'list-service-networksesempio seguente elenca le reti di servizio possedute o condivise con l'account chiamante. L'--queryopzione assegna i risultati agli Amazon Resource Names (ARN) delle reti di servizi.

aws vpc-lattice list-service-networks \ --query items[*].arn

Output:

[ "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "arn:aws:vpc-lattice:us-east-2:111122223333:servicenetwork/sn-0ec4d436cfEXAMPLE" ]

Per ulteriori informazioni, consulta Service networks nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarelist-service-networks.

AWS CLI

Per elencare le reti di servizio

L'list-service-networksesempio seguente elenca le reti di servizio possedute o condivise con l'account chiamante. L'--queryopzione assegna i risultati agli Amazon Resource Names (ARN) delle reti di servizi.

aws vpc-lattice list-service-networks \ --query items[*].arn

Output:

[ "arn:aws:vpc-lattice:us-east-2:123456789012:servicenetwork/sn-080ec7dc93EXAMPLE", "arn:aws:vpc-lattice:us-east-2:111122223333:servicenetwork/sn-0ec4d436cfEXAMPLE" ]

Per ulteriori informazioni, consulta Service networks nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarelist-services.

AWS CLI

Per elencare i tuoi servizi

L'list-servicesesempio seguente elenca i servizi posseduti o condivisi con l'account chiamante. L'--queryopzione assegna i risultati agli Amazon Resource Names (ARN) dei servizi.

aws vpc-lattice list-services \ --query items[*].arn

Output:

[ "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "arn:aws:vpc-lattice:us-east-2:111122223333:service/svc-0b8ac96550EXAMPLE" ]

Per ulteriori informazioni, consulta la sezione Servizi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarelist-services.

AWS CLI

Per elencare i tuoi servizi

L'list-servicesesempio seguente elenca i servizi posseduti o condivisi con l'account chiamante. L'--queryopzione assegna i risultati agli Amazon Resource Names (ARN) dei servizi.

aws vpc-lattice list-services \ --query items[*].arn

Output:

[ "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE", "arn:aws:vpc-lattice:us-east-2:111122223333:service/svc-0b8ac96550EXAMPLE" ]

Per ulteriori informazioni, consulta la sezione Servizi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarelist-target-groups.

AWS CLI

Per elencare i tuoi gruppi target

L'list-target-groupsesempio seguente elenca i gruppi target con un tipo di oggetto diLAMBDA.

aws vpc-lattice list-target-groups \ --target-group-type LAMBDA

Output:

{ "items": [ { "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-045c1b7d9dEXAMPLE", "createdAt": "2023-05-06T05:22:16.637Z", "id": "tg-045c1b7d9dEXAMPLE", "lastUpdatedAt": "2023-05-06T05:22:16.637Z", "name": "my-target-group-lam", "serviceArns": [ "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE" ], "status": "ACTIVE", "type": "LAMBDA" } ] }

Per ulteriori informazioni, consulta Target groups nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarelist-target-groups.

AWS CLI

Per elencare i tuoi gruppi target

L'list-target-groupsesempio seguente elenca i gruppi target con un tipo di oggetto diLAMBDA.

aws vpc-lattice list-target-groups \ --target-group-type LAMBDA

Output:

{ "items": [ { "arn": "arn:aws:vpc-lattice:us-east-2:123456789012:targetgroup/tg-045c1b7d9dEXAMPLE", "createdAt": "2023-05-06T05:22:16.637Z", "id": "tg-045c1b7d9dEXAMPLE", "lastUpdatedAt": "2023-05-06T05:22:16.637Z", "name": "my-target-group-lam", "serviceArns": [ "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE" ], "status": "ACTIVE", "type": "LAMBDA" } ] }

Per ulteriori informazioni, consulta Target groups nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarelist-targets.

AWS CLI

Per elencare gli obiettivi di un gruppo target

L'list-targetsesempio seguente elenca le destinazioni per il gruppo target specificato.

aws vpc-lattice list-targets \ --target-group-identifier tg-0eaa4b9ab4EXAMPLE

Output:

{ "items": [ { "id": "i-07dd579bc5EXAMPLE", "port": 443, "status": "HEALTHY" }, { "id": "i-047b3c9078EXAMPLE", "port": 443, "reasonCode": "HealthCheckFailed", "status": "UNHEALTHY" } ] }

Per ulteriori informazioni, consulta Target groups nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzarelist-targets.

AWS CLI

Per elencare gli obiettivi di un gruppo target

L'list-targetsesempio seguente elenca le destinazioni per il gruppo target specificato.

aws vpc-lattice list-targets \ --target-group-identifier tg-0eaa4b9ab4EXAMPLE

Output:

{ "items": [ { "id": "i-07dd579bc5EXAMPLE", "port": 443, "status": "HEALTHY" }, { "id": "i-047b3c9078EXAMPLE", "port": 443, "reasonCode": "HealthCheckFailed", "status": "UNHEALTHY" } ] }

Per ulteriori informazioni, consulta Target groups nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzareput-auth-policy.

AWS CLI

Per creare una politica di autenticazione per un servizio

L'put-auth-policyesempio seguente concede l'accesso alle richieste di qualsiasi principale autenticato che utilizza il ruolo specificato. IAM La risorsa è quella ARN del servizio a cui è allegata la policy.

aws vpc-lattice put-auth-policy \ --resource-identifier svc-0285b53b2eEXAMPLE \ --policy file://auth-policy.json

Contenuto di auth-policy.json.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::123456789012:role/my-clients" }, "Action": "vpc-lattice-svcs:Invoke", "Resource": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE" } ] }

Output:

{ "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::123456789012:role/my-clients\"},\"Action\":\"vpc-lattice-svcs:Invoke\",\"Resource\":\"arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE\"}]}", "state": "Active" }

Per ulteriori informazioni, consulta le politiche di autenticazione nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command PutAuthPolicyReference.

Il seguente esempio di codice mostra come utilizzareput-auth-policy.

AWS CLI

Per creare una politica di autenticazione per un servizio

L'put-auth-policyesempio seguente concede l'accesso alle richieste di qualsiasi principale autenticato che utilizza il ruolo specificato. IAM La risorsa è quella ARN del servizio a cui è allegata la policy.

aws vpc-lattice put-auth-policy \ --resource-identifier svc-0285b53b2eEXAMPLE \ --policy file://auth-policy.json

Contenuto di auth-policy.json.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::123456789012:role/my-clients" }, "Action": "vpc-lattice-svcs:Invoke", "Resource": "arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE" } ] }

Output:

{ "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"AWS\":\"arn:aws:iam::123456789012:role/my-clients\"},\"Action\":\"vpc-lattice-svcs:Invoke\",\"Resource\":\"arn:aws:vpc-lattice:us-east-2:123456789012:service/svc-0285b53b2eEXAMPLE\"}]}", "state": "Active" }

Per ulteriori informazioni, consulta le politiche di autenticazione nella Amazon VPC Lattice User Guide.

  • Per API i dettagli, consulta AWS CLI Command PutAuthPolicyReference.

Il seguente esempio di codice mostra come utilizzareregister-targets.

AWS CLI

Per registrare un bersaglio

L'register-targetsesempio seguente registra le destinazioni specificate con il gruppo di destinazione specificato.

aws vpc-lattice register-targets \ --targets id=i-047b3c9078EXAMPLE id=i-07dd579bc5EXAMPLE \ --target-group-identifier tg-0eaa4b9ab4EXAMPLE

Output:

{ "successful": [ { "id": "i-07dd579bc5EXAMPLE", "port": 443 } ], "unsuccessful": [ { "failureCode": "UnsupportedTarget", "failureMessage": "Instance targets must be in the same VPC as their target group", "id": "i-047b3c9078EXAMPLE", "port": 443 } ] }

Per ulteriori informazioni, consulta Registrare gli obiettivi nella Amazon VPC Lattice User Guide.

Il seguente esempio di codice mostra come utilizzareregister-targets.

AWS CLI

Per registrare un bersaglio

L'register-targetsesempio seguente registra le destinazioni specificate con il gruppo di destinazione specificato.

aws vpc-lattice register-targets \ --targets id=i-047b3c9078EXAMPLE id=i-07dd579bc5EXAMPLE \ --target-group-identifier tg-0eaa4b9ab4EXAMPLE

Output:

{ "successful": [ { "id": "i-07dd579bc5EXAMPLE", "port": 443 } ], "unsuccessful": [ { "failureCode": "UnsupportedTarget", "failureMessage": "Instance targets must be in the same VPC as their target group", "id": "i-047b3c9078EXAMPLE", "port": 443 } ] }

Per ulteriori informazioni, consulta Registrare gli obiettivi nella Amazon VPC Lattice User Guide.

In questa pagina

PrivacyCondizioni del sitoPreferenze cookie
© 2025, Amazon Web Services, Inc. o società affiliate. Tutti i diritti riservati.