Bird
0
0

You want to save the output of aws ec2 describe-instances in a file as JSON and also view it as a table on screen. What is the best approach?

hard📝 Application Q8 of 15
AWS - CLI
You want to save the output of aws ec2 describe-instances in a file as JSON and also view it as a table on screen. What is the best approach?
ARun command twice: once with --output json > file, once with --output table
BUse --output json | tee file and then convert to table manually
CUse --output table and redirect output to file
DSet default output to table and manually convert file to JSON
Step-by-Step Solution
Solution:
  1. Step 1: Understand output format limitations

    AWS CLI outputs one format per command execution; cannot output two formats simultaneously.
  2. Step 2: Choose practical solution

    Running the command twice with different --output options saves JSON to file and shows table on screen.
  3. Final Answer:

    Run command twice: once with --output json > file, once with --output table -> Option A
  4. Quick Check:

    One output format per command; run twice for different formats [OK]
Quick Trick: Run commands separately for different output formats [OK]
Common Mistakes:
  • Trying to get two formats in one command
  • Redirecting table output as JSON

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AWS Quizzes