ScAlAn

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 *

1  +  9  =