Я использую boto3, чтобы получить все доступные Amazon AMI (общедоступные) с использованием фильтров. Я нашел client.describe_images (** kwargs) в документации по Boto3.Но я не могу применять фильтры.Вот 2 примера кода, пытающихся получить доступ к 1. всем AMI с Windows и 2. коду с OpenSUSE.Бото может получить все окна AMI, но не OpenSUSE.Я думаю, что я не понял, как использовать фильтры.Может кто-нибудь объяснить про фильтры в данном конкретном случае.
import boto3
client = boto3.client('ec2')
# Completed "aws configure" Access ID, Secret Key, Region in terminal
# I am Trying to get all the publicly available Windows AMI's
response = client.describe_images(
ExecutableUsers=[
'all',
],
Filters=[
{
'Name': 'platform',
'Values': [
'windows',
]
},
],
Owners=[
'679593333241', # all public ami's from amazon as owner
]
)
print(response)
# OUTPUT: I get a collection of available windows AMI
# A collection with all windows as its platfrom
# ----------------------Code 2-------------------------------------------
robot = boto3.client('ec2')
# Completed "aws configure" Access ID, Secret Key, Region in terminal
# I am Trying to get all the publicly available OpenSUSE AMI's
response2 = robot.describe_images(
ExecutableUsers=[
'all',
],
Filters=[
{
'Name': 'platform',
'Values': [
'OpenSUSE', # No response other than Windows
]
},
],
Owners=[
'679593333241',
],
)
print(response2)
# OUTPUT: I get empty collection
# A collection with all OpenSUSE as its platform is expected.