C# – Amazon S3 – How to properly build URLs pointing to the objects in a bucket


I'm using the Amazon S3 environment to store images for a C# Webapplication. From the S3 documentation I learned, that the basic URL to access an object looks like


I know that one can build expiring URLs to the objects in a bucket. Two questions:

  1. Should one generally use expiring URL's?
  2. How would I build an expiring url?

Best Solution

You only need to build expiring urls if you want to restrict access.

Here's some code to generate the signed url which expires in 3 mins.

using (var s3Client = AWSClientFactory.CreateAmazonS3Client("MyAccessKey", "MySecretKey"))
    GetPreSignedUrlRequest request = new GetPreSignedUrlRequest()

    string url = s3Client.GetPreSignedURL(request);