

Doc AWS SDK Examples GitHub リポジトリには、他にも SDK の例があります。 [AWS](https://github.com/awsdocs/aws-doc-sdk-examples)

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# を使用した Route 53 Profiles の例 AWS CLI
<a name="cli_2_route53profiles_code_examples"></a>

次のコード例は、Route 53 Profiles AWS Command Line Interface で を使用してアクションを実行し、一般的なシナリオを実装する方法を示しています。

*アクション*はより大きなプログラムからのコードの抜粋であり、コンテキスト内で実行する必要があります。アクションは個々のサービス機能を呼び出す方法を示していますが、コンテキスト内のアクションは、関連するシナリオで確認できます。

各例には完全なソースコードへのリンクが含まれており、コードの設定方法と実行方法に関する手順を確認できます。

**Topics**
+ [アクション](#actions)

## アクション
<a name="actions"></a>

### `associate-profile`
<a name="route53profiles_AssociateProfile_cli_2_topic"></a>

次のコード例は、`associate-profile` を使用する方法を示しています。

**AWS CLI**  
**プロファイルを関連付けるには**  
次の `associate-profile` の例では、プロファイルを VPC に関連付けます。  

```
aws route53profiles associate-profile \
    --name test-association \
    --profile-id rp-4987774726example \
    --resource-id vpc-0af3b96b3example
```
出力:  

```
{
    "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"
    }
}
```
詳細については、「*Amazon Route 53 デベロッパーガイド*」の「[プロファイルの使用](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/profile-high-level-steps.html)」を参照してください。  
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[AssociateProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/associate-profile.html)」を参照してください。

### `associate-resource-to-profile`
<a name="route53profiles_AssociateResourceToProfile_cli_2_topic"></a>

次のコード例は、`associate-resource-to-profile` を使用する方法を示しています。

**AWS CLI**  
**リソースをプロファイルに関連付けるには**  
次の `associate-resource-to-profile` の例では、DNS Firewall ルールグループを優先度 102 でプロファイルに関連付けます。  

```
aws route53profiles associate-resource-to-profile \
    --name test-resource-association \
    --profile-id rp-4987774726example \
    --resource-arn arn:aws:route53resolver:us-east-1:123456789012:firewall-rule-group/rslvr-frg-cfe7f72example \
    --resource-properties "{\"priority\": 102}"
```
出力:  

```
{
    "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 の詳細については、「*AWS CLI コマンドリファレンス*.」の「[AssociateResourceToProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/associate-resource-to-profile.html)」を参照してください。

### `create-profile`
<a name="route53profiles_CreateProfile_cli_2_topic"></a>

次のコード例は、`create-profile` を使用する方法を示しています。

**AWS CLI**  
**プロファイルを作成するには**  
次の `create-profile` の例では、プロファイルを作成します。  

```
aws route53profiles create-profile \
    --name test
```
出力:  

```
{
    "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 の詳細については、「*AWS CLI コマンドリファレンス*」の「[CreateProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/create-profile.html)」を参照してください。

### `delete-profile`
<a name="route53profiles_DeleteProfile_cli_2_topic"></a>

次のコード例は、`delete-profile` を使用する方法を示しています。

**AWS CLI**  
**プロファイルを削除するには**  
次の `delete-profile` の例では、プロファイルを削除します。  

```
aws route53profiles delete-profile \
    --profile-id rp-6ffe47d5example
```
出力:  

```
{
    "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 の詳細については、「*AWS CLI コマンドリファレンス*」の「[DeleteProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/delete-profile.html)」を参照してください。

### `disassociate-profile`
<a name="route53profiles_DisassociateProfile_cli_2_topic"></a>

次のコード例は、`disassociate-profile` を使用する方法を示しています。

**AWS CLI**  
**プロファイルの関連付けを解除するには**  
次の `disassociate-profile` の例では、VPC からプロファイルの関連付けを解除します。  

```
aws route53profiles disassociate-profile \
    --profile-id rp-4987774726example \
    --resource-id vpc-0af3b96b3example
```
出力:  

```
{
    "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 の詳細については、「*AWS CLI コマンドリファレンス*」の「[DisassociateProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/disassociate-profile.html)」を参照してください。

### `disassociate-resource-from-profile`
<a name="route53profiles_DisassociateResourceFromProfile_cli_2_topic"></a>

次のコード例は、`disassociate-resource-from-profile` を使用する方法を示しています。

**AWS CLI**  
**プロファイルからリソースの関連付けを解除するには**  
次の `disassociate-resource-from-profile` の例では、プロファイルから DNS Firewall ルールグループの関連付けを解除します。  

```
aws route53profiles disassociate-resource-from-profile \
    --profile-id rp-4987774726example \
    --resource-arn arn:aws:route53resolver:us-east-1:123456789012:firewall-rule-group/rslvr-frg-cfe7f72example
```
出力:  

```
{
    "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 の詳細については、「*AWS CLI コマンドリファレンス*」の「[DisassociateResourceFromProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/disassociate-resource-from-profile.html)」を参照してください。

### `get-profile-association`
<a name="route53profiles_GetProfileAssociation_cli_2_topic"></a>

次のコード例は、`get-profile-association` を使用する方法を示しています。

**AWS CLI**  
**プロファイルの関連付けに関する情報を取得するには**  
次の `get-profile-association` は、指定されたプロファイルの関連付けに関する情報を返します。  

```
aws route53profiles get-profile-association \
    --profile-association-id rpassoc-489ce212fexample
```
出力:  

```
{
    "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 の詳細については、「**AWS CLI コマンドリファレンス」の「[GetProfileAssociation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/get-profile-association.html)」を参照してください。

### `get-profile-resource-association`
<a name="route53profiles_GetProfileResourceAssociation_cli_2_topic"></a>

次のコード例は、`get-profile-resource-association` を使用する方法を示しています。

**AWS CLI**  
**プロファイルに関連付けられたリソースに関する情報を取得するには**  
次の `get-profile-resource-association` は、プロファイルへの指定されたリソースの関連付けに関する情報を返します。  

```
aws route53profiles get-profile-resource-association \
    --profile-resource-association-id rpr-001913120a7example
```
出力:  

```
{
    "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 の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetProfileResourceAssociation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/get-profile-resource-association.html)」を参照してください。

### `get-profile`
<a name="route53profiles_GetProfile_cli_2_topic"></a>

次のコード例は、`get-profile` を使用する方法を示しています。

**AWS CLI**  
**プロファイルの情報を取得するには**  
次の `get-profile` は、指定されたプロファイルの情報を返します。  

```
aws route53profiles get-profile \
    --profile-id rp-4987774726example
```
出力:  

```
{
    "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 の詳細については、「*AWS CLI コマンドリファレンス*」の「[GetProfile](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/get-profile.html)」を参照してください。

### `list-profile-associations`
<a name="route53profiles_ListProfileAssociations_cli_2_topic"></a>

次のコード例は、`list-profile-associations` を使用する方法を示しています。

**AWS CLI**  
**プロファイルの関連付けを一覧表示するには**  
 AWS アカウントのプロファイルの関連付けを以下`list-profile-associations`に示します。  

```
aws route53profiles list-profile-associations
```
出力:  

```
{
    "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 の詳細については、「*AWS CLI コマンドリファレンス*」の「[ListProfileAssociations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/list-profile-associations.html)」を参照してください。

### `list-profile-resource-associations`
<a name="route53profiles_ListProfileResourceAssociations_cli_2_topic"></a>

次のコード例は、`list-profile-resource-associations` を使用する方法を示しています。

**AWS CLI**  
**プロファイルリソースの関連付けを一覧表示するには**  
次の `list-profile-resource-associations` では、指定されたプロファイルのプロファイルリソースの関連付けを一覧表示します。  

```
aws route53profiles list-profile-resource-associations \
    --profile-id rp-4987774726example
```
出力:  

```
{
     "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 の詳細については、「*AWS CLI コマンドリファレンス*」の「[ListProfileResourceAssociations](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/list-profile-resource-associations.html)」を参照してください。

### `list-profiles`
<a name="route53profiles_ListProfiles_cli_2_topic"></a>

次のコード例は、`list-profiles` を使用する方法を示しています。

**AWS CLI**  
**プロファイルを一覧表示するには**  
以下は、 AWS アカウントのプロファイルを`list-profiles`一覧表示し、それらに関する追加情報を表示します。  

```
aws route53profiles list-profiles
```
出力:  

```
{
     "ProfileSummaries": [
         {
             "Arn": "arn:aws:route53profiles:us-east-1:123456789012:profile/rp-4987774726example",
             "Id": "rp-4987774726example",
             "Name": "test",
             "ShareStatus": "NOT_SHARED"
         }
     ]
 }
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[ListProfiles](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/list-profiles.html)」を参照してください。

### `list-tags-for-resource`
<a name="route53profiles_ListTagsForResource_cli_2_topic"></a>

次のコード例は、`list-tags-for-resource` を使用する方法を示しています。

**AWS CLI**  
**リソースのタグを一覧表示するには**  
次の `list-tags-for-resource` では、指定したリソースのタグを一覧表示します。  

```
aws route53profiles list-tags-for-resource \
    --resource-arn arn:aws:route53profiles:us-east-1:123456789012:profile/rp-4987774726example
```
出力:  

```
{
    "Tags": {
        "my-key-2": "my-value-2",
        "my-key-1": "my-value-1"
    }
}
```
+  API の詳細については、「*AWS CLI コマンドリファレンス*」の「[ListTagsForResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/list-tags-for-resource.html)」を参照してください。

### `update-profile-resource-association`
<a name="route53profiles_UpdateProfileResourceAssociation_cli_2_topic"></a>

次のコード例は、`update-profile-resource-association` を使用する方法を示しています。

**AWS CLI**  
**プロファイルに関連付けられたリソースを更新するには**  
次の `update-profile-resource-association` では、プロファイルに関連付けられている DNS Firewall ルールグループの優先度を更新します。  

```
aws route53profiles update-profile-resource-association \
    --profile-resource-association-id rpr-001913120a7example \
    --resource-properties "{\"priority\": 105}"
```
出力:  

```
{
    "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 の詳細については、「*AWS CLI コマンドリファレンス*」の「[UpdateProfileResourceAssociation](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/route53profiles/update-profile-resource-association.html)」を参照してください。