Beispiele für die Verwendung von Route-53-Profilen mit AWS CLI
Die folgenden Codebeispiele zeigen, wie Sie Aktionen durchführen und gängige Szenarien implementieren, indem Sie das AWS Command Line Interface mit Route-53-Profilen nutzen.
Aktionen sind Codeauszüge aus größeren Programmen und müssen im Kontext ausgeführt werden. Während Aktionen Ihnen zeigen, wie Sie einzelne Service-Funktionen aufrufen, können Sie Aktionen im Kontext der zugehörigen Szenarien anzeigen.
Jedes Beispiel enthält einen Link zum vollständigen Quellcode, wo Sie Anleitungen zum Einrichten und Ausführen des Codes im Kontext finden.
Themen
Aktionen
Das folgende Codebeispiel zeigt, wie associate-profile verwendet wird.
- AWS CLI
-
So ordnen Sie ein Profil zu
Im folgenden Beispiel für
associate-profilewird ein Profil zu einer VPC zugeordnet.aws route53profiles associate-profile \ --nametest-association\ --profile-idrp-4987774726example\ --resource-idvpc-0af3b96b3exampleAusgabe:
{ "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" } }Weitere Informationen finden Sie unter Verwenden von Profilen im Entwicklerhandbuch zu Amazon Route 53.
-
API-Details finden Sie unter AssociateProfile
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie associate-resource-to-profile verwendet wird.
- AWS CLI
-
So ordnen Sie eine Ressource einem Profil zu
Im folgenden Beispiel für
associate-resource-to-profilewird eine DNS-Firewall-Regelgruppe mit der Priorität 102 einem Profil zugeordnet.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}"Ausgabe:
{ "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" } }-
API-Details finden Sie unter AssociateResourceToProfile
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie create-profile verwendet wird.
- AWS CLI
-
So erstellen Sie ein Profil
Im folgenden Beispiel für
create-profilewird ein Profil erstellt.aws route53profiles create-profile \ --nametestAusgabe:
{ "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" } }-
API-Details finden Sie unter CreateProfile
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie delete-profile verwendet wird.
- AWS CLI
-
So löschen Sie ein Profil
Im folgenden Beispiel für
delete-profilewird ein Profil gelöscht.aws route53profiles delete-profile \ --profile-idrp-6ffe47d5exampleAusgabe:
{ "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" } }-
API-Details finden Sie unter DeleteProfile
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie disassociate-profile verwendet wird.
- AWS CLI
-
So heben Sie die Zuordnung eines Profils auf
Im folgenden Beispiel für
disassociate-profilewird die Zuordnung eines Profils zu einer VPC aufgehoben.aws route53profiles disassociate-profile \ --profile-idrp-4987774726example\ --resource-idvpc-0af3b96b3exampleAusgabe:
{ "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" } }-
API-Details finden Sie unter DisassociateProfile
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie disassociate-resource-from-profile verwendet wird.
- AWS CLI
-
So heben Sie die Zuordnung einer Ressource zu einem Profil auf
Im folgenden Beispiel für
disassociate-resource-from-profilewird die Zuordnung einer DNS-Firewall-Regelgruppe zu einem Profil aufgehoben.aws route53profiles disassociate-resource-from-profile \ --profile-idrp-4987774726example\ --resource-arnarn:aws:route53resolver:us-east-1:123456789012:firewall-rule-group/rslvr-frg-cfe7f72exampleAusgabe:
{ "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" } }-
API-Details finden Sie unter DisassociateResourceFromProfile
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie get-profile-association verwendet wird.
- AWS CLI
-
So rufen Sie Informationen über eine Profilzuordnung ab
Im folgenden Beispiel für
get-profile-associationwerden Informationen über die angegebene Profilzuordnung abgerufen.aws route53profiles get-profile-association \ --profile-association-idrpassoc-489ce212fexampleAusgabe:
{ "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" } }-
API-Details finden Sie unter GetProfileAssociation
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie get-profile-resource-association verwendet wird.
- AWS CLI
-
So rufen Sie Informationen über die Zuordnung einer Ressource zu einem Profil ab
Im folgenden
get-profile-resource-associationwerden Informationen über die angegebene Ressourcenzuordnung zu einem Profil zurückgegeben.aws route53profiles get-profile-resource-association \ --profile-resource-association-idrpr-001913120a7exampleAusgabe:
{ "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" } }-
API-Details finden Sie unter GetProfileResourceAssociation
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie get-profile verwendet wird.
- AWS CLI
-
So rufen Sie Informationen zu einem Profil ab
Im folgenden
get-profilewerden Informationen über das angegebene Profil zurückgegeben.aws route53profiles get-profile \ --profile-idrp-4987774726exampleAusgabe:
{ "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" } }-
API-Details finden Sie unter GetProfile
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie list-profile-associations verwendet wird.
- AWS CLI
-
So listen Sie Profilzuordnungen auf
Im folgenden
list-profile-associationswerden die Profilzuordnungen in Ihrem AWS-Konto aufgelistet.aws route53profiles list-profile-associationsAusgabe:
{ "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" } ] }-
API-Details finden Sie unter ListProfileAssociations
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie list-profile-resource-associations verwendet wird.
- AWS CLI
-
So listen Sie Profilressourcenzuordnungen auf
Im folgenden
list-profile-resource-associationswerden die Profilressourcenzuordnungen für das angegebene Profil aufgelistet.aws route53profiles list-profile-resource-associations \ --profile-idrp-4987774726exampleAusgabe:
{ "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" } ] }-
API-Details finden Sie unter ListProfileResourceAssociations
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie list-profiles verwendet wird.
- AWS CLI
-
So listen Sie Profile auf
Im folgenden
list-profileswerden die Profile in Ihrem AWS-Konto aufgelistet und zusätzliche Informationen zu diesen angezeigt.aws route53profiles list-profilesAusgabe:
{ "ProfileSummaries": [ { "Arn": "arn:aws:route53profiles:us-east-1:123456789012:profile/rp-4987774726example", "Id": "rp-4987774726example", "Name": "test", "ShareStatus": "NOT_SHARED" } ] }-
API-Details finden Sie unter ListProfiles
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie list-tags-for-resource verwendet wird.
- AWS CLI
-
So listen Sie Tags für eine Ressource auf
Im folgenden
list-tags-for-resourcewerden die Tags für die angegebene Ressource aufgelistet.aws route53profiles list-tags-for-resource \ --resource-arnarn:aws:route53profiles:us-east-1:123456789012:profile/rp-4987774726exampleAusgabe:
{ "Tags": { "my-key-2": "my-value-2", "my-key-1": "my-value-1" } }-
API-Details finden Sie unter ListTagsForResource
in der AWS CLI-Befehlsreferenz.
-
Das folgende Codebeispiel zeigt, wie update-profile-resource-association verwendet wird.
- AWS CLI
-
So aktualisieren Sie eine einem Profil zugeordnete Ressource
Im folgenden
update-profile-resource-associationwird eine dem Profil zugeordnete Priorität einer DNS-Firewall-Regelgruppe aktualisiert.aws route53profiles update-profile-resource-association \ --profile-resource-association-idrpr-001913120a7example\ --resource-properties "{\"priority\": 105}"Ausgabe:
{ "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" } }-
API-Details finden Sie unter UpdateProfileResourceAssociation
in der AWS CLI-Befehlsreferenz.
-