Skip to content

Instantly share code, notes, and snippets.

@santrancisco
Created May 22, 2025 14:53
Show Gist options
  • Save santrancisco/0064af67a4ba795c8d2629649738c69b to your computer and use it in GitHub Desktop.
Save santrancisco/0064af67a4ba795c8d2629649738c69b to your computer and use it in GitHub Desktop.
enumerate services in all regions in aws (to simulate recon actions)
#!/bin/bash
# Get list of all available regions
#REGIONS=$(aws ec2 describe-regions --query "Regions[*].RegionName" --output text)
REGIONS="ap-south-1 eu-north-1 eu-west-3 eu-west-2 eu-west-1 ap-northeast-3 ap-northeast-2 ap-northeast-1 ca-central-1 sa-east-1 ap-east-1 ap-southeast-1 ap-southeast-2 eu-central-1 us-east-1 us-east-2 us-west-1 us-west-2"
# A curated list of AWS services with test CLI commands
declare -A SERVICES=(
[ec2]="aws ec2 describe-instances --region REGION"
[s3]="aws s3api list-buckets"
[lambda]="aws lambda list-functions --region REGION"
[iam]="aws iam list-users"
[dynamodb]="aws dynamodb list-tables --region REGION"
[sns]="aws sns list-topics --region REGION"
[sqs]="aws sqs list-queues --region REGION"
[cloudformation]="aws cloudformation list-stacks --region REGION"
[cloudwatch]="aws cloudwatch list-metrics --region REGION"
[ecr]="aws ecr describe-repositories --region REGION"
[ecs]="aws ecs list-clusters --region REGION"
[eks]="aws eks list-clusters --region REGION"
[rds]="aws rds describe-db-instances --region REGION"
[apigateway]="aws apigateway get-rest-apis --region REGION"
[secretsmanager]="aws secretsmanager list-secrets --region REGION"
[ssm]="aws ssm describe-parameters --region REGION"
[eventbridge]="aws events list-rules --region REGION"
[stepfunctions]="aws stepfunctions list-state-machines --region REGION"
[kinesis]="aws kinesis list-streams --region REGION"
[logs]="aws logs describe-log-groups --region REGION"
)
for REGION in $REGIONS; do
echo ""
echo "🔍 Enumerating services in region: $REGION"
echo "-----------------------------------------"
for SERVICE in "${!SERVICES[@]}"; do
CMD="${SERVICES[$SERVICE]//REGION/$REGION}"
echo -n " - $SERVICE: "
if OUTPUT=$(eval "$CMD" 2>/dev/null); then
echo "✅ Available"
else
echo "❌ Not available or no permission"
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment