AWS SDK - .NET

Please read the following to understand how to use the 4EVERLAND Bucket with AWS SDK - .NET. This guide outlines the integration of AWS SDK API for .NET with the 4EVERLAND Bucket to facilitate file uploads to the IPFS or Arweave storage networks.

Preparation

Development Examples

Create a bucket

ServiceURL: https://endpoint.4everland.co

accessKey: Bucket-Access Keys-API Key

secretKey: Bucket-Access Keys-API Secret

namespace CreateBucket
{
    using System;
    using System.Threading.Tasks;
    using Amazon.S3;
    using Amazon.S3.Model;

    public class CreateBucket
    {
        public static async Task Main()
        {

            // Specify a name for the new bucket.
            const string newBucketName = "bucketname";

             {
                string accessKey = "4EVERLAND-Bucket-APIKey";
                string secretKey = "4EVERLAND-Bucket-APISecret";
                var config = new AmazonS3Config()
            {
                ServiceURL = string.Format("https://endpoint.4everland.co"),
                ForcePathStyle = true,
            };
            var client = new AmazonS3Client(accessKey, secretKey, config);
            Console.WriteLine($"\nCreating a new bucket, named: {newBucketName}.");

            await CreatingBucketAsync(client, newBucketName);

        }

        static async Task CreatingBucketAsync(IAmazonS3 client, string bucketName)
        {
            try
            {
                var putBucketRequest = new PutBucketRequest
                {
                    BucketName = bucketName,
                    UseClientRegion = true,
                };

                var putBucketResponse = await client.PutBucketAsync(putBucketRequest);

            }
            catch (AmazonS3Exception ex)
            {
                Console.WriteLine($"Error creating bucket: '{ex.Message}'");
            }
        }
    }

}
}

Upload a file

bucket-name: Your bucket name

accessKey: Bucket-Access Keys-API Key

secretKey: Bucket-Access Keys-API Secret

/path/to/object: The file path for the file to be uploaded

objectname: The name of the file to be uploaded

Requesting IPFS CID and Arweave Hash

Bucket: The bucket name where the target file is stored

Key: The path of the target file

If you have any questions, please join our Discord server, or send us an email at [email protected].

Last updated