0

I want to get presigned URL for my CloudFront media content files. I have code in c# for S3 Presigned URL but that doesnt work for ColudFront Please help me in this regards. I have C# code for the cloudFront, but not able to figure out how to implement it. Below is the code:

    private const string AccessKeyId = "";- what to put here

    private const string SecretAccessKey = "";- what to put here

    private const string KeyPairId = "";- what to put here

    private const string PrivateKey = "";- what to put here , is it a filename or the path

    private static void Main()
    {
        const string FileName = "My.File.Zip";
        const string S3Bucket = "mybucket";
        const string CloudFrontBaseUrl = @"http://blahblah.cloudfront.net/";
        const int MinutesValid = 15;

        var expiry = DateTime.Now.AddMinutes(MinutesValid);

        var s3SecureUrl = S3.GetSecureUrl(S3Bucket, FileName, expiry, AccessKeyId, SecretAccessKey);
        var cloudFrontSecureUrl = CloudFront.GetSecureUrl(CloudFrontBaseUrl + FileName, expiry, PrivateKey, KeyPairId);

}

Hemlata N
  • 21
  • 1
  • Please read and understand the documentation, we're not going to google for you. – cguedel Dec 21 '17 at 12:25
  • I have done my research, and also figured out the code – Hemlata N Dec 21 '17 at 12:44
  • figured out the code: const string S3Bucket = "Bucketname"; const string CloudFrontBaseUrl = @"https://mydomainCloudfront.net/"; const int Min = 15; var expiry = DateTime.Now.AddMinutes(Min); var s3SecureUrl = S3.GetSecureUrl(S3Bucket, "VideFile.mp4", expiry, AccessKeyId, SecretAccessKey); var cloudFrontSecUrl = CloudFront.GetSecureUrl(FileName, DateTime.Now.AddHours(2), PrivateKey, KeyPairId); But still getting access denied message for the generate URL string. hence just want to know what am I missing here – Hemlata N Dec 21 '17 at 12:48

1 Answers1

1

Got the solutions!!!!!! please refer below blog http://improve.dk/how-to-set-up-and-serve-private-content-using-s3/

Hemlata N
  • 21
  • 1