如何获取CloudFront Media内容的预签名URL

时间:2017-12-21 12:12:43

标签: c# amazon-cloudfront pre-signed-url

我想获取CloudFront媒体内容文件的预签名网址。 我在c#for S3 Presigned URL中有代码,但这对ColudFront不起作用 在这方面请帮助我。 我有cloudFront的C#代码,但无法弄清楚如何实现它。 以下是代码:

    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);

}

1 个答案:

答案 0 :(得分:0)

得到解决方案!!!!!! 请参考下面的博客 http://improve.dk/how-to-set-up-and-serve-private-content-using-s3/