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

问题描述 投票:0回答:1

我想获得CloudFront媒体内容文件的预签名URL。我在S3 Presigned URL的c#中有代码,但这对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);

}

c# amazon-cloudfront pre-signed-url
1个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.