I'm looking for a way to mimic the AWS CLI EC2 Filter using Boto3 let say i want to translate the filters portion of describe-instances command:
aws ec2 describe-instances --filters "Name=instance-
type,Values=m1.small,t2.small"
into Boto3 describe_instances method:
response = client.describe_instances(
Filters=[
{
'Name': 'instance- type',
'Values': [
'm1.small','t2.small',
]
}
]
)
So basically what i'm asking, what is good why in python to take the string:
"Name=instance-type,Values=m1.small,t2.small"
and convert it to:
[
{
'Name': 'instance- type',
'Values': [
'm1.small','t2.small',
]
}
]
so that i can use it as a filter parameter in boto3's decribe_instances method.