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à.
Esempi di profili Route 53 utilizzando AWS CLI
I seguenti esempi di codice mostrano come eseguire azioni e implementare scenari comuni utilizzando i profili AWS Command Line Interface with Route 53.
Le operazioni sono estratti di codice da programmi più grandi e devono essere eseguite nel contesto. Mentre le azioni mostrano come richiamare le singole funzioni di servizio, è possibile visualizzare le azioni nel loro 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 utilizzareassociate-profile
.
- AWS CLI
-
Per associare un profilo
L'
associate-profile
esempio seguente associa un profilo a unVPC.aws route53profiles associate-profile \ --name
test-association
\ --profile-idrp-4987774726example
\ --resource-idvpc-0af3b96b3example
Output:
{ "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 Using Profiles nella Amazon Route 53 Developer Guide.
-
Per API i dettagli, consulta AssociateProfile AWS CLI
Command Reference.
-
Il seguente esempio di codice mostra come utilizzareassociate-resource-to-profile
.
- AWS CLI
-
Associare una risorsa a un profilo
L'
associate-resource-to-profile
esempio seguente associa un gruppo di regole DNS Firewall con priorità 102 a un profilo.aws route53profiles associate-resource-to-profile \ --name
test-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 API i dettagli, vedere AssociateResourceToProfile
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzarecreate-profile
.
- AWS CLI
-
Per creare un profilo
L'
create-profile
esempio seguente crea un profilo.aws route53profiles create-profile \ --name
test
Output:
{ "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 API i dettagli, vedere CreateProfile
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredelete-profile
.
- AWS CLI
-
Per eliminare un profilo
L'
delete-profile
esempio seguente elimina un profilo.aws route53profiles delete-profile \ --profile-id
rp-6ffe47d5example
Output:
{ "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 API i dettagli, vedere DeleteProfile
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredisassociate-profile
.
- AWS CLI
-
Per dissociare un profilo
L'
disassociate-profile
esempio seguente dissocia un profilo da un. VPCaws route53profiles disassociate-profile \ --profile-id
rp-4987774726example
\ --resource-idvpc-0af3b96b3example
Output:
{ "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 API i dettagli, vedere DisassociateProfile
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzaredisassociate-resource-from-profile
.
- AWS CLI
-
Per dissociare una risorsa da Profile
L'
disassociate-resource-from-profile
esempio seguente dissocia un gruppo di regole DNS Firewall da un Profile.aws route53profiles disassociate-resource-from-profile \ --profile-id
rp-4987774726example
\ --resource-arnarn:aws:route53resolver:us-east-1:123456789012:firewall-rule-group/rslvr-frg-cfe7f72example
Output:
{ "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 API i dettagli, vedere DisassociateResourceFromProfile
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-profile-association
.
- AWS CLI
-
Per ottenere informazioni su un'associazione di profili
Quanto segue
get-profile-association
restituisce informazioni sull'associazione di profili specificata.aws route53profiles get-profile-association \ --profile-association-id
rpassoc-489ce212fexample
Output:
{ "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 API i dettagli, vedere GetProfileAssociation
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-profile-resource-association
.
- AWS CLI
-
Per ottenere informazioni su una risorsa associata a un profilo
Quanto segue
get-profile-resource-association
restituisce informazioni sull'associazione di risorse specificata a un profilo.aws route53profiles get-profile-resource-association \ --profile-resource-association-id
rpr-001913120a7example
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": "COMPLETE", "StatusMessage": "Completed creation of Profile to DNS Firewall rule group association" } }
-
Per API i dettagli, vedere GetProfileResourceAssociation
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzareget-profile
.
- AWS CLI
-
Per ottenere informazioni su un profilo
Quanto segue
get-profile
restituisce informazioni sul profilo specificato.aws route53profiles get-profile \ --profile-id
rp-4987774726example
Output:
{ "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 API i dettagli, vedere GetProfile
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-profile-associations
.
- AWS CLI
-
Per elencare le associazioni dei profili
Di seguito
list-profile-associations
sono elencate le associazioni di profili presenti nel tuo AWS account.aws route53profiles list-profile-associations
Output:
{ "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 API i dettagli, vedere ListProfileAssociations
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-profile-resource-associations
.
- AWS CLI
-
Per elencare le associazioni di risorse del profilo
Di seguito sono
list-profile-resource-associations
elencate le associazioni di risorse Profile per il profilo specificato.aws route53profiles list-profile-resource-associations \ --profile-id
rp-4987774726example
Output:
{ "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 API i dettagli, vedere ListProfileResourceAssociations
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-profiles
.
- AWS CLI
-
Per elencare i profili
Di seguito
list-profiles
sono elencati i profili presenti nell' AWS account e vengono visualizzate informazioni aggiuntive su di essi.aws route53profiles list-profiles
Output:
{ "ProfileSummaries": [ { "Arn": "arn:aws:route53profiles:us-east-1:123456789012:profile/rp-4987774726example", "Id": "rp-4987774726example", "Name": "test", "ShareStatus": "NOT_SHARED" } ] }
-
Per API i dettagli, vedere ListProfiles
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzarelist-tags-for-resource
.
- AWS CLI
-
Per elencare i tag di una risorsa
Di seguito
list-tags-for-resource
sono elencati i tag per la risorsa specificata.aws route53profiles list-tags-for-resource \ --resource-arn
arn:aws:route53profiles:us-east-1:123456789012:profile/rp-4987774726example
Output:
{ "Tags": { "my-key-2": "my-value-2", "my-key-1": "my-value-1" } }
-
Per API i dettagli, vedere ListTagsForResource
in AWS CLI Command Reference.
-
Il seguente esempio di codice mostra come utilizzareupdate-profile-resource-association
.
- AWS CLI
-
Per aggiornare una risorsa associata a un profilo
Quanto segue
update-profile-resource-association
aggiorna una priorità di un gruppo di regole del DNS firewall associato al profilo.aws route53profiles update-profile-resource-association \ --profile-resource-association-id
rpr-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 API i dettagli, vedere UpdateProfileResourceAssociation
in AWS CLI Command Reference.
-