title: What's the preferred way to get a specific tag from an instance?
body: <p>I'm tagging EBS snapshots based on the <code>Name</code> of the <code>instance-id</code> from which the <code>vol-id</code> is attached.</p>
  
  <pre><code>import boto3
  client = boto3.client('ec2')
  
  def lambda_handler(event, context):
      source_volume = event["detail"]["source"]
      source_volume_id = 'vol-' + source_volume.split('vol-', 1)[1]
      volume_detail = client.describe_volumes(
          VolumeIds=[
              source_volume_id,
          ]
      )
  
      instance = client.describe_instances(
          InstanceIds=[
              volume_detail['Volumes'][0]['Attachments'][0]['InstanceId']
          ]
      )
      for pair in instance['Reservations'][0]['Instances'][0]['Tags']:
          if pair['Key'] == 'Name' and pair['Value'] == 'my-tag':
              return pair
  </code></pre>
  
  <p>I'd like to eliminate the looping if possible - is there a way to query just the specific tag, <code>Name</code>, from my instance?</p>