Editing Aws ec2 describe-instances

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 2: Line 2:
 
https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html
 
https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html
 
== Examples ==
 
== Examples ==
* <code>[[Example output: aws ec2 describe-instances]]</code>
+
* <code>[[aws ec2]] describe-instances</code>
 
* <code>[[aws ec2]] describe-instances [[--instance-ids]] </code>
 
* <code>[[aws ec2]] describe-instances [[--instance-ids]] </code>
 
* <code>aws ec2 describe-instances | grep [[InstanceType]]</code>
 
* <code>aws ec2 describe-instances | grep [[InstanceType]]</code>
 
* <code>aws ec2 describe-instances | grep [[AvailabilityZone]]</code>
 
* <code>aws ec2 describe-instances | grep [[AvailabilityZone]]</code>
* <code>aws ec2 describe-instances | egrep "[[InstanceId]]|[[InstanceType]]|[[running]]"</code>
+
* <code>aws ec2 describe-instances | egrep "[[InstanceId]]|InstanceType|running"</code>
 
* <code>aws ec2 describe-instances | egrep "InstanceId|YOUR_INSTANCE_NAME"</code>
 
* <code>aws ec2 describe-instances | egrep "InstanceId|YOUR_INSTANCE_NAME"</code>
 
* <code>aws ec2 describe-instances | [[grep -A1]] '"Key": "Name"'</code>
 
* <code>aws ec2 describe-instances | [[grep -A1]] '"Key": "Name"'</code>
Line 15: Line 15:
 
* <code>aws ec2 describe-instances | grep "[[GroupName]]|[[GroupId]]"</code>
 
* <code>aws ec2 describe-instances | grep "[[GroupName]]|[[GroupId]]"</code>
  
=== List [[Instance ID]], [[Type]], status and [[Name]] ===
+
=== List [[Instance ID]], [[Type]] and [[Name]] ===
  aws ec2 describe-instances | [[jq -r]] '.Reservations[].Instances[]|.InstanceId+" "+.InstanceType+" "+.State.Name+" "+(.Tags[] | select(.Key == "Name").Value)'
+
  aws ec2 describe-instances | jq -r '.Reservations[].Instances[]|.InstanceId+" "+.InstanceType+" "+.State.Name+" "+(.Tags[] | select(.Key == "Name").Value)'
 
   
 
   
  i-001d6ef48fd7da240 [[t3.xlarge]] [[stopped]] YourExample-[[workers]]-Node
+
  i-001d6ef48fd7da240 [[t3.xlarge]] YourExample-[[workers]]-Node
  i-00b1cf99a8fd118aa [[t2.large]] [[running]] your-machine-name
+
  i-00b1cf99a8fd118aa [[t2.large]] your-machine-name
  i-0a81356d71229695f t3.xlarge [[terminated]] YourExample-[[workers]]-Node
+
  i-0a81356d71229695f t3.xlarge YourExample-[[workers]]-Node
 
<ref>https://www.bluematador.com/learn/aws-cli-cheatsheet</ref>
 
<ref>https://www.bluematador.com/learn/aws-cli-cheatsheet</ref>
  
Line 33: Line 33:
 
  [[aws ec2]] describe-instances --query 'Reservations[*].Instances[?not_null(PublicIpAddress)]' | jq -r '.[][].PublicIpAddress'
 
  [[aws ec2]] describe-instances --query 'Reservations[*].Instances[?not_null(PublicIpAddress)]' | jq -r '.[][].PublicIpAddress'
  
=== [[State]] ===
+
=== State ===
  [[aws ec2 describe-instances]] | grep -iA2 -w state | grep Name
+
  aws ec2 describe-instances | grep -iA2 -w state | grep Name
  
 
  export INSTANCE_ID=$(aws ec2 run-instances .../... | [[jq -r]] '.Instances[].InstanceId')
 
  export INSTANCE_ID=$(aws ec2 run-instances .../... | [[jq -r]] '.Instances[].InstanceId')
Line 56: Line 56:
 
* <code>[[aws ssm start-session]]</code>
 
* <code>[[aws ssm start-session]]</code>
 
* <code>[[aws ssm get-inventory]]</code>
 
* <code>[[aws ssm get-inventory]]</code>
* <code>[[aws ec2 get-console-output]]</code>
 
* [[GCP]]: <code>[[gcloud compute instances list]]</code>
 
* <code>[[aws ec2 describe-instance-status]]</code>
 
  
 
== See also ==
 
== See also ==

Please note that all contributions to wikieduonline may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Wikieduonline:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)

Advertising: