Difference between revisions of "Aws ec2 describe-instances"
Jump to navigation
Jump to search
Line 14: | Line 14: | ||
* <code>aws ec2 describe-instances [[--region]] [[us-west-1]]</code> | * <code>aws ec2 describe-instances [[--region]] [[us-west-1]]</code> | ||
* <code>aws ec2 describe-instance --filter "Name=tag:Name,Values=YOUR-TAG-NAME" --query "Reservations[].Instances[?State.Name == 'running'].InstanceId[]" --output text)</code> | * <code>aws ec2 describe-instance --filter "Name=tag:Name,Values=YOUR-TAG-NAME" --query "Reservations[].Instances[?State.Name == 'running'].InstanceId[]" --output text)</code> | ||
+ | [[Security Group]] | ||
+ | * <code>aws ec2 describe-instances | grep "GroupName|GroupId"</code> | ||
State: | State: |
Revision as of 16:10, 22 June 2022
https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html
Examples
aws ec2 describe-instances
aws ec2 describe-instances --instance-ids
aws ec2 describe-instances | grep InstanceType
aws ec2 describe-instances | grep AvailabilityZone
aws ec2 describe-instances | egrep "InstanceId|InstanceType|running"
aws ec2 describe-instances | egrep "InstanceId|YOUR_INSTANCE_NAME"
aws ec2 describe-instances | grep -A1 '"Key": "Name"'
aws ec2 describe-instances --output text | egrep -w "Name|PLACEMENT"
aws ec2 describe-instances --region us-west-1
aws ec2 describe-instance --filter "Name=tag:Name,Values=YOUR-TAG-NAME" --query "Reservations[].Instances[?State.Name == 'running'].InstanceId[]" --output text)
aws ec2 describe-instances | grep "GroupName|GroupId"
State:
aws ec2 describe-instances | grep -iA2 -w state | grep Name
export INSTANCE_ID=$(aws ec2 run-instances .../... | jq -r '.Instances[].InstanceId')
Basic commands
aws ec2 describe-instances
An error occurred (AuthFailure) when calling the DescribeInstances operation: AWS was not able to validate the provided access credential
Solution: Review configuration with aws configure list
aws ec2 describe-instances --profile YOUR_PROFILE
Related commands
aws ec2 run-instances
aws ec2 describe-addresses
aws ec2 describe-instance-types
aws ec2 describe-network-interfaces
tags
aws list all
--region
aws-ec2-describe-instances-all-regions
aws ssm start-session
aws ssm get-inventory
See also
- AWS EC2, AWS::EC2,
aws ec2
[describe-instances | describe-instance-status
|run-instances | terminate-instances | stop-instances
|tags
|describe-vpcs
|describe-addresses
|describe-availability-zones
|describe-subnets
|import-key-pair
|create-key-pair
|create-vpc
|create-internet-gateway
|modify-instance-attribute | ec2-instance-connect | get-console-output
] - AWS EC2, Amazon EC2 API,
aws ec2, AWS::EC2
, Amazon EC2 Spot Instances, CPU credits, Instance type, EC2 limitations, 169.254.169.254, Instance metadata and user data (IMDS),InstanceType, InstanceId
, Amazon EC2 Auto Scaling, AWS EC2 Instance Connect, launch template, lifecycle, AWS Security group (SG), Amazon EC2 Recycle Bin, Amazon EC2 Mac Instances, Global View
Advertising: