

# AWS Cost and Usage Report를 사용한 예시AWS CLI
<a name="cli_cost-and-usage-report-service_code_examples"></a>

다음 코드 예시에서는 AWS Cost and Usage Report에서 AWS Command Line Interface를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.

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

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

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

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

### `delete-report-definition`
<a name="cost-and-usage-report-service_DeleteReportDefinition_cli_topic"></a>

다음 코드 예시는 `delete-report-definition`의 사용 방법을 보여줍니다.

**AWS CLI**  
**AWS 비용 및 사용 보고서를 삭제하는 방법**  
이 예제에서는 AWS 비용 및 사용 보고서를 삭제합니다.  
명령:  

```
aws cur --region us-east-1 delete-report-definition --report-name "ExampleReport"
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DeleteReportDefinition](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cur/delete-report-definition.html)을 참조하세요.

### `describe-report-definitions`
<a name="cost-and-usage-report-service_DescribeReportDefinitions_cli_topic"></a>

다음 코드 예시는 `describe-report-definitions`의 사용 방법을 보여줍니다.

**AWS CLI**  
**AWS 비용 및 사용 보고서 목록을 검색하는 방법**  
이 예제에서는 계정이 소유한 AWS 비용 및 사용 보고서 목록을 설명합니다.  
명령:  

```
aws cur --region us-east-1 describe-report-definitions --max-items 5
```
출력:  

```
  {
"ReportDefinitions": [
  {
      "ReportName": "ExampleReport",
      "Compression": "ZIP",
      "S3Region": "us-east-1",
      "Format": "textORcsv",
      "S3Prefix": "exampleprefix",
      "S3Bucket": "example-s3-bucket",
      "TimeUnit": "DAILY",
      "AdditionalArtifacts": [
          "REDSHIFT",
          "QUICKSIGHT"
      ],
      "AdditionalSchemaElements": [
          "RESOURCES"
      ]
  }
]
  }
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [DescribeReportDefinitions](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cur/describe-report-definitions.html)를 참조하세요.

### `put-report-definition`
<a name="cost-and-usage-report-service_PutReportDefinition_cli_topic"></a>

다음 코드 예시는 `put-report-definition`의 사용 방법을 보여줍니다.

**AWS CLI**  
**AWS 비용 및 사용 보고서를 생성하는 방법**  
다음 `put-report-definition` 예제에서는 일일 AWS 비용 및 사용량 보고서를 생성하여 Amazon Redshift 또는 Amazon QuickSight에 업로드할 수 있습니다.  

```
aws cur put-report-definition --report-definition file://report-definition.json
```
`report-definition.json`의 콘텐츠:  

```
{
    "ReportName": "ExampleReport",
    "TimeUnit": "DAILY",
    "Format": "textORcsv",
    "Compression": "ZIP",
    "AdditionalSchemaElements": [
        "RESOURCES"
    ],
    "S3Bucket": "example-s3-bucket",
    "S3Prefix": "exampleprefix",
    "S3Region": "us-east-1",
    "AdditionalArtifacts": [
        "REDSHIFT",
        "QUICKSIGHT"
    ]
}
```
+  API 세부 정보는 *AWS CLI 명령 참조*의 [PutReportDefinition](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/cur/put-report-definition.html)을 참조하세요.