get_bucket_location¶
Operation¶
get_bucket_location
async
¶
get_bucket_location(request: GetBucketLocationInput | GetBucketLocationInputDict, /, *, plugins: list[Plugin] | None = None) -> GetBucketLocationOutput
get_bucket_location(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[GetBucketLocationInputDict]) -> GetBucketLocationOutput
Warning
Using the GetBucketLocation operation is no longer a best practice. To
return the Region that a bucket resides in, we recommend that you use
the
HeadBucket
operation instead. For backward compatibility, Amazon S3 continues to
support the GetBucketLocation operation.
Returns the Region the bucket resides in. You set the bucket's Region
using the LocationConstraint request parameter in a CreateBucket
request. For more information, see
CreateBucket.
Note
In a bucket's home Region, calls to the GetBucketLocation operation
are governed by the bucket's policy. In other Regions, the bucket
policy doesn't apply, which means that cross-account access won't be
authorized. However, calls to the HeadBucket operation always return
the bucket's location through an HTTP response header, whether access to
the bucket is authorized or not. Therefore, we recommend using the
HeadBucket operation for bucket Region discovery and to avoid using
the GetBucketLocation operation.
When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.
When you use this API operation with an Object Lambda access point,
provide the alias of the Object Lambda access point in place of the
bucket name. If the Object Lambda access point alias in a request is not
valid, the error code InvalidAccessPointAliasError is returned. For
more information about InvalidAccessPointAliasError, see List of
Error
Codes.
Note
This operation is not supported for directory buckets.
The following operations are related to GetBucketLocation:
Warning
You must URL encode any signed header values that contain spaces. For
example, if your header value is my file.txt, containing two spaces
after my, you must URL encode this value to my%20%20file.txt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
GetBucketLocationOutput
|
An instance of |
Input¶
Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.
Model¶
GetBucketLocationInput
dataclass
¶
Bases: _SerdeShape
Dataclass for GetBucketLocationInput structure.
Attributes¶
bucket
class-attribute
instance-attribute
¶
bucket: str | None = ...
The name of the bucket for which to get the location.
When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.
When you use this API operation with an Object Lambda access point,
provide the alias of the Object Lambda access point in place of the
bucket name. If the Object Lambda access point alias in a request is not
valid, the error code InvalidAccessPointAliasError is returned. For
more information about InvalidAccessPointAliasError, see List of
Error
Codes.
expected_bucket_owner
class-attribute
instance-attribute
¶
expected_bucket_owner: str | None = ...
The account ID of the expected bucket owner. If the account ID that you
provide does not match the actual owner of the bucket, the request fails
with the HTTP status code 403 Forbidden (access denied).
Dictionaries¶
GetBucketLocationInputDict
¶
Bases: TypedDict
Dictionary form of GetBucketLocationInput.
Attributes¶
bucket
instance-attribute
¶
The name of the bucket for which to get the location.
When you use this API operation with an access point, provide the alias of the access point in place of the bucket name.
When you use this API operation with an Object Lambda access point,
provide the alias of the Object Lambda access point in place of the
bucket name. If the Object Lambda access point alias in a request is not
valid, the error code InvalidAccessPointAliasError is returned. For
more information about InvalidAccessPointAliasError, see List of
Error
Codes.
Output¶
GetBucketLocationOutput
dataclass
¶
Bases: _SerdeShape
Dataclass for GetBucketLocationOutput structure.
Attributes¶
location_constraint
class-attribute
instance-attribute
¶
location_constraint: str | None = ...
Specifies the Region where the bucket resides. For a list of all the Amazon S3 supported location constraints by Region, see Regions and Endpoints.
Buckets in Region us-east-1 have a LocationConstraint of null.
Buckets with a LocationConstraint of EU reside in eu-west-1.
response_metadata
class-attribute
instance-attribute
¶
Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.