Skip to content

Instantly share code, notes, and snippets.

@CodeFreezr
Created September 24, 2019 17:14
Show Gist options
  • Save CodeFreezr/b0bc68331021cac1761e38ccc4f2071f to your computer and use it in GitHub Desktop.
Save CodeFreezr/b0bc68331021cac1761e38ccc4f2071f to your computer and use it in GitHub Desktop.
List all EC2 Instance which are created by a CF-Stack (long running)
for stack in $(aws cloudformation list-stacks --stack-status-filter CREATE_COMPLETE UPDATE_COMPLETE | jq -r '.StackSummaries[].StackName'); do aws cloudformation describe-stack-resources --stack-name $stack | jq -r '.StackResources[] | select (.ResourceType=="AWS::EC2::Instance")|.PhysicalResourceId'; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment