-
Notifications
You must be signed in to change notification settings - Fork 127
Scripting with "aws"
By default, "aws" outputs its information in a human-friendly way that organizes columns of information into boxes.
Using the "--simple" option will cause "aws" to format output in a way that is more friendly for building Unix pipe statements or parsing by another program.
Use the --fail
option to tell curl to suppress returning an error document and instead set the exit status to 22. You can specify --fail directly on the "aws" command line, and it will be passed through to curl.
From the curl documentation:
-f, --fail
(HTTP) Fail silently (no output at all) on server errors. This is mostly done to better enable scripts etc to better deal with failed attempts. In normal cases when an HTTP server fails to deliver a document, it returns an HTML document stating so (which often also describes why and more). This flag will prevent curl from outputting that and return error 22.
This method is not fail-safe and there are occasions where non-successful response codes will slip through, especially when authentication is involved (response codes 401 and 407).