AWS instance id, ami id and creation date using shell script with array usage and for loop.
region_name=("us-east-1" "eu-north-1" "ap-south-1" "eu-west-3" "eu-west-2" "eu-west-1" "ap-northeast-3" "ap-northeast-2" "ap-northeast-1" "sa-east-1" "ca-central-1" "ap-southeast-1" "ap-southeast-2" "eu-central-1" "us-east-1" "us-east-2" "us-west-1" "us-west-2") for region in "${region_name[@]}" do : array_us_east_1=($(aws ec2 describe-instances --filters Name=instance-state-name,Values=running,stopped --query "Reservations[*].Instances[*].InstanceId" --output text --region $region)) for instance_id in "${array_us_east_1[@]}" do : echo "InstanceId :" $instance_id ami_id_us_east_1=($(aws ec2 describe-instances --instance-id $instance_id --region $region --query Reservations[].Instances[].[ImageId] --output text)) for ami_id in "${ami_id_us_eas...