How do I use the AWS SDK for .NET with Stook?
Integrate Medianova Stook Object Storage into your .NET applications using the AWS SDK for .NET.
You can connect your .NET applications to Medianova Stook Object Storage using the AWS SDK for .NET. This allows you to create buckets, upload objects, and manage your Stook storage directly from Visual Studio.
Prerequisites
Visual Studio installed
AWS Toolkit for Visual Studio installed
Medianova Stook credentials:
Access Key
Secret Key
Endpoint
⚠️ The AWS Toolkit includes sample code examples to help you get started quickly.
Installation
Download and install Visual Studio.
Download and install the AWS Toolkit for Visual Studio.
Example: Create a Bucket in Stook
using System;
using Amazon.Runtime;
using Amazon.S3;
using Amazon.S3.Model;
using Amazon.S3.Util;
namespace s3Example
{
internal class Program
{
private static string bucketName = "medianovatest";
private static string accessKey = "Enter Access Key";
private static string secretKey = "Enter Secret Key";
static async Task Main(string[] args)
{
var s3Config = new AmazonS3Config
{
RegionEndpoint = Amazon.RegionEndpoint.EUWest1,
ServiceURL = "https://xxxxxxxxx.mncdn.com",
ForcePathStyle = true
};
AWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
using (var s3Client = new AmazonS3Client(awsCredentials, s3Config))
{
await CreateBucket(s3Client);
}
Console.WriteLine("Operation completed.");
}
private static async Task CreateBucket(AmazonS3Client s3Client)
{
var createBucketRequest = new PutBucketRequest
{
BucketName = bucketName,
UseClientRegion = true
};
try
{
var response = await s3Client.PutBucketAsync(createBucketRequest);
Console.WriteLine($"Bucket creation status: {response.HttpStatusCode}");
}
catch (AmazonS3Exception ex)
{
Console.WriteLine($"{ex.Message}");
}
}
}
}
Caption: Example .NET code for connecting to Stook and creating a bucket
Troubleshooting / FAQ
Bucket already exists error: Use a unique bucket name.
Connection error: Check Stook endpoint and credentials.
Access denied: Verify Access Key and Secret Key.
References
Last updated
Was this helpful?