Skip to content

Instantly share code, notes, and snippets.

@adamcrosby
Created July 14, 2022 16:46
Show Gist options
  • Save adamcrosby/d49afb9a2ce39731a35e967b00b50e10 to your computer and use it in GitHub Desktop.
Save adamcrosby/d49afb9a2ce39731a35e967b00b50e10 to your computer and use it in GitHub Desktop.
Get EC2 instance ID from a 'Name' tag
SELECT
resourceId,
resourceName,
resourceType,
configuration.instanceType,
tags,
availabilityZone,
configuration.state.name
WHERE
resourceType = 'AWS::EC2::Instance'
AND tags.key = 'Name'
AND tags.value = 'SERVERNAME'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment