S3Lite 1.1.0

dotnet add package S3Lite --version 1.1.0
                    
NuGet\Install-Package S3Lite -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="S3Lite" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="S3Lite" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="S3Lite" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add S3Lite --version 1.1.0
                    
#r "nuget: S3Lite, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package S3Lite@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=S3Lite&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=S3Lite&version=1.1.0
                    
Install as a Cake Tool

S3Lite icon

S3Lite

Lightweight Amazon S3 and S3-compatible storage client for .NET.

NuGet Version NuGet

S3Lite keeps the surface area small while still covering the core bucket and object operations most applications actually need. It targets AWS S3, Less3, MinIO, LocalStack, and other S3-compatible endpoints without dragging in the official AWS SDK.

Why S3Lite

  • Small dependency footprint
  • Simple fluent client configuration
  • AWS S3 and S3-compatible endpoint support
  • Anonymous access support for public buckets
  • Caller-supplied HttpClient support for DI, proxying, custom handlers, and connection reuse
  • Multi-targeted package: netstandard2.0, netstandard2.1, net8.0, and net10.0

New in v1.1.0

  • Upgraded to RestWrapper v3.2.0
  • Added support for caller-supplied HttpClient instances
  • Reworked the automated test infrastructure around Touchstone
  • Added xUnit and NUnit runner projects alongside the console runner

Installation

dotnet add package S3Lite

Quick Start

AWS S3 with Credentials

using System;
using System.Text;
using S3Lite;
using S3Lite.ApiObjects;

S3Client s3 = new S3Client()
    .WithRegion("us-west-1")
    .WithAccessKey("AKIAIOSFODNN7EXAMPLE")
    .WithSecretKey("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY")
    .WithRequestStyle(RequestStyleEnum.VirtualHostedStyle)
    .WithLogger(Console.WriteLine);

ListAllMyBucketsResult buckets = await s3.Service.ListBucketsAsync();

await s3.Object.WriteAsync(
    "my-bucket",
    "hello.txt",
    Encoding.UTF8.GetBytes("hello from s3lite"),
    "text/plain");

byte[] data = await s3.Object.GetAsync("my-bucket", "hello.txt");
Console.WriteLine(Encoding.UTF8.GetString(data));

Anonymous Access for Public Buckets

If a bucket is public, simply omit credentials:

using System;
using S3Lite;
using S3Lite.ApiObjects;

S3Client s3 = new S3Client()
    .WithRegion("us-west-1")
    .WithRequestStyle(RequestStyleEnum.VirtualHostedStyle);

ListBucketResult result = await s3.Bucket.ListAsync("public-dataset-bucket");
Console.WriteLine(result.Contents.Count);

S3-Compatible Storage

using S3Lite;

S3Client s3 = new S3Client()
    .WithHostname("localhost")
    .WithPort(9000)
    .WithProtocol(ProtocolEnum.Http)
    .WithRegion("us-west-1")
    .WithRequestStyle(RequestStyleEnum.PathStyle)
    .WithAccessKey("minioadmin")
    .WithSecretKey("minioadmin");

Bring Your Own HttpClient

S3Lite now exposes the caller-supplied HttpClient support added in RestWrapper v3.2.0. Use this when you already manage HttpClient instances through dependency injection, need a custom handler pipeline, or want to centralize transport settings.

using System;
using System.Net.Http;
using S3Lite;

HttpClient httpClient = new HttpClient();
httpClient.Timeout = TimeSpan.FromSeconds(30);

S3Client s3 = new S3Client(httpClient)
    .WithRegion("us-east-1")
    .WithHostname("s3.us-east-1.amazonaws.com")
    .WithRequestStyle(RequestStyleEnum.PathStyle)
    .WithAccessKey("AKIAIOSFODNN7EXAMPLE")
    .WithSecretKey("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY");

bool exists = await s3.Bucket.ExistsAsync("my-bucket");

You can also attach one fluently:

S3Client s3 = new S3Client()
    .WithHttpClient(httpClient)
    .WithRegion("us-east-1");

Notes:

  • The caller owns the lifetime of the supplied HttpClient
  • S3Lite does not dispose a caller-supplied HttpClient
  • Transport behavior such as proxying, TLS, decompression, retries, and timeouts should be configured on your HttpClient or its handler

Common Operations

Service APIs

ListAllMyBucketsResult buckets = await s3.Service.ListBucketsAsync();

Bucket APIs

bool exists = await s3.Bucket.ExistsAsync("my-bucket");

await s3.Bucket.WriteAsync("my-bucket", "us-west-1");

ListBucketResult objects = await s3.Bucket.ListAsync("my-bucket");

ListBucketResult filtered = await s3.Bucket.ListAsync("my-bucket", prefix: "images/");

ListBucketResult page = await s3.Bucket.ListAsync("my-bucket", continuationToken: "token-value", maxKeys: 100);

await s3.Bucket.DeleteAsync("my-bucket");

Object APIs

await s3.Object.WriteAsync("my-bucket", "notes/hello.txt", Encoding.UTF8.GetBytes("hello"));

bool exists = await s3.Object.ExistsAsync("my-bucket", "notes/hello.txt");

ObjectMetadata metadata = await s3.Object.GetMetadataAsync("my-bucket", "notes/hello.txt");

byte[] data = await s3.Object.GetAsync("my-bucket", "notes/hello.txt");

await s3.Object.DeleteAsync("my-bucket", "notes/hello.txt");

Endpoint Guidance

The right hostname depends on the request style you choose:

Request Style Typical Hostname Example URL
VirtualHostedStyle amazonaws.com https://mybucket.s3.us-west-1.amazonaws.com/mykey
PathStyle s3.us-west-1.amazonaws.com https://s3.us-west-1.amazonaws.com/mybucket/mykey

For S3-compatible platforms such as Less3, MinIO, or LocalStack, point Hostname and Port at your service endpoint and usually prefer PathStyle.

Key Client Properties

Property Description
AccessKey Access key, or null for anonymous mode
SecretKey Secret key, or null for anonymous mode
HasCredentials True when both access key and secret key are configured
Region Region used in request signing and URL construction
Hostname Endpoint hostname
Port Endpoint port
Protocol Http or Https
RequestStyle VirtualHostedStyle or PathStyle
SignatureVersion Signature version used by the client
HttpClient Optional caller-supplied HttpClient instance
Logger Optional request logger callback

Error Behavior

S3Lite throws WebException for failed requests and includes useful context in the exception Data collection, including:

  • StatusCode
  • URL
  • RequestBody
  • ResponseBody
  • S3 error metadata such as RequestId, VersionId, Resource, and ErrorCode when available

Automated Testing

The repository now uses Touchstone so the same shared descriptors can run through multiple hosts:

  • src/Test.Shared: shared Touchstone descriptors and test configuration
  • src/Test.Automated: console runner using Touchstone.Cli
  • src/Test.Xunit: xUnit adapter host
  • src/Test.Nunit: NUnit adapter host

Run the Console Runner

dotnet run --framework net8.0 --project src/Test.Automated -- -b my-bucket -a ACCESS_KEY -s SECRET_KEY

Optional arguments:

  • --endpoint <host>
  • --port <port>
  • --region <region>
  • --http
  • --https
  • --path-style
  • --virtual-hosted
  • --verbose
  • --skip-cleanup
  • --skip-write-tests
  • --results <path>

Run xUnit and NUnit

dotnet test src/Test.Xunit/Test.Xunit.csproj
dotnet test src/Test.Nunit/Test.Nunit.csproj

These runners read the same configuration from environment variables:

  • S3LITE_TEST_ENDPOINT
  • S3LITE_TEST_PORT
  • S3LITE_TEST_REGION
  • S3LITE_TEST_ACCESS_KEY
  • S3LITE_TEST_SECRET_KEY
  • S3LITE_TEST_BUCKET
  • S3LITE_TEST_PROTOCOL
  • S3LITE_TEST_REQUEST_STYLE
  • S3LITE_TEST_VERBOSE
  • S3LITE_TEST_SKIP_CLEANUP
  • S3LITE_TEST_SKIP_WRITE_TESTS

Example Projects

  • src/Test.S3: interactive AWS S3 example
  • src/Test.S3Compatible: interactive S3-compatible example
  • src/Test.Script: script-style object hierarchy walkthrough
  • src/Test.LargeEnumeration: large-listing exercise

Feedback and Enhancements

Encounter an issue or have an enhancement request? Please open an issue or start a discussion in the repository.

Version History

See CHANGELOG.md for release details.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on S3Lite:

Package Downloads
Blobject.AmazonS3Lite

BLOB storage client for Amazon S3 (including compatible storage e.g. Minio, Less3, Ceph, View) using a lightweight, non-AWS SDK. Refer to other Blobject packages for other storage repository types.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 69 5/18/2026
1.0.9 99 4/6/2026
1.0.8 821 12/16/2025
1.0.7 4,955 3/8/2025
1.0.6 4,102 8/28/2024
1.0.5 150 8/28/2024
1.0.3 139 8/27/2024
1.0.2 2,005 4/29/2024
1.0.1 150 4/29/2024
1.0.0 274 11/11/2023

Caller-supplied HttpClient support, RestWrapper 3.2.0, and Touchstone-based automated test runners.