AWS - CLIYou want to write a script that lists all S3 buckets and saves their names to a file named 'buckets.txt'. Which AWS CLI command should you use?Aaws s3api list-buckets > buckets.txtBaws s3 ls > buckets.txtCaws s3api list-buckets --query 'Buckets[].Name' --output text > buckets.txtDaws s3api list-buckets --names > buckets.txtCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify command to list bucket names only'aws s3api list-buckets' lists buckets; using --query 'Buckets[].Name' extracts only names.Step 2: Confirm output redirection and format--output text formats output as plain text, suitable for saving. Redirecting with '> buckets.txt' saves to file.Final Answer:aws s3api list-buckets --query 'Buckets[].Name' --output text > buckets.txt -> Option CQuick Check:Use --query and --output text to save bucket names [OK]Quick Trick: Use --query and --output text to extract and save data [OK]Common Mistakes:Not using --query to filter namesUsing incorrect flags like --namesSaving full JSON output without filtering
Master "CLI" in AWS9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More AWS Quizzes AWS Account and Billing - Free tier usage monitoring - Quiz 8hard Cloud Computing Fundamentals - What is cloud computing - Quiz 9hard EC2 Fundamentals - Amazon Machine Images (AMIs) - Quiz 2easy EC2 Fundamentals - Instance types and families - Quiz 8hard Identity and Access Management - Multi-factor authentication setup - Quiz 11easy Identity and Access Management - IAM policies (JSON structure) - Quiz 6medium S3 Fundamentals - Static website hosting on S3 - Quiz 4medium Security Groups and Network ACLs - Default security group behavior - Quiz 6medium Security Groups and Network ACLs - Security group as virtual firewall - Quiz 8hard Security Groups and Network ACLs - Default security group behavior - Quiz 7medium