Returns the location of a specified bucket.
![](../icons/collapse_all.gif)
C# |
public GetBucketLocationResponse GetBucketLocation( GetBucketLocationRequest request )
![](../icons/collapse_all.gif)
- request (GetBucketLocationRequest)
- The GetBucketLocationRequest that defines the parameters of the operation.
![](../icons/collapse_all.gif)
Returns a GetBucketLocationResponse from S3.
![](../icons/collapse_all.gif)
The information returned can be used to determine the bucket's geographical location.
To determine the location of a bucket, you must be the bucket owner.
![](../icons/collapse_all.gif)
This example shows how to retrieve the location of a bucket.
![](../icons/CopyCode.gif)
// Create a client AmazonS3Client client = new AmazonS3Client(); // Construct request GetBucketLocationRequest request = new GetBucketLocationRequest { BucketName = "SampleBucket" }; // Issue call GetBucketLocationResponse response = client.GetBucketLocation(request); // View response data Console.WriteLine("Bucket location - {0}", response.Location);
![](../icons/collapse_all.gif)
Exception | Condition |
---|---|
ArgumentNullException | |
WebException | |
AmazonS3Exception |