Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature crawler #711

Merged
merged 66 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
6b31eb8
wip
iakov-aws Nov 6, 2023
564e978
wip
iakov-aws Nov 24, 2023
14929cb
add management of CUR fields
iakov-aws Dec 23, 2023
d057156
wip
iakov-aws Dec 23, 2023
3423e1f
better type management
iakov-aws Dec 23, 2023
b23941a
refactoring
iakov-aws Dec 23, 2023
c6caf78
fixes
iakov-aws Dec 23, 2023
d0b8578
add warning if crawler is not well configured
iakov-aws Dec 23, 2023
3508256
sort
iakov-aws Dec 23, 2023
6d8f314
fix import
iakov-aws Dec 23, 2023
3acf9a6
Merge branch 'main' into feature-crawler
iakov-aws Dec 23, 2023
1edc2d2
Merge
iakov-aws Dec 23, 2023
900a42a
refactoring cur
iakov-aws Dec 24, 2023
9839247
remove resource id dep
iakov-aws Dec 24, 2023
17db51a
remove resource_id dep
iakov-aws Dec 24, 2023
7c53141
more refactoring
iakov-aws Dec 24, 2023
c4af0fa
more refactoring
iakov-aws Dec 24, 2023
7785277
fixes
iakov-aws Dec 24, 2023
3f54b03
merge
iakov-aws Dec 24, 2023
d129f30
fixes
iakov-aws Dec 24, 2023
ca45cdc
Merge branch 'feature-manage-cur-fields' into feature-crawler
iakov-aws Dec 24, 2023
3b7e6b0
add cur creation
iakov-aws Dec 25, 2023
bb3d1d1
fixes
iakov-aws Dec 25, 2023
a25e737
fixes
iakov-aws Dec 25, 2023
113b92f
fixes
iakov-aws Dec 25, 2023
e25d45b
better creation workflow and messages plus database creation
iakov-aws Dec 26, 2023
cbd7d4a
doc and workflow fixes
iakov-aws Dec 26, 2023
4246a5b
doc and workflow fixes
iakov-aws Dec 26, 2023
60d33f9
add cur.yaml
iakov-aws Dec 26, 2023
a41d21c
add QS DS role management
iakov-aws Dec 26, 2023
4a78973
refactor iam
iakov-aws Dec 26, 2023
f8a9fab
allow customer to create dataset with new QS role
iakov-aws Dec 27, 2023
6e46436
release 0.3.0
iakov-aws Dec 27, 2023
16d427f
Merge branch 'main' into feature-crawler
iakov-aws Dec 27, 2023
30f623b
refactor export
iakov-aws Dec 28, 2023
e4b2902
lint
iakov-aws Dec 30, 2023
36a72e9
lint
iakov-aws Dec 30, 2023
0df6174
fix cur yaml
iakov-aws Jan 24, 2024
5eca19b
fix role creation
iakov-aws Jan 24, 2024
37b2e40
workaround IAM
iakov-aws Jan 24, 2024
da1436a
wip
iakov-aws Jan 24, 2024
3dc81a3
merge
iakov-aws Jan 24, 2024
a55b8a9
more fixes
iakov-aws Jan 24, 2024
1a4a4c1
various fixes for the crawler and roles
iakov-aws Jan 25, 2024
3191172
various fixes for the crawler and roles
iakov-aws Jan 25, 2024
520fd35
Update cid/helpers/quicksight/__init__.py
iakov-aws Jan 31, 2024
4a1c6a8
Update cid/cli.py
iakov-aws Jan 31, 2024
98d16cc
Update cid/commands/init_qs.py
iakov-aws Jan 31, 2024
be8c3ae
Update cid/commands/init_qs.py
iakov-aws Jan 31, 2024
bfbf9a0
Merge branch 'main' into feature-crawler
iakov-aws Jan 31, 2024
ea82b5b
review fixes
iakov-aws Jan 31, 2024
67d1e06
wip
iakov-aws Feb 1, 2024
1da954d
align roles
iakov-aws Mar 10, 2024
8e3e6b1
merge
iakov-aws Mar 10, 2024
f5c63b3
lint
iakov-aws Mar 10, 2024
8dd9f38
more fixes
iakov-aws Mar 10, 2024
bc21c90
Merge branch 'main' into feature-crawler
iakov-aws Mar 22, 2024
6e4cdcb
minor fixes
iakov-aws Mar 26, 2024
19301b0
align role names
iakov-aws Mar 26, 2024
010d9e9
merge main
iakov-aws Mar 26, 2024
28dbe5b
fix comment
iakov-aws Mar 26, 2024
f404504
merge
iakov-aws Mar 26, 2024
b1f75c3
remove print
iakov-aws Mar 26, 2024
4640404
Update cid/common.py
iakov-aws Mar 27, 2024
a4d14fb
Update cid/common.py
iakov-aws Mar 28, 2024
68a841f
merge
iakov-aws Mar 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 200 additions & 6 deletions cid/builtin/core/data/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -267,47 +267,186 @@ views:
riFile: cid/summary_view_ri.sql
File: cid/summary_view.sql
dependsOn:
cur: true
cur:
- bill_billing_entity
- bill_billing_period_start_date
- bill_invoice_id
- bill_payer_account_id
- line_item_availability_zone
- line_item_legal_entity
- line_item_line_item_description
- line_item_line_item_type
- line_item_operation
- line_item_product_code
- line_item_resource_id
- line_item_unblended_cost
- line_item_usage_account_id
- line_item_usage_amount
- line_item_usage_start_date
- line_item_usage_type
- pricing_public_on_demand_cost
- pricing_unit
- product_current_generation
- product_database_engine
- product_from_location
- product_group
- product_operating_system
- product_physical_processor
- product_processor_features
- product_product_family
- product_product_name
- product_region
- product_servicecode
- product_tenancy
- product_to_location
- reservation_effective_cost
- reservation_reservation_a_r_n
- reservation_unused_amortized_upfront_fee_for_billing_period
- reservation_unused_recurring_fee
- savings_plan_amortized_upfront_commitment_for_billing_period
- savings_plan_savings_plan_a_r_n
- savings_plan_savings_plan_effective_cost
- savings_plan_total_commitment_to_date
- savings_plan_used_commitment

ec2_running_cost:
spriFile: cid/ec2_running_cost_sp_ri.sql
spFile: cid/ec2_running_cost_sp.sql
riFile: cid/ec2_running_cost_ri.sql
File: cid/ec2_running_cost.sql
dependsOn:
cur: true
cur:
- bill_billing_period_start_date
- bill_payer_account_id
- line_item_line_item_type
- line_item_unblended_cost
- line_item_usage_account_id
- line_item_usage_amount
- line_item_usage_start_date
- line_item_usage_type
- reservation_effective_cost
- reservation_reservation_a_r_n
- savings_plan_savings_plan_a_r_n
- savings_plan_savings_plan_effective_cost

compute_savings_plan_eligible_spend:
File: cid/compute_savings_plan_eligible_spend.sql
dependsOn:
cur: true
- bill_billing_period_start_date
- bill_payer_account_id
- line_item_line_item_type
- line_item_operation
- line_item_product_code
- line_item_unblended_cost
- line_item_usage_account_id
- line_item_usage_start_date
- line_item_usage_type
- product_servicecode

s3_view:
File: cid/s3.sql
dependsOn:
cur: true
cur:
- bill_billing_period_start_date
- bill_payer_account_id
- line_item_line_item_type
- line_item_operation
- line_item_product_code
- line_item_resource_id
- line_item_unblended_cost
- line_item_usage_account_id
- line_item_usage_amount
- line_item_usage_start_date
- pricing_public_on_demand_cost
- pricing_unit
- product_region

ri_sp_mapping:
spriFile: cid/ri_sp_mapping_sp_ri.sql
spFile: cid/ri_sp_mapping_sp.sql
riFile: cid/ri_sp_mapping_ri.sql
File: cid/ri_sp_mapping.sql
dependsOn:
cur: true
cur:
- bill_billing_period_start_date
- bill_payer_account_id
- line_item_line_item_type
- pricing_lease_contract_length
- pricing_offering_class
- pricing_purchase_option
- reservation_reservation_a_r_n
- savings_plan_end_time
- savings_plan_savings_plan_a_r_n

hourly_view:
spriFile: cudos/hourly_view_sp_ri.sql
spFile: cudos/hourly_view_sp.sql
riFile: cudos/hourly_view_ri.sql
File: cudos/hourly_view.sql
dependsOn:
cur: true
cur:
- bill_billing_period_start_date
- bill_payer_account_id
- line_item_line_item_description
- line_item_line_item_type
- line_item_operation
- line_item_product_code
- line_item_unblended_cost
- line_item_usage_account_id
- line_item_usage_amount
- line_item_usage_start_date
- line_item_usage_type
- pricing_term
- pricing_unit
- product_region
- product_servicecode
- reservation_effective_cost
- reservation_reservation_a_r_n
- savings_plan_savings_plan_a_r_n
- savings_plan_savings_plan_effective_cost

resource_view:
spriFile: cudos/resource_view_sp_ri.sql
spFile: cudos/resource_view_sp.sql
riFile: cudos/resource_view_ri.sql
File: cudos/resource_view.sql
dependsOn:
cur: true
cur:
- bill_billing_entity
- bill_payer_account_id
- line_item_legal_entity
- line_item_line_item_description
- line_item_line_item_type
- line_item_operation
- line_item_product_code
- line_item_resource_id
- line_item_unblended_cost
- line_item_usage_account_id
- line_item_usage_amount
- line_item_usage_start_date
- line_item_usage_type
- pricing_term
- pricing_unit
- product_database_engine
- product_deployment_option
- product_from_location
- product_group
- product_instance_type
- product_instance_type_family
- product_operating_system
- product_product_family
- product_product_name
- product_region
- product_servicecode
- product_storage
- product_to_location
- product_volume_api_name
- reservation_effective_cost
- reservation_reservation_a_r_n
- savings_plan_savings_plan_a_r_n
- savings_plan_savings_plan_effective_cost

# Trends
daily_anomaly_detection:
File: trends/daily_anomaly_detection.sql
Expand Down Expand Up @@ -484,6 +623,19 @@ views:
- aws_accounts
ta_descriptions:
File: shared/ta_descriptions.sql
cur:
type: Glue_Table
File: shared/CUR.yaml
crawler: cur
parameters:
partitions:
type: cur.partitions
description: 'comma separated list of CUR partitions ex: ["source_account_id","cur_name_1","cur_name_2","year","month"] ex2: ["year","month"]'
default: '[{"Name":"source_account_id","Type":"string"},{"Name":"cur_name_1","Type":"string"},{"Name":"cur_name_2","Type":"string"},{"Name":"year","Type":"string"},{"Name":"month","Type":"string"}]'
location:
type: cur.location
description: 's3 path'
default: 's3://cid-{account_id}-shared/cur/'

# Refresh Schedules for QuickSight DataSets
schedules:
Expand All @@ -493,3 +645,45 @@ schedules:
Interval: DAILY
TimeOfTheDay: '02:00-05:00'
RefreshType: FULL_REFRESH

crawlers:
cur:
data:
Name: 'CidCurCrawler'
Description: A recurring crawler that keeps your CUR table in Athena up-to-date.
Role: ${crawler_role_arn}
DatabaseName: "${athena_database_name}"
Targets:
S3Targets:
- Path: ${location}
Exclusions:
- '**.json'
- '**.yml'
- '**.sql'
- '**.csv'
- '**.csv.metadata'
- '**.gz'
- '**.zip'
- '**/cost_and_usage_data_status/*'
- 'aws-programmatic-access-test-object'
SchemaChangePolicy:
DeleteBehavior: LOG
RecrawlPolicy:
RecrawlBehavior: CRAWL_EVERYTHING
Schedule: cron(0 2 * * ? *)
Configuration: |
{
"Version":1.0,
"Grouping": {
"TableGroupingPolicy": "CombineCompatibleSchemas"
},
"CrawlerOutput":{
"Tables":{
"AddOrUpdateBehavior":"MergeNewColumns"
}
}
}
parameters:
s3path:
default: 's3://cid-{account_id}-cur/cur/{account_id}/cid/cid'
description: Compute Optimiser EBS report S3 path
14 changes: 14 additions & 0 deletions cid/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,19 @@ def initqs(ctx, **kwargs):

ctx.obj.initqs(**kwargs)

@click.option('-v', '--verbose', count=True)
@cid_command
def init_cur(ctx, **kwargs):
"""Initialize CUR

\b

--enable-quicksight-enterprise (yes|no) Confirm the activation of QuickSight
--account-name NAME Unique QuickSight account name (Unique across all AWS users)
--notification-email EMAIL User's email for QuickSight notifications
"""

ctx.obj.init_cur(**kwargs)

if __name__ == '__main__':
main()
Loading