Command
aws ec2 describe-instancesExplanation
Retrieves information about running, stopped, or terminated EC2 instances.
Common Use Cases
- •Listing all running instances
- •Retrieving instance state, IP, and tags
Best Practices
- ✓Use filters (`--filters`) for faster, targeted results
- ✓Format results with `--query` and `--output` for clarity
Common Mistakes to Avoid
- ⚠Omitting region and getting empty response
- ⚠Expecting default output to be human-readable (use `--output table`)
Troubleshooting
Problem: Empty results
Solution: Verify the correct region and permissions.
Examples
List all EC2 instances
aws ec2 describe-instancesDescribe a specific instance
aws ec2 describe-instances --instance-ids i-1234567890abcdef0