Closed RegisGraptin closed 1 week ago
Thanks for reaching out. Here are the available Boto3 paginators for Lambda: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#paginators . Note there is no list_coverage
paginator. If you're using a different paginator, could you provide a complete snippet showing that?
Also if you could share debug logs (with any sensitive info redacted) by adding boto3.set_stream_logger('')
to your script then that could help with further investigation as well.
It looks like you're probably trying to use this inspector2
paginator: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/inspector2/paginator/ListCoverage.html . Can you confirm?
import boto3
client = boto3.client('inspector2')
paginator = client.get_paginator('list_coverage')
response_iterator = paginator.paginate(
filterCriteria={
'resourceType': [
{
'comparison': 'EQUALS',
'value': 'AWS_LAMBDA_FUNCTION'
},
],
'lambdaFunctionRuntime': [
{
'comparison': 'EQUALS',
'value': 'PYTHON_3_9'
},
{
'comparison': 'EQUALS',
'value': 'PYTHON_3_8'
},
]
}
)
for page in response_iterator:
print(page)
Hello @tim-finnigan, thanks for your quick answer.
Yes I confirm, I am using the inspector2
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/inspector2/client/list_coverage.html
@RegisGraptin thanks for confirming. Can you share the full code snippet you're using, along with debug logs (with any sensitive info redacted) by adding boto3.set_stream_logger('')
to your script to help with further investigation?
@tim-finnigan there it is
Thanks for following up. It looks like the lambdaFunctionRuntime
filter just does not get applied, for example calling the API via a CLI command:
aws inspector2 list-coverage \
--filter-criteria '{"resourceType":[{"comparison":"EQUALS","value":"AWS_LAMBDA_FUNCTION"}],"lambdaFunctionRuntime":[{"comparison":"EQUALS","value":"PYTHON_3_9"},{"comparison":"EQUALS","value":"PYTHON_3_8"}]}' \
--query 'coveredResources[].resourceMetadata.lambdaFunction.runtime'
Results in:
[
"PYTHON_3_9",
"PYTHON_3_9",
"PYTHON_3_7",
"PYTHON_3_9",
"PYTHON_3_9",
"PYTHON_3_9",
"NODEJS_16_X",
"NODEJS_14_X",
...
I'll try reaching out to the Inspector team for more info regarding this behavior, as it is an issue with the API filters/response rather than the Boto3 SDK directly.
We heard back from the service team who acknowledged the issue and is working on a fix.
We were informed that the fix is currently being deployed. Once the API fix is released, then the filter should be working.
Upon testing I can confirm that this filter issue now appears resolved on the API side, so the correct results should be returning for you. If you're still seeing any incorrect results please let us know, otherwise I think this can be closed as resolved.
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.
Describe the bug
I am currently using AWS Lambda to retrieve the Lambda Function from AWS. I would like to apply a filter on it using the
lambdaFunctionRuntime
. However, when applying it, it seems the filter is not taken into consideration. For instance, I have the following filters (that I am using infilterCriteria
for thelist_coverage
function):However, when using it, I have a bunch of lambda resource with different runtime as node and other python version.
Expected Behavior
By applying the filter, I should only have lambda function resource with the runtime matching the configuration. If I took my previous example, in the API response, we should have
PYTHON_3_9
andPYTHON_3_8
.Current Behavior
Currently, it seems the filter is not working for the
list_coverage
function on thelambdaFunctionRuntime
.Reproduction Steps
Possible Solution
I think it is related to the API endpoint, not taking into consideration this filter.
Additional Information/Context
No response
SDK version used
1.34.111
Environment details (OS name and version, etc.)
Ubuntu - Python 3.12.3