-->

DEVOPSZONES

  • Recent blogs

    Invalid type for parameter Filters[1].Values, value: sg-name, type: , valid types: ,

    Invalid type for parameter Filters[1].Values, value: sg-name, type: <type 'str'>, valid types: <type 'list'>, <type 'tuple'> 

    While Seraching for Security Groups in a lambda script, It was giving following error:


    botocore.exceptions.ParamValidationError: Parameter validation failed:

    Invalid type for parameter Filters[1].Values, value: default, type: <class 'str'>, valid types: <class 'list'>, <class 'tuple'>

    My Code looks like below:

    SecurityGroups=[sg['GroupId'] for sg in ec2.describe_security_groups(Filters=[{'Name': 'vpc-id',
    'Values': [vpc_id]},{'Name': 'group-name', 'Values': 'default'}])['SecurityGroups']],

    Solution:

    I was passing a string for the Values part of group-name, rather than a list of strings. The Solved code line should look like this.

    SecurityGroups=[sg['GroupId'] for sg in ec2.describe_security_groups(Filters=[{'Name': 'vpc-id',
    'Values': [vpc_id]},{'Name': 'group-name', 'Values': ['default']}])['SecurityGroups']],



    No comments