

# AWS CLI를 사용한 Route 53 Profiles 예시
<a name="cli_route53profiles_code_examples"></a>

다음 코드 예시에서는 Route 53 Profiles와 함께 AWS Command Line Interface를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.

*작업*은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 개별 서비스 함수를 직접적으로 호출하는 방법을 보여주며 관련 시나리오의 컨텍스트에 맞는 작업을 볼 수 있습니다.

각 예시에는 전체 소스 코드에 대한 링크가 포함되어 있으며, 여기에서 컨텍스트에 맞춰 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있습니다.

**Topics**
+ [작업](#actions)

## 작업
<a name="actions"></a>

### `associate-profile`
<a name="route53profiles_AssociateProfile_cli_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_topic"></a>

다음 코드 예시에서는 `associate-resource-to-profile`의 사용 방법을 보여줍니다.

**AWS CLI**  
**리소스를 프로파일에 연결**  
다음 `associate-resource-to-profile` 예시에서는 우선순위가 102인 DNS 방화벽 규칙 그룹을 프로파일에 연결합니다.  

```
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_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_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_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_topic"></a>

다음 코드 예시에서는 `disassociate-resource-from-profile`의 사용 방법을 보여줍니다.

**AWS CLI**  
**프로파일에서 리소스 연결 해제**  
다음 `disassociate-resource-from-profile` 예시에서는 프로파일에서 DNS 방화벽 규칙 그룹을 연결 해제합니다.  

```
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_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_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_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_topic"></a>

다음 코드 예시에서는 `list-profile-associations`의 사용 방법을 보여줍니다.

**AWS CLI**  
**프로파일 연결 나열**  
다음 `list-profile-associations`는 AWS 계정의 프로파일 연결을 나열합니다.  

```
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_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_topic"></a>

다음 코드 예시에서는 `list-profiles`의 사용 방법을 보여줍니다.

**AWS CLI**  
**프로파일 나열**  
다음 `list-profiles`는 AWS 계정의 프로파일을 나열하고 이에 대한 추가 정보를 표시합니다.  

```
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_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_topic"></a>

다음 코드 예시에서는 `update-profile-resource-association`의 사용 방법을 보여줍니다.

**AWS CLI**  
**프로파일에 연결된 리소스 업데이트**  
다음 `update-profile-resource-association`은 프로파일에 연결된 DNS 방화벽 규칙 그룹의 우선 순위를 업데이트합니다.  

```
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)을 참조하세요.