This operation is useful for determining if a bucket exists and you have permission to access it.
See also: AWS API Documentation.
head-bucket --bucket <value> [--cli-input-json <value>]
Operates a service or services based on the provided JSON string. If other arguments are provided on the command line, the CLI values override the JSON-provided values. You cannot pass arbitrary binary values using a JSON-provided value, because the string is taken literally.
The following command verifies access to a bucket named “my-bucket”:
$ aws s3api head-bucket --bucket my-bucket
If the bucket exists and you have access to it, no output is returned. Otherwise, an error message is shown. For example:
A client error (404) occurred when calling the HeadBucket operation: Not Found