# The maximum length for a filter value is 255 characters

**URL:** <https://forum.ansible.com/t/the-maximum-length-for-a-filter-value-is-255-characters/10969>\
**Category:** Get Help\
**Tags:** playbook, ubuntu, ansible-core\
**Created:** [November 18, 2024, 6:18am UTC](https://forum.ansible.com/t/the-maximum-length-for-a-filter-value-is-255-characters/10969 "2024-11-18T06:18:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![igorc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/igorc/32/5491_2.png) [@igorc](https://forum.ansible.com/u/igorc)\
**Post date:** [November 18, 2024, 6:18am UTC](https://forum.ansible.com/t/the-maximum-length-for-a-filter-value-is-255-characters/10969/1 "2024-11-18T06:18:26Z")

</div>

Hi all,

I’m getting the following error with the latest `2.16` and 2.17` when trying to create EC2 instance:

```auto
botocore.exceptions.ClientError: An error occurred (FilterLimitExceeded) when calling the DescribeInstances operation: The maximum length for a filter value is 255 characters

```

using the `ec2_instance` module:

```auto
  - name: launch ec2 instance
    ec2_instance:
      state: "running"
      region: "{{ region }}"
      key_name: "{{ keypair }}"
      network:
         assign_public_ip: true
         groups: "{{ group }}"
      instance_type: "{{ ec2_instance_type }}"
      vpc_subnet_id: "{{ vpc_subnet }}"
      image_id: "{{ image_id }}"

```

Seems the module is running `DescribeInstances` at some point and failing due to the filter expression being over `255` characters long, as per my understanding.

Anyone has any idea why is this happening?

List of python modules:

```auto
$ pip3 list
Package Version
--------------- -----------
ansible 10.6.0
ansible-core 2.17.6
boto3 1.35.63
botocore 1.35.63
cffi 1.17.1
cryptography 43.0.3
Jinja2 3.1.4
jmespath 1.0.1
MarkupSafe 3.0.2
packaging 24.2
pip 24.0
pycparser 2.22
python-dateutil 2.9.0.post0
PyYAML 6.0.2
resolvelib 1.0.1
s3transfer 0.10.3
six 1.16.0
urllib3 2.2.3

```

The OS is `Ubuntu-24.04.1` running Python `3.12.3`

Thanks in advance for your input.
