Esempi per i profili Route 53 con AWS CLI
Gli esempi di codice seguenti mostrano come eseguire azioni e implementare scenari comuni utilizzando AWS Command Line Interface con i profili Route 53.
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-profile.
- AWS CLI
-
Come associare un profilo
L’esempio
associate-profileseguente associa un profilo a un VPC.aws route53profiles associate-profile \ --nametest-association\ --profile-idrp-4987774726example\ --resource-idvpc-0af3b96b3exampleOutput:
{ "ProfileAssociation": { "CreationTime": 1710851336.527, "Id": "rpassoc-489ce212fexample", "ModificationTime": 1710851336.527, "Name": "test-association", "OwnerId": "123456789012", "ProfileId": "rp-4987774726example", "ResourceId": "vpc-0af3b96b3example", "Status": "CREATING", "StatusMessage": "Creating Profile Association" } }Per ulteriori informazioni, consulta Utilizzo dei profili nella Guida per sviluppatori di Amazon Route 53.
-
Per informazioni dettagliate sull’API, consulta AssociateProfile
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare associate-resource-to-profile.
- AWS CLI
-
Come associare una risorsa a un profilo
L’esempio
associate-resource-to-profileseguente associa un gruppo di regole DNS Firewall con priorità 102 a un profilo.aws route53profiles associate-resource-to-profile \ --nametest-resource-association\ --profile-idrp-4987774726example\ --resource-arnarn:aws:route53resolver:us-east-1:123456789012:firewall-rule-group/rslvr-frg-cfe7f72example\ --resource-properties "{\"priority\": 102}"Output:
{ "ProfileResourceAssociation": { "CreationTime": 1710851216.613, "Id": "rpr-001913120a7example", "ModificationTime": 1710851216.613, "Name": "test-resource-association", "OwnerId": "123456789012", "ProfileId": "rp-4987774726example", "ResourceArn": "arn:aws:route53resolver:us-east-1:123456789012:firewall-rule-group/rslvr-frg-cfe7f72example", "ResourceProperties": "{\"priority\":102}", "ResourceType": "FIREWALL_RULE_GROUP", "Status": "UPDATING", "StatusMessage": "Updating the Profile to DNS Firewall rule group association" } }-
Per informazioni dettagliate sull’API, consulta AssociateResourceToProfile
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare create-profile.
- AWS CLI
-
Come creare un profilo
Nell’esempio seguente
create-profilecrea un profilo.aws route53profiles create-profile \ --nametestOutput:
{ "Profile": { "Arn": "arn:aws:route53profiles:us-east-1:123456789012:profile/rp-6ffe47d5example", "ClientToken": "2ca1a304-32b3-4f5f-bc4c-EXAMPLE11111", "CreationTime": 1710850903.578, "Id": "rp-6ffe47d5example", "ModificationTime": 1710850903.578, "Name": "test", "OwnerId": "123456789012", "ShareStatus": "NOT_SHARED", "Status": "COMPLETE", "StatusMessage": "Created Profile" } }-
Per informazioni dettagliate sull’API, consulta CreateProfile
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare delete-profile.
- AWS CLI
-
Come eliminare un profilo
Nell’esempio seguente
delete-profileelimina un profilo.aws route53profiles delete-profile \ --profile-idrp-6ffe47d5exampleOutput:
{ "Profile": { "Arn": "arn:aws:route53profiles:us-east-1:123456789012:profile/rp-6ffe47d5example", "ClientToken": "0a15fec0-05d9-4f78-bec0-EXAMPLE11111", "CreationTime": 1710850903.578, "Id": "rp-6ffe47d5example", "ModificationTime": 1710850903.578, "Name": "test", "OwnerId": "123456789012", "ShareStatus": "NOT_SHARED", "Status": "DELETED", "StatusMessage": "Deleted Profile" } }-
Per informazioni dettagliate sull’API, consulta DeleteProfile
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare disassociate-profile.
- AWS CLI
-
Come dissociare un profilo
Nell’esempio seguente
disassociate-profiledissocia un profilo da un VPC.aws route53profiles disassociate-profile \ --profile-idrp-4987774726example\ --resource-idvpc-0af3b96b3exampleOutput:
{ "ProfileAssociation": { "CreationTime": 1710851336.527, "Id": "rpassoc-489ce212fexample", "ModificationTime": 1710851401.362, "Name": "test-association", "OwnerId": "123456789012", "ProfileId": "rp-4987774726example", "ResourceId": "vpc-0af3b96b3example", "Status": "DELETING", "StatusMessage": "Deleting Profile Association" } }-
Per informazioni dettagliate sull’API, consulta DisassociateProfile
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare disassociate-resource-from-profile.
- AWS CLI
-
Come dissociare una risorsa da un profilo
Nell’esempio seguente
disassociate-resource-from-profiledissocia un gruppo di regole DNS Firewall da un profilo.aws route53profiles disassociate-resource-from-profile \ --profile-idrp-4987774726example\ --resource-arnarn:aws:route53resolver:us-east-1:123456789012:firewall-rule-group/rslvr-frg-cfe7f72exampleOutput:
{ "ProfileResourceAssociation": { "CreationTime": 1710851216.613, "Id": "rpr-001913120a7example", "ModificationTime": 1710852624.36, "Name": "test-resource-association", "OwnerId": "123456789012", "ProfileId": "rp-4987774726example", "ResourceArn": "arn:aws:route53resolver:us-east-1:123456789012:firewall-rule-group/rslvr-frg-cfe7f72example", "ResourceProperties": "{\"priority\":105}", "ResourceType": "FIREWALL_RULE_GROUP", "Status": "DELETING", "StatusMessage": "Deleting the Profile to DNS Firewall rule group association" } }-
Per informazioni dettagliate sull’API, consulta DisassociateResourceFromProfile
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-profile-association.
- AWS CLI
-
Come ottenere informazioni su un’associazione di profilo
Il comando seguente
get-profile-associationrestituisce informazioni sull’associazione del profilo specificata.aws route53profiles get-profile-association \ --profile-association-idrpassoc-489ce212fexampleOutput:
{ "ProfileAssociation": { "CreationTime": 1709338817.148, "Id": "rrpassoc-489ce212fexample", "ModificationTime": 1709338974.772, "Name": "test-association", "OwnerId": "123456789012", "ProfileId": "rp-4987774726example", "ResourceId": "vpc-0af3b96b3example", "Status": "COMPLETE", "StatusMessage": "Created Profile Association" } }-
Per informazioni dettagliate sull’API, consulta GetProfileAssociation
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-profile-resource-association.
- AWS CLI
-
Come ottenere informazioni su una risorsa associata a un profilo
Il comando seguente
get-profile-resource-associationrestituisce informazioni sull’associazione della risorsa specificata a un profilo.aws route53profiles get-profile-resource-association \ --profile-resource-association-idrpr-001913120a7exampleOutput:
{ "ProfileResourceAssociation": { "CreationTime": 1710851216.613, "Id": "rpr-001913120a7example", "ModificationTime": 1710852303.798, "Name": "test-resource-association", "OwnerId": "123456789012", "ProfileId": "rp-4987774726example", "ResourceArn": "arn:aws:route53resolver:us-east-1:123456789012:firewall-rule-group/rslvr-frg-cfe7f72example", "ResourceProperties": "{\"priority\":105}", "ResourceType": "FIREWALL_RULE_GROUP", "Status": "COMPLETE", "StatusMessage": "Completed creation of Profile to DNS Firewall rule group association" } }-
Per informazioni dettagliate sull’API, consulta GetProfileResourceAssociation
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare get-profile.
- AWS CLI
-
Come ottenere informazioni su un profilo
Il comando seguente
get-profilerestituisce informazioni sul profilo specificato.aws route53profiles get-profile \ --profile-idrp-4987774726exampleOutput:
{ "Profile": { "Arn": "arn:aws:route53profiles:us-east-1:123456789012:profile/rp-4987774726example", "ClientToken": "0cbc5ae7-4921-4204-bea9-EXAMPLE11111", "CreationTime": 1710851044.288, "Id": "rp-4987774726example", "ModificationTime": 1710851044.288, "Name": "test", "OwnerId": "123456789012", "ShareStatus": "NOT_SHARED", "Status": "COMPLETE", "StatusMessage": "Created Profile" } }-
Per informazioni dettagliate sull’API, consulta GetProfile
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-profile-associations.
- AWS CLI
-
Come elencare le associazioni dei profili
Il comando seguente
list-profile-associationselenca le associazioni di profili presenti nel tuo account AWS.aws route53profiles list-profile-associationsOutput:
{ "ProfileAssociations": [ { "CreationTime": 1709338817.148, "Id": "rpassoc-489ce212fexample", "ModificationTime": 1709338974.772, "Name": "test-association", "OwnerId": "123456789012", "ProfileId": "rp-4987774726example", "ResourceId": "vpc-0af3b96b3example", "Status": "COMPLETE", "StatusMessage": "Created Profile Association" } ] }-
Per informazioni dettagliate sull’API, consulta ListProfileAssociations
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-profile-resource-associations.
- AWS CLI
-
Come elencare le associazioni di risorse del profilo
Il comando seguente
list-profile-resource-associationselenca le associazioni di risorse del profilo per il profilo specificato.aws route53profiles list-profile-resource-associations \ --profile-idrp-4987774726exampleOutput:
{ "ProfileResourceAssociations": [ { "CreationTime": 1710851216.613, "Id": "rpr-001913120a7example", "ModificationTime": 1710851216.613, "Name": "test-resource-association", "OwnerId": "123456789012", "ProfileId": "rp-4987774726example", "ResourceArn": "arn:aws:route53resolver:us-east-1:123456789012:firewall-rule-group/rslvr-frg-cfe7f72example", "ResourceProperties": "{\"priority\":102}", "ResourceType": "FIREWALL_RULE_GROUP", "Status": "COMPLETE", "StatusMessage": "Completed creation of Profile to DNS Firewall rule group association" } ] }-
Per informazioni dettagliate sull’API, consulta ListProfileResourceAssociations
in AWS CLI Command Reference.
-
L’esempio di codice seguente mostra come utilizzare list-profiles.
- AWS CLI
-
Come elencare i profili
Il comando seguente
list-profileselenca i profili presenti nell’account AWS e visualizza informazioni aggiuntive su di essi.aws route53profiles list-profilesOutput:
{ "ProfileSummaries": [ { "Arn": "arn:aws:route53profiles:us-east-1:123456789012:profile/rp-4987774726example", "Id": "rp-4987774726example", "Name": "test", "ShareStatus": "NOT_SHARED" } ] }-
Per informazioni dettagliate sull’API, consulta ListProfiles
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
Il comando seguente
list-tags-for-resourceelenca i tag della risorsa specificata.aws route53profiles list-tags-for-resource \ --resource-arnarn:aws:route53profiles:us-east-1:123456789012:profile/rp-4987774726exampleOutput:
{ "Tags": { "my-key-2": "my-value-2", "my-key-1": "my-value-1" } }-
Per informazioni dettagliate sull'API, consulta ListTagsForResource
nella Documentazione di riferimento dei comandi della AWS CLI.
-
L’esempio di codice seguente mostra come utilizzare update-profile-resource-association.
- AWS CLI
-
Come aggiornare una risorsa associata a un profilo
L’esempio
update-profile-resource-associationseguente aggiorna una priorità di un gruppo di regole DNS Firewall associato al profilo.aws route53profiles update-profile-resource-association \ --profile-resource-association-idrpr-001913120a7example\ --resource-properties "{\"priority\": 105}"Output:
{ "ProfileResourceAssociation": { "CreationTime": 1710851216.613, "Id": "rpr-001913120a7example", "ModificationTime": 1710852303.798, "Name": "test-resource-association", "OwnerId": "123456789012", "ProfileId": "rp-4987774726example", "ResourceArn": "arn:aws:route53resolver:us-east-1:123456789012:firewall-rule-group/rslvr-frg-cfe7f72example", "ResourceProperties": "{\"priority\":105}", "ResourceType": "FIREWALL_RULE_GROUP", "Status": "UPDATING", "StatusMessage": "Updating the Profile to DNS Firewall rule group association" } }-
Per informazioni dettagliate sull’API, consulta UpdateProfileResourceAssociation
in AWS CLI Command Reference.
-