Difference between revisions of "Aws-ec2-describe-instances-all-regions"

From wikieduonline
Jump to navigation Jump to search
(Created page with " for region in `aws ec2 describe-regions --region us-east-1 --output text | cut -f4` do echo -e "\nListing Instances in region:'$region'..." aws ec2 describe-in...")
 
 
(24 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{lowercase}}
  
 +
Using <code>[[parallel]]</code>:
 +
[[aws ec2 describe-regions]] --query "Regions[].{Name:RegionName}" --output text | [[parallel]] [[aws ec2 describe-instances]] --region {}
  
  for region in `aws ec2 describe-regions --region us-east-1 --output text | cut -f4`
+
Using <code>[[for]]</code> expression:
do
+
  [[for]] region in `aws ec2 describe-regions --query "Regions[].{Name:RegionName}" --output text`; do
       echo -e "\nListing Instances in region:'$region'..."
+
       [[echo -e]] "\nListing Instances in region:'$region'..."
       aws ec2 describe-instances --region $region
+
       [[aws ec2 describe-instances]] --region $region
 
  done
 
  done
 +
 +
Prepending region name:
 +
aws ec2 describe-regions --query "Regions[].{Name:RegionName}" --output text |  parallel  "aws ec2 describe-instances --output text --region {} | sed s/^/{}\" \"/ "
 +
 +
 +
== Related ==
 +
* <code>aws ec2 describe-regions --all-regions --query "Regions[].{Name:RegionName}" --output text</code>
 +
* <code>[[aws ec2 describe-regions]] --query Regions[*].[RegionName] --output text</code>
 +
* <code>[[suaws]]</code>
 +
* <code>[[aws-all-regions]]</code>
 +
 +
== See also ==
 +
* {{aws ec2}}
 +
* {{EC2}}
 +
 +
[[Category:AWS]]
 +
[[Category:AWS CLI]]

Latest revision as of 16:24, 14 February 2022

Using parallel:

aws ec2 describe-regions --query "Regions[].{Name:RegionName}" --output text | parallel aws ec2 describe-instances --region {}

Using for expression:

for region in `aws ec2 describe-regions --query "Regions[].{Name:RegionName}" --output text`; do
     echo -e "\nListing Instances in region:'$region'..."
     aws ec2 describe-instances --region $region
done

Prepending region name:

aws ec2 describe-regions --query "Regions[].{Name:RegionName}" --output text |  parallel  "aws ec2 describe-instances --output text --region {} | sed s/^/{}\" \"/ "


Related[edit]

See also[edit]

Advertising: