aws ec2 describe-instances --filters

1

Hi, am wondering if applying filters on aws cli "ec2 describe-instances --filters [] " would filter the result set before fetching it over the network or at the client? E.g., I have 10 instances in my account, of which only 5 are 'Running' and I want to see the details of only those. My understanding after reading the docs in this case is that, backend API would simply fetch everything and filters would be applied at the client before displaying results. This means bringing over unnecessary data over the network. Is this the right understanding? If so, is there any way to "run filter at source itself"?

AWS
Vish_t
질문됨 2년 전1086회 조회
1개 답변
1
수락된 답변

The --filter(s) parameter uses server-side filtering, returning only the data with matching results.

In contrast, the --query parameter utilises client-side filtering, returning all data to the client prior to matching.

For more info, take a look at https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-filter.html

AWS
bendutt
답변함 2년 전
  • Thanks, it helps. I'm pasting a sample code from boto3 docs,

    instances = ec2.instances.filter( Filters=[{'Name': 'instance-state-name', 'Values': ['running']}])

    Can I assume that this 'filter' would work the same way, since both use the same backend API?

  • Yes, that would be using server-side filtering

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠