How do I write/read zip files to linode object storage?
Hello,
I am trying to write zip files to object storage bucket using amazon s3 sdk and receiving an invalid ssl error as below.
The SSL connection could not be established, see inner exception.
The remote certificate is invalid according to the validation procedure.
The code I use is as below
AmazonS3Config amazonS3Config = new AmazonS3Config();
amazonS3Config.ServiceURL = serviceURL;
amazonS3Config.Validate();
client = new AmazonS3Client(keyName, accessKey, amazonS3Config);
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
{
var putRequest0 = new PutObjectRequest
{
BucketName = bucketName,
Key = folderKey,
ContentType = "application/zip",
InputStream = fs
};
putRequest0.Metadata.Add("x-amz-meta-title", "Upload check1");
var response0 = await client.PutObjectAsync(putRequest0);
}
Can any one help on how to use object storage in c# .net core?
1 Reply
Hey there,
Recently, we were asked a similar question on this site and I gave the answer to how I've personally used zip files with our S3 compatible Object Storage. The short answer is that you can mount your bucket as a local file system and extract a zip file to it that way.
It's best explained in this other post, which I'll link you to here:
How To Upload Ten million files to Object Storage
Since I don't have experience with using Object Storage with .NET Core, I did some research online and I found a page on Stack Overflow which might get you pointed in the right direction:
Amazon S3 .NET Core how to upload a file
I hope this is helpful. Feel free to let us know if this works, or if you have other questions. It looks like you've added some good tags to this post so it should give it visibility to other members of the Linode Community that have experience with .NET Core and can provide additional assistance.