简体   繁体   中英

AWS S3 behind Cloud front - how to access using c#

I have an S3 bucket sitting behind a CloudFront distribution. I have managed to access files using signed urls. I am trying to understand how can I access content using the AWS SDK from my c# code?

Without CloudFront i used the S3 client:

var m_S3Client = new AmazonS3Client(AccessKeyId, SecretAccessKey, amazonS3Config);
GetObjectRequest request = new GetObjectRequest
{
     BucketName = bucketName,
     Key = keyName
};
GetObjectResponse response = await m_S3Client.GetObjectAsync(request)

But how do I do the same if the bucket is behind CloudFront distribution?

I tried using the ServiceURL in the AmazonS3Config . Also looked into AmazonCloudFrontClient . I don't find anything also in the documentations

Well, after some more searching, there is no way to do so using the AWS nuget packages. You simply have to use the CRUD operators with the CloudFront url using some HttpClient

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM