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

aws.service-quota usage-filter exception #7683

Open
palmobar opened this issue Aug 24, 2022 · 1 comment
Open

aws.service-quota usage-filter exception #7683

palmobar opened this issue Aug 24, 2022 · 1 comment
Labels

Comments

@palmobar
Copy link

Describe the bug

In here https://github.com/cloud-custodian/cloud-custodian/blob/master/c7n/resources/quotas.py#L179 you set the period to whatever is in the Period field but you hardcode the time range to be one day. This results in the following error:

  File "/Users/meme/foobar/.venv/lib/python3.9/site-packages/c7n/resources/quotas.py", line 184, in process
    res = client.get_metric_statistics(
  File "/Users/meme/foobar/.venv/lib/python3.9/site-packages/botocore/client.py", line 508, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/meme/foobar/.venv/lib/python3.9/site-packages/botocore/client.py", line 915, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidParameterCombinationException: An error occurred (InvalidParameterCombination) when calling the GetMetricStatistics operation: You have requested up to 86400 datapoints, which exceeds the limit of 1440. You may reduce the datapoints requested by increasing Period, or decreasing the time range.

when the period is (for example L-6621E65D quota):

    "Period": {
      "PeriodValue": 1,
      "PeriodUnit": "SECOND"
    },

What did you expect to happen?

I expected Cloud Custodian to keep its cool.

Cloud Provider

Amazon Web Services (AWS)

Cloud Custodian version and dependency information

Custodian:   0.9.18
Python:      3.9.13 (main, May 24 2022, 21:13:51)
             [Clang 13.1.6 (clang-1316.0.21.2)]
Platform:    posix.uname_result(sysname='Darwin', nodename='FVFFT0KLQ05Q', release='21.6.0', version='Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:35 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T8101', machine='arm64')
Using venv:  True
Docker: False
Installed:

argcomplete==2.0.0
attrs==22.1.0
boto3==1.24.44
botocore==1.27.44
docutils==0.17.1
importlib-metadata==4.12.0
jmespath==1.0.1
jsonschema==4.9.0
pyrsistent==0.18.1
python-dateutil==2.8.2
pyyaml==6.0
s3transfer==0.6.0
six==1.16.0
tabulate==0.8.10
urllib3==1.26.11
zipp==3.8.1


### Policy

```shell
---
policies:
    - name: service-quota-usage-limit
      description: |
          find any services that have usage stats of
          over 80%
      resource: aws.service-quota
      filters:
        - UsageMetric: present
        - type: usage-metric
          limit: 99


### Relevant log/traceback output

```shell
File "/Users/meme/foobar/.venv/lib/python3.9/site-packages/c7n/resources/quotas.py", line 184, in process
    res = client.get_metric_statistics(
  File "/Users/meme/foobar/.venv/lib/python3.9/site-packages/botocore/client.py", line 508, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/meme/foobar/.venv/lib/python3.9/site-packages/botocore/client.py", line 915, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidParameterCombinationException: An error occurred (InvalidParameterCombination) when calling the GetMetricStatistics operation: You have requested up to 86400 datapoints, which exceeds the limit of 1440. You may reduce the datapoints requested by increasing Period, or decreasing the time range.


### Extra information or context

_No response_
@kapilt
Copy link
Collaborator

kapilt commented Aug 24, 2022

@thisisshi ping also #7140

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants