When a command fails, the first question is who refused it: the CLI on your machine, or AWS.
An error from AWS
aws ec2 describe-availability-zones --zone-names us-east-1zAn error occurred (InvalidParameterValue) when calling the DescribeAvailabilityZones operation: Invalid availability zone: [us-east-1z]Every error from AWS has this shape:
Read the code first. It names the kind of mistake, and the same codes come back across services: AccessDenied, InvalidParameterValue, names ending in NotFound.
An error from the CLI
aws ec2 describe-availability-zones --zone us-east-1aUnknown options: --zone, us-east-1aThere is no such parameter, so the CLI stopped before sending anything. Mistakes in the command line itself, such as a misspelled parameter or a missing value, end like this. Check the parameter names with help.
Did it work?
echo $?After every command, the shell keeps a number called the exit status. 0 means the command worked; anything else means it failed. Scripts check it, and so can you when a command prints nothing.