Reputation: 10463
I have video file in S3 private bucket. And I want my application to open it in a video player by using a URL.
I think I saw a url in this format: http://s3.amazonAWS.com/bucket/filename?signedstring
where signedstring
is a query with params AWSAccessKeyId, Expires, Signature
I have access key ID. But when I tried to read up on how to sign it - the things make little sense to me..
Is this approach the simplest one ?
I dont really need everything. I just need to be able to construct a URL and open video file.
Is there a simple C# code to sign the query ?
Upvotes: 1
Views: 4132
Reputation: 2129
You can use the AWS SDK for .NET (http://aws.amazon.com/sdkfornet/) to create pre-signed URLs for your S3 Objects. Here's an example that will create a pre-signed url that is valid for 15 minutes:
var s3Client = new AmazonS3Client(awsKeyId, awsSecretKey);
var url = s3Client.GetPreSignedUrl( new GetPreSignedUrlRequest {
BucketName = bucket,
Key = objectKey,
Expires = DateTime.UtcNow.AddMinutes(15)
});
There are additional examples in the documentation for GetPreSignedUrl()
.
Upvotes: 4