S3 Object Storage

Linode is offering an "S3-compatible" Object Storage. Does anyone know if I can access the object storage programatically using the AWS SDKs for S3? (https://www.nuget.org/packages?q=s3) I am using .NET C#.

2 Replies

Yes, you're able use AWS SDKs with Linode Object Storage. I can't speak from experience, and we don't have any documentation about this; however, based on the Community posts linked below, it looks as though other customers have had success with this.

It may be worthwhile to parse through these posts as they provide some configuration pointers:

To expand on this answer, this worked for me:

The official AWSSDK.S3 nuget-package works like a charm:

using Amazon.S3;
using Amazon.S3.Model;
using System;
using System.IO;
using System.Threading.Tasks;
namespace LinodeS3Test
{
    internal class Program
    {
        private static async Task Main(string[] args)
        {
            string bucketName = "awesomebucket";
            string accessKey = "popcorn";
            string secretKey = "thatsall";

            // Configure where the bucket is located
            AmazonS3Config config = new AmazonS3Config
            {
                ServiceURL = "https://eu-central-1.linodeobjects.com"
            };

            // Connect
            AmazonS3Client client = new AmazonS3Client(accessKey, secretKey, config);

            // List buckets
            ListBucketsResponse listBucketsResponse = await client.ListBucketsAsync();
            foreach (S3Bucket item in listBucketsResponse.Buckets)
            {
                Console.WriteLine(item.BucketName);
            }

            // Upload file
            string fileName = "ballmer_peak.png";
            byte[] fileBytes = File.ReadAllBytes(fileName);
            using MemoryStream ms = new MemoryStream(fileBytes);
            PutObjectResponse uploadResponse =
                await client.PutObjectAsync(
                    new PutObjectRequest()
                    {
                        Key = fileName,
                        BucketName = bucketName,
                        InputStream = ms
                    });

            // List files in bucket
            ListObjectsResponse listFilesResponse = await client.ListObjectsAsync(bucketName);
            foreach (S3Object file in listFilesResponse.S3Objects)
            {
                Console.WriteLine(file.Key);
            }

            Console.ReadLine();
        }
    }
}

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct