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

Add table aws_costoptimizationhub_recommendation Closes #2350 #2355

Merged
merged 3 commits into from
Jan 2, 2025

Conversation

ParthaI
Copy link
Contributor

@ParthaI ParthaI commented Dec 16, 2024

Integration test logs

Logs
Add passing integration test logs here

Example query results

Results
> select * from aws_costoptimizationhub_recommendation
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
| recommendation_id                                                    | resource_arn                                                     | resource_id           | recommendation_account_id | action_type | currency_code | current_resource_summary | current_resource_typ>
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
| NjMyOTAyMTUyNTI4XzA4YTc5M2ZjLTBjMjQtNDVhMS05ZTQyLWUxZjdhOGZjMGZjZQ== | arn:aws:ec2:ap-south-1:xxxxxxxxxxxx:volume/vol-0baedb01b8608c09c | vol-0baedb01b8608c09c | xxxxxxxxxxxx              | Delete      | USD           | vol-0baedb01b8608c09c    | EbsVolume           >
| NjMyOTAyMTUyNTI4X2VkYWM3ZDU0LTRhOTktNGY1Ni05MzU1LTIzYjIwMjFjOWJkMw== | arn:aws:ec2:ap-south-1:xxxxxxxxxxxx:volume/vol-09443fa4ca00fc5b5 | vol-09443fa4ca00fc5b5 | xxxxxxxxxxxx              | Delete      | USD           | vol-09443fa4ca00fc5b5    | EbsVolume           >
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->

> select * from aws_costoptimizationhub_recommendation where action_type = 'Delete'
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
| recommendation_id                                                    | resource_arn                                                     | resource_id           | recommendation_account_id | action_type | currency_code | current_resource_summary | current_resource_typ>
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
| NjMyOTAyMTUyNTI4X2VkYWM3ZDU0LTRhOTktNGY1Ni05MzU1LTIzYjIwMjFjOWJkMw== | arn:aws:ec2:ap-south-1:xxxxxxxxxxxx:volume/vol-09443fa4ca00fc5b5 | vol-09443fa4ca00fc5b5 | xxxxxxxxxxxx              | Delete      | USD           | vol-09443fa4ca00fc5b5    | EbsVolume           >
| NjMyOTAyMTUyNTI4XzA4YTc5M2ZjLTBjMjQtNDVhMS05ZTQyLWUxZjdhOGZjMGZjZQ== | arn:aws:ec2:ap-south-1:xxxxxxxxxxxx:volume/vol-0baedb01b8608c09c | vol-0baedb01b8608c09c | xxxxxxxxxxxx              | Delete      | USD           | vol-0baedb01b8608c09c    | EbsVolume           >
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
> select * from aws_costoptimizationhub_recommendation where action_type = 'create'

Error: aws: operation error Cost Optimization Hub: ListRecommendations, https response error StatusCode: 400, RequestID: af264a5f-e456-482c-816d-9aad7a6b917d, ValidationException: Input validation failed. Please check the field list for more details. (SQLSTATE HV000)

+-------------------+--------------+-------------+---------------------------+-------------+---------------+--------------------------+-----------------------+------------------------+---------------------------+------------------------------+-----------------------+-->
| recommendation_id | resource_arn | resource_id | recommendation_account_id | action_type | currency_code | current_resource_summary | current_resource_type | estimated_monthly_cost | estimated_monthly_savings | estimated_savings_percentage | implementation_effort | l>
+-------------------+--------------+-------------+---------------------------+-------------+---------------+--------------------------+-----------------------+------------------------+---------------------------+------------------------------+-----------------------+-->
+-------------------+--------------+-------------+---------------------------+-------------+---------------+--------------------------+-----------------------+------------------------+---------------------------+------------------------------+-----------------------+-->
> select * from aws_costoptimizationhub_recommendation where action_type = 'Create'

Error: aws: operation error Cost Optimization Hub: ListRecommendations, https response error StatusCode: 400, RequestID: 5cdc2825-3be0-43a2-9833-b41a302a7aef, ValidationException: Input validation failed. Please check the field list for more details. (SQLSTATE HV000)

+-------------------+--------------+-------------+---------------------------+-------------+---------------+--------------------------+-----------------------+------------------------+---------------------------+------------------------------+-----------------------+-->
| recommendation_id | resource_arn | resource_id | recommendation_account_id | action_type | currency_code | current_resource_summary | current_resource_type | estimated_monthly_cost | estimated_monthly_savings | estimated_savings_percentage | implementation_effort | l>
+-------------------+--------------+-------------+---------------------------+-------------+---------------+--------------------------+-----------------------+------------------------+---------------------------+------------------------------+-----------------------+-->
+-------------------+--------------+-------------+---------------------------+-------------+---------------+--------------------------+-----------------------+------------------------+---------------------------+------------------------------+-----------------------+-->
> select * from aws_costoptimizationhub_recommendation where recommendation_id = 'NjMyOTAyMTUyNTI4XzA4YTc5M2ZjLTBjMjQtNDVhMS05ZTQyLWUxZjdhOGZjMGZjZQ=='
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
| recommendation_id                                                    | resource_arn                                                     | resource_id           | recommendation_account_id | action_type | currency_code | current_resource_summary | current_resource_typ>
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
| NjMyOTAyMTUyNTI4XzA4YTc5M2ZjLTBjMjQtNDVhMS05ZTQyLWUxZjdhOGZjMGZjZQ== | arn:aws:ec2:ap-south-1:xxxxxxxxxxxx:volume/vol-0baedb01b8608c09c | vol-0baedb01b8608c09c | xxxxxxxxxxxx              | Delete      | USD           | vol-0baedb01b8608c09c    | EbsVolume           >
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
> .timing onn
Error: valid values for this command are [off on verbose] - got onn
> .timing on
> select * from aws_costoptimizationhub_recommendation where recommendation_id = 'NjMyOTAyMTUyNTI4XzA4YTc5M2ZjLTBjMjQtNDVhMS05ZTQyLWUxZjdhOGZjMGZjZQ=='
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
| recommendation_id                                                    | resource_arn                                                     | resource_id           | recommendation_account_id | action_type | currency_code | current_resource_summary | current_resource_typ>
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
| NjMyOTAyMTUyNTI4XzA4YTc5M2ZjLTBjMjQtNDVhMS05ZTQyLWUxZjdhOGZjMGZjZQ== | arn:aws:ec2:ap-south-1:xxxxxxxxxxxx:volume/vol-0baedb01b8608c09c | vol-0baedb01b8608c09c | xxxxxxxxxxxx              | Delete      | USD           | vol-0baedb01b8608c09c    | EbsVolume           >
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->

Time: 0.8s. Rows returned: 0. Rows fetched: 1. Hydrate calls: 2.
> select * from aws_costoptimizationhub_recommendation where recommendation_account_id = 'xxxxxxxxxxxx'
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
| recommendation_id                                                    | resource_arn                                                     | resource_id           | recommendation_account_id | action_type | currency_code | current_resource_summary | current_resource_typ>
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
| NjMyOTAyMTUyNTI4X2VkYWM3ZDU0LTRhOTktNGY1Ni05MzU1LTIzYjIwMjFjOWJkMw== | arn:aws:ec2:ap-south-1:xxxxxxxxxxxx:volume/vol-09443fa4ca00fc5b5 | vol-09443fa4ca00fc5b5 | xxxxxxxxxxxx              | Delete      | USD           | vol-09443fa4ca00fc5b5    | EbsVolume           >
| NjMyOTAyMTUyNTI4XzA4YTc5M2ZjLTBjMjQtNDVhMS05ZTQyLWUxZjdhOGZjMGZjZQ== | arn:aws:ec2:ap-south-1:xxxxxxxxxxxx:volume/vol-0baedb01b8608c09c | vol-0baedb01b8608c09c | xxxxxxxxxxxx              | Delete      | USD           | vol-0baedb01b8608c09c    | EbsVolume           >
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->

Time: 0.9s. Rows returned: 0. Rows fetched: 2. Hydrate calls: 4.
> select * from aws_costoptimizationhub_recommendation where recommendation_account_id = '632902152524'
+-------------------+--------------+-------------+---------------------------+-------------+---------------+--------------------------+-----------------------+------------------------+---------------------------+------------------------------+-----------------------+-->
| recommendation_id | resource_arn | resource_id | recommendation_account_id | action_type | currency_code | current_resource_summary | current_resource_type | estimated_monthly_cost | estimated_monthly_savings | estimated_savings_percentage | implementation_effort | l>
+-------------------+--------------+-------------+---------------------------+-------------+---------------+--------------------------+-----------------------+------------------------+---------------------------+------------------------------+-----------------------+-->
+-------------------+--------------+-------------+---------------------------+-------------+---------------+--------------------------+-----------------------+------------------------+---------------------------+------------------------------+-----------------------+-->

Time: 461ms. Rows returned: 0.
> select * from aws_costoptimizationhub_recommendation where current_resource_type = 'EC2'

Error: aws: operation error Cost Optimization Hub: ListRecommendations, https response error StatusCode: 400, RequestID: 566118dd-fe5d-423b-8b8b-3a16275643bd, ValidationException: Input validation failed. Please check the field list for more details. (SQLSTATE HV000)

+-------------------+--------------+-------------+---------------------------+-------------+---------------+--------------------------+-----------------------+------------------------+---------------------------+------------------------------+-----------------------+-->
| recommendation_id | resource_arn | resource_id | recommendation_account_id | action_type | currency_code | current_resource_summary | current_resource_type | estimated_monthly_cost | estimated_monthly_savings | estimated_savings_percentage | implementation_effort | l>
+-------------------+--------------+-------------+---------------------------+-------------+---------------+--------------------------+-----------------------+------------------------+---------------------------+------------------------------+-----------------------+-->
+-------------------+--------------+-------------+---------------------------+-------------+---------------+--------------------------+-----------------------+------------------------+---------------------------+------------------------------+-----------------------+-->

Time: 470ms. Rows returned: 0.
> select * from aws_costoptimizationhub_recommendation where current_resource_type = 'EbsVolume'
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
| recommendation_id                                                    | resource_arn                                                     | resource_id           | recommendation_account_id | action_type | currency_code | current_resource_summary | current_resource_typ>
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->
| NjMyOTAyMTUyNTI4X2VkYWM3ZDU0LTRhOTktNGY1Ni05MzU1LTIzYjIwMjFjOWJkMw== | arn:aws:ec2:ap-south-1:xxxxxxxxxxxx:volume/vol-09443fa4ca00fc5b5 | vol-09443fa4ca00fc5b5 | xxxxxxxxxxxx              | Delete      | USD           | vol-09443fa4ca00fc5b5    | EbsVolume           >
| NjMyOTAyMTUyNTI4XzA4YTc5M2ZjLTBjMjQtNDVhMS05ZTQyLWUxZjdhOGZjMGZjZQ== | arn:aws:ec2:ap-south-1:xxxxxxxxxxxx:volume/vol-0baedb01b8608c09c | vol-0baedb01b8608c09c | xxxxxxxxxxxx              | Delete      | USD           | vol-0baedb01b8608c09c    | EbsVolume           >
+----------------------------------------------------------------------+------------------------------------------------------------------+-----------------------+---------------------------+-------------+---------------+--------------------------+--------------------->

Time: 0.9s. Rows returned: 0. Rows fetched: 2. Hydrate calls: 4.
> 

@ParthaI ParthaI requested a review from misraved December 16, 2024 07:42
@ParthaI ParthaI self-assigned this Dec 16, 2024
@ParthaI ParthaI marked this pull request as draft December 16, 2024 07:43
@ParthaI ParthaI linked an issue Dec 16, 2024 that may be closed by this pull request
@misraved
Copy link
Contributor

@ParthaI should the table name be aws_cost_optimization_hub_recommendation?

@ParthaI
Copy link
Contributor Author

ParthaI commented Dec 17, 2024

@misraved, I named it by following the Terraform naming convention, which we typically use as our first choice. Reference: Terraform Cost Optimization Hub Preferences.

Do you think we still need to rename it?

@ParthaI ParthaI marked this pull request as ready for review December 17, 2024 15:30
@misraved misraved merged commit 827f790 into main Jan 2, 2025
1 check passed
@misraved misraved deleted the issue-2350 branch January 2, 2025 07:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create a table for AWS Cost Optimization Hub recommendations
2 participants