Getting Information About a Bucket
You can verify if a bucket exists and whether you have access to it.
Getting Information About a Bucket Using AWS CLI
Checking for Bucket Existence and Access
Before you begin: Install and configure AWS CLI and set up your profile. For more information, see Installing and Configuring AWS CLI. |
To verify if a bucket exists and whether you have access to it, use the head-bucket command following this syntax:
$ aws s3api head-bucket \
--profile YOUR_PROFILE \
--bucket BUCKET \
--endpoint https://oos.eu-west-2.outscale.com
This command contains the following attributes that you need to specify:
-
(optional)
profile
: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI. -
bucket
: The name of the bucket you want to verify the access. -
endpoint
: The endpoint corresponding to the Region you want to send the request to.
If the bucket exists and you have access to it, the head-object command returns no element.
However, if you do not have access to the bucket, the following error 403 message is returned:
An error occurred (403) when calling the HeadBucket operation: Forbidden
Getting Information About the Location of a Bucket
To get information about the location of a bucket, use the get-bucket-location command following this syntax.
To use this command, you must have permissions on the bucket. For more information, see Access Control List (ACL) Reference. |
$ aws s3api get-bucket-location \
--profile YOUR_PROFILE \
--bucket BUCKET \
--endpoint https://oos.eu-west-2.outscale.com
The get-bucket-location command returns the following element:
-
LocationConstraint
: Specifies the location of the bucket.
{
"LocationConstraint": "site1"
}
Related Pages
AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.