Amazon Athena를 사용하여 비용 및 사용량 보고서를 쿼리할 때 최근 결제 데이터를 볼 수 없는 이유는 무엇입니까?
Amazon Athena를 사용하여 비용 및 사용량 보고서를 쿼리할 때 최근 결제 데이터를 볼 수 없습니다.
해결 방법
이 문제의 가장 일반적인 이유는 비용 및 사용량 보고서 테이블에 파티션이 없기 때문입니다. 이 문제를 해결하려면 다음 솔루션 중 하나 이상을 선택합니다.
수동으로 생성된 비용 및 사용량 보고서 테이블에 대해 테이블 파티션을 로드해야 합니다.
비용 및 사용량 보고서 테이블을 수동으로 생성한 경우 Amazon Athena 콘솔에서 MCSK REPARY TABLE 명령을 실행하여 테이블 파티션을 로드합니다. 또는 Amazon Athena 콘솔에서 파티션을 업로드할 수 있습니다.
정기적으로 테이블에 파티션을 추가하도록 AWS Glue 크롤러를 설정한 경우 보고서를 생성하기 전에 크롤러가 실행되도록 예약되어 있어야 합니다. 그렇지 않으면 쿼리 결과에서 최신 결제 데이터를 볼 수 없습니다.
Amazon Simple Storage Service(Amazon S3) 경로 및 AWS Glue 크롤러를 확인하세요.
AWS CloudFormation 템플릿을 사용하여 비용 및 사용량 보고서를 Athena와 통합할 수 있습니다. 이 템플릿에는 AWS Glue 크롤러, AWS Glue 데이터베이스 및 AWS Lambda 이벤트가 포함됩니다. 새로운 비용 및 사용량 보고서 파일이 Amazon S3 경로로 전송될 때 Lambda 함수는 AWS Glue 크롤러를 시작합니다. 그런 다음 크롤러는 비용 및 사용량 보고서 파일의 데이터를 기반으로 테이블에 파티션을 자동으로 추가합니다. 테이블을 쿼리할 때 최신 결제 데이터를 볼 수 없으면 S3 경로를 확인하세요. 비용 및 사용량 보고서 파일이 전송되었는지 확인합니다. 또한 AWS Glue 크롤러가 실행 중 또는 실패 상태가 아닌지 확인합니다.
파티션 프로젝션을 사용하여 자동으로 파티션 채우기
파티션 프로젝션을 사용하여 비용 및 사용량 보고서 테이블을 생성할 수 있습니다. 파티션 프로젝션에서는 파티션 값과 위치가 AWS Glue 데이터 카탈로그에 물리적으로 저장되는 대신 동적으로 계산됩니다. 따라서 최신 데이터를 보기 위해 파티션을 수동으로 추가할 필요가 없습니다. 보고서 파일이 Amazon S3 버킷으로 전송된 후 즉시 쿼리할 수 있습니다.
파티션 프로젝션을 사용하여 비용 및 사용량 보고서 테이블을 생성하려면 다음을 수행합니다.
주: 비용 및 사용량 보고서를 생성할때 Athena에서 보고서 데이터 통합 사용을 선택해야 합니다. 보고서와의 통합을 위해 Athena를 선택하면 보고서 파일이 파티셔닝된 parquet 형식으로 대상 계정에 전달됩니다. 보고서 파일이 대상 파일에 전송되려면 최대 24시간이 걸릴 수 있습니다. 파일 경로는 다음과 유사합니다.
s3://example-report-prefix/example-report-name/example-report-name/year=2021/month=1 s3://example-report-prefix/example-report-name/example-report-name/year=2021/month=2
1. Amazon Athena 콘솔을 엽니다.
2. [쿼리 편집기(Query editor)] 탭에서 다음과 유사한 명령을 입력합니다.
CREATE EXTERNAL TABLE test_cur_partitionprojection( `identity_line_item_id` string, `identity_time_interval` string, `bill_invoice_id` string, `bill_billing_entity` string, `bill_bill_type` string, `bill_payer_account_id` string, `bill_billing_period_start_date` timestamp, `bill_billing_period_end_date` timestamp, `line_item_usage_account_id` string, `line_item_line_item_type` string, `line_item_usage_start_date` timestamp, `line_item_usage_end_date` timestamp, `line_item_product_code` string, `line_item_usage_type` string, `line_item_operation` string, `line_item_availability_zone` string, `line_item_usage_amount` double, `line_item_normalization_factor` double, `line_item_normalized_usage_amount` double, `line_item_currency_code` string, `line_item_unblended_rate` string, `line_item_unblended_cost` double, `line_item_blended_rate` string, `line_item_blended_cost` double, `line_item_line_item_description` string, `line_item_tax_type` string, `line_item_legal_entity` string, `product_product_name` string, `product_alarm_type` string, `product_availability` string, `product_bundle` string, `product_bundle_description` string, `product_bundle_group` string, `product_capacitystatus` string, `product_clock_speed` string, `product_component` string, `product_compute_type` string, `product_content_type` string, `product_cputype` string, `product_current_generation` string, `product_database_engine` string, `product_dedicated_ebs_throughput` string, `product_deployment_option` string, `product_description` string, `product_durability` string, `product_ecu` string, `product_edition` string, `product_engine_code` string, `product_enhanced_networking_supported` string, `product_event_type` string, `product_free_query_types` string, `product_free_trial` string, `product_from_location` string, `product_from_location_type` string, `product_gpu` string, `product_gpu_memory` string, `product_group` string, `product_group_description` string, `product_instance_family` string, `product_instance_name` string, `product_instance_type` string, `product_instance_type_family` string, `product_intel_avx2_available` string, `product_intel_avx_available` string, `product_intel_turbo_available` string, `product_license` string, `product_license_model` string, `product_location` string, `product_location_type` string, `product_logs_destination` string, `product_max_iops_burst_performance` string, `product_max_iopsvolume` string, `product_max_throughputvolume` string, `product_max_volume_size` string, `product_maximum_extended_storage` string, `product_maximum_storage_volume` string, `product_memory` string, `product_memorytype` string, `product_message_delivery_frequency` string, `product_message_delivery_order` string, `product_min_volume_size` string, `product_minimum_storage_volume` string, `product_network_performance` string, `product_normalization_size_factor` string, `product_operating_system` string, `product_operation` string, `product_origin` string, `product_physical_cpu` string, `product_physical_gpu` string, `product_physical_processor` string, `product_pre_installed_sw` string, `product_processor_architecture` string, `product_processor_features` string, `product_product_family` string, `product_queue_type` string, `product_recipient` string, `product_region` string, `product_resource_type` string, `product_rootvolume` string, `product_routing_target` string, `product_routing_type` string, `product_running_mode` string, `product_servicecode` string, `product_servicename` string, `product_sku` string, `product_software_included` string, `product_software_type` string, `product_standard_storage_retention_included` string, `product_storage` string, `product_storage_class` string, `product_storage_media` string, `product_storage_type` string, `product_subscription_type` string, `product_tenancy` string, `product_to_location` string, `product_to_location_type` string, `product_transfer_type` string, `product_usagetype` string, `product_uservolume` string, `product_vcpu` string, `product_version` string, `product_volume_api_name` string, `product_volume_type` string, `pricing_rate_id` string, `pricing_currency` string, `pricing_public_on_demand_cost` double, `pricing_public_on_demand_rate` string, `pricing_term` string, `pricing_unit` string, `reservation_amortized_upfront_cost_for_usage` double, `reservation_amortized_upfront_fee_for_billing_period` double, `reservation_effective_cost` double, `reservation_end_time` string, `reservation_modification_status` string, `reservation_normalized_units_per_reservation` string, `reservation_number_of_reservations` string, `reservation_recurring_fee_for_usage` double, `reservation_start_time` string, `reservation_subscription_id` string, `reservation_total_reserved_normalized_units` string, `reservation_total_reserved_units` string, `reservation_units_per_reservation` string, `reservation_unused_amortized_upfront_fee_for_billing_period` double, `reservation_unused_normalized_unit_quantity` double, `reservation_unused_quantity` double, `reservation_unused_recurring_fee` double, `reservation_upfront_value` double, `savings_plan_total_commitment_to_date` double, `savings_plan_savings_plan_a_r_n` string, `savings_plan_savings_plan_rate` double, `savings_plan_used_commitment` double, `savings_plan_savings_plan_effective_cost` double, `savings_plan_amortized_upfront_commitment_for_billing_period` double, `savings_plan_recurring_commitment_for_billing_period` double) PARTITIONED BY ( `year` int, `month` int) ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe' STORED AS INPUTFORMAT 'org.apache.hadoop.mapred.TextInputFormat' OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' LOCATION 's3://example-report-prefix/example-report-name/example-report-name' TBLPROPERTIES ( 'projection.enabled'='true', 'projection.month.range'='1,12', 'projection.month.type'='integer', 'projection.year.range'='1900,2050', 'projection.year.type'='integer', 'storage.location.template'='s3://example-report-prefix/example-report-name/example-report-name/year=${year}/month=${month}')
3. [다른 이름으로 저장(Save as)]을 선택하여 쿼리를 저장합니다.
4. [쿼리 실행(Run query)]을 선택하여 테이블 test_cur_partitionprojection을 생성합니다.
테이블을 만든 직후 테이블을 쿼리할 수 있습니다. 자세한 내용은 Amazon Athena를 사용한 비용 및 사용량 보고서 쿼리 단원을 참조하세요.

관련 콘텐츠
- 질문됨 6년 전lg...
- 질문됨 4년 전lg...
- 질문됨 5년 전lg...
- 질문됨 2달 전lg...
- 질문됨 3달 전lg...
- AWS 공식업데이트됨 8달 전
- AWS 공식업데이트됨 일 년 전
- AWS 공식업데이트됨 일 년 전
- AWS 공식업데이트됨 10달 전