I'm working with Boto3 for AWS for my current project. I need to have a few different describe_images arguments for EC2 as optional and I can't use wildcard or empty inputs to get around having them in or not. I'm looking for a way for add arguments being passed as needed rather than having to do a number of if
checks with slightly different content.
For example, take the snippet below. I'd like for the Owners
and ImageIds
arguments to be dynamically added if they are provided upstream but not include them if they aren't. I haven't had any luck with Google yet so figured I would ask make a quick post.
response = ec2.describe_images(
ExecutableUsers=['all'],
Filters=search_filters,
Owners=['309956199498'],
ImageIds=['ami-26ebbc5c']
)
Thanks