AWS get list of ec2 ids by beanstalk environment name

Task: Get list of EC2 instances Id(s) by beanstalk environment name

Solution:

envname="wp-env"
for ec2Id in $(aws elasticbeanstalk describe-environment-resources --environment-name $envname --output text --query 'EnvironmentResources.Instances[*].Id') ; do 
  echo $ec2Id
done

Done.

Leave a Reply

Your email address will not be published. Required fields are marked *

  +  30  =  39

Skynin cache:
Array ( [cache mode] => capture [requestKey] => 101889d083002e26e82a096292c152637c6.sc [skycache_disable_capture] => false )