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
gefragt vor 9 Monaten22 Aufrufe
Keine Antworten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen