Slide 37
Slide 37 text
(C) Gunosy Inc. All Rights Reserved. PAGE | 37
Security Lakeを使った実装
AthenaのView
CREATE OR REPLACE VIEW "view_latest_status_security_hub_resource_findings" AS
with resource_finding as (
select
t1.finding.uid as finding_uid
, t1.region
, t1.account_id
, max_by(t1.metadata.product.version, t1.finding.modified_time) as metadata_product_version
, max_by(t1.metadata.product.feature.uid, t1.finding.modified_time) as
metadata_product_feature_uid
, max_by(t1.metadata.product.feature.name, t1.finding.modified_time) as compliance.status,
t1.finding.modified_time) as compliance_status -- key-value
<省略>
, max_by(t1.state_id, t1.finding.modified_time) as state_id
, max_by(t1.severity_id, t1.finding.modified_time) as severity_id
, max_by(t1.unmapped, t1.finding.modified_time) as unmapped -- map
from
original_security_lake.security_hub as t1
cross join unnest(resources) as t(resource)
where
t1.region = 'ap-northeast-1'
group by 1, 2, 3
)