Run the following bash commands using the AWS CLI v2. ## Count all resources in stack ```sh aws cloudformation list-stack-resources --stack-name YOUR_STACK_NAME_HERE --max-items 500 | jq '.StackResourceSummaries | length' ``` ## Count resources of specific type ```sh aws cloudformation list-stack-resources --stack-name YOUR_STACK_NAME_HERE --max-items 500 --query "StackResourceSummaries[?ResourceType=='AWS::IAM::Role']" | jq '. | length' ``` ## Count resources with logical ID suffix ```sh aws cloudformation list-stack-resources --stack-name YOUR_STACK_NAME_HERE --max-items 500 | jq '[.StackResourceSummaries[] | select(.LogicalResourceId | endswith("IamRoleLambdaExecution"))] | length' ```