AWS S3 Example with Lumen Bucket Storage (C#/.Net)

0

I am looking for example code and configuration setup for autorization/connect for Lumen's AWS S3 Bucket storage

We just started a 60 day trial with Lumen storage and am trying to create a .Net/C# program to interact with it. I'm struggling with the connection/authentication code

Lumen support is not helping much, they sent me a Linux script, but they have no support for any real language (C#, C++, C, Java, etc)

It's not clear to me the syntax/contents of the aws config and credentials files and where to place them for a .Net/C# solution

I have tried researching online but even the AWS samples don't show the details of connection/authorization.

This post is a little help, but is not complete: AWS S3 Bucket Access when connecting to Lumen

So far this is what I have:

{
            var config = new Amazon.S3.AmazonS3Config
            {
                ServiceURL = "https://us-east-1.storage.lumen.com",
                UseHttp = true
            };

            var client = new Amazon.S3.AmazonS3Client(
                "xxxxxxxxxx-accesskey",
                "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-secretkey", 
                config);

            var urlRequest = new GetPreSignedUrlRequest();
            urlRequest.BucketName = "prepress-archive/TEST";
            urlRequest.Expires = DateTime.UtcNow.AddHours(10);
            urlRequest.Protocol = Protocol.HTTP;
            urlRequest.Verb = HttpVerb.GET;
            urlRequest.Key = "test.txt";
            string path = client.GetPreSignedURL(urlRequest);
            
            HttpWebRequest request = HttpWebRequest.Create(path) as HttpWebRequest;
            HttpWebResponse response = request.GetResponse() as HttpWebResponse;

            using (Stream stream = response.GetResponseStream())
            using (StreamReader reader = new StreamReader(stream))
            {
                string contents = reader.ReadToEnd();
            }
        }

The error I am getting is a "502 Bad Gateway" error at line

HttpWebResponse response = request.GetResponse() as HttpWebResponse

Any help greatly appreciated

scott
已提問 9 個月前檢視次數 22 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南