What is the correct ways to write Boto3 filters to use customise tag name?

后端 未结 4 605
温柔的废话
温柔的废话 2020-12-17 15:51

I am trying to list the instances on tag values of different tag keys For eg> one tag key - Environment, other tag key - Role. My code is given below :

imp         


        
4条回答
  •  心在旅途
    2020-12-17 16:49

    In my own python script I use the following:

    import boto3
    ec2client = boto3.client('ec2','us-east-1')
    response = ec2client.describe_instances(Filters=[{'Name' : 'instance-state-name','Values' : ['running']}])
    

提交回复
热议问题