Goa.Clients.S3 0.9.1-preview

This is a prerelease version of Goa.Clients.S3.
dotnet add package Goa.Clients.S3 --version 0.9.1-preview
                    
NuGet\Install-Package Goa.Clients.S3 -Version 0.9.1-preview
                    
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="Goa.Clients.S3" Version="0.9.1-preview" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Goa.Clients.S3" Version="0.9.1-preview" />
                    
Directory.Packages.props
<PackageReference Include="Goa.Clients.S3" />
                    
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 Goa.Clients.S3 --version 0.9.1-preview
                    
#r "nuget: Goa.Clients.S3, 0.9.1-preview"
                    
#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 Goa.Clients.S3@0.9.1-preview
                    
#: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=Goa.Clients.S3&version=0.9.1-preview&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Goa.Clients.S3&version=0.9.1-preview&prerelease
                    
Install as a Cake Tool

Goa.Clients.S3

S3 client for object storage operations in high-performance AWS Lambda functions. This package provides a lightweight, AOT-ready S3 client optimized for minimal cold start times.

Installation

dotnet add package Goa.Clients.S3

Features

  • Native AOT support for faster Lambda cold starts
  • Minimal dependencies and memory allocations
  • Built-in error handling with ErrorOr pattern
  • Virtual-host and path-style addressing (path-style is used automatically for custom endpoints such as LocalStack)
  • Server-side encryption support (SSE-KMS)
  • User-defined object metadata
  • Ranged downloads

Usage

Basic Setup

using Goa.Clients.S3;
using Microsoft.Extensions.DependencyInjection;

// Register S3 client
services.AddS3();

// Or with a custom endpoint (e.g. LocalStack)
services.AddS3(config =>
{
    config.ServiceUrl = "http://localhost:4566";
    config.Region = "us-east-1";
});

Uploading Objects

using Goa.Clients.S3.Operations.PutObject;
using System.Text;

public class StorageService
{
    private readonly IS3Client _s3;

    public StorageService(IS3Client s3)
    {
        _s3 = s3;
    }

    public async Task<string?> UploadAsync(string bucket, string key, string json)
    {
        var request = new PutObjectRequest
        {
            Bucket = bucket,
            Key = key,
            Body = Encoding.UTF8.GetBytes(json),
            ContentType = "application/json"
        };

        var result = await _s3.PutObjectAsync(request);
        return result.IsError ? null : result.Value.ETag;
    }
}

Or with the fluent builder, including SSE-KMS encryption and metadata:

var request = new PutObjectBuilder()
    .WithBucket("my-bucket")
    .WithKey("documents/report.pdf")
    .WithBody(fileBytes)
    .WithContentType("application/pdf")
    .WithServerSideEncryption("aws:kms", "alias/my-key")
    .AddMetadata("uploaded-by", "lambda")
    .Build();

var result = await _s3.PutObjectAsync(request);

Downloading Objects

using Goa.Clients.S3.Operations.GetObject;

public async Task<byte[]?> DownloadAsync(string bucket, string key)
{
    var result = await _s3.GetObjectAsync(new GetObjectRequest
    {
        Bucket = bucket,
        Key = key
    });

    if (result.IsError)
    {
        Console.WriteLine($"Download failed: {result.FirstError}");
        return null;
    }

    return result.Value.Body;
}

// Ranged download - first 64 bytes only
var rangeResult = await _s3.GetObjectAsync(new GetObjectRequest
{
    Bucket = "my-bucket",
    Key = "large-file.bin",
    Range = "bytes=0-63"
});

Memory note: GetObjectAsync buffers the entire object body into memory before returning. For large objects, use the Range property to fetch the object in bounded slices rather than downloading the whole object in a single call.

Checking Object Metadata

using Goa.Clients.S3.Operations.HeadObject;

var head = await _s3.HeadObjectAsync(new HeadObjectRequest
{
    Bucket = "my-bucket",
    Key = "documents/report.pdf"
});

if (!head.IsError)
{
    Console.WriteLine($"Size: {head.Value.ContentLength}, ETag: {head.Value.ETag}");
}

Deleting Objects

using Goa.Clients.S3.Operations.DeleteObject;

var result = await _s3.DeleteObjectAsync(new DeleteObjectRequest
{
    Bucket = "my-bucket",
    Key = "documents/report.pdf"
});

// Deleting a missing key also succeeds - S3 deletes are idempotent on unversioned buckets.

Error Handling

Missing objects are surfaced as ErrorType.NotFound rather than exceptions:

using ErrorOr;

var result = await _s3.GetObjectAsync(new GetObjectRequest { Bucket = "my-bucket", Key = "missing" });

if (result.IsError && result.FirstError.Type == ErrorType.NotFound)
{
    // Handle missing object
}

Documentation

For more information and examples, visit the main Goa documentation.

Product Compatible and additional computed target framework versions.
.NET 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.9.1-preview 70 8/24/2026
0.9.0-preview 440 6/18/2026
0.8.0-preview 86 3/17/2026
0.7.8-preview 82 3/3/2026
0.7.7-preview 77 3/3/2026
0.7.6-preview 78 3/3/2026
0.7.5-preview 76 3/2/2026
0.7.4-preview 82 3/1/2026
0.7.3-preview 75 2/28/2026
0.7.2-preview 76 2/23/2026
0.7.1-preview 77 1/26/2026
0.7.0-preview 79 1/26/2026
0.2.1-preview 83 1/20/2026
0.2.0-preview 85 1/14/2026
0.1.9-preview 84 1/1/2026
0.1.8-preview 228 12/15/2025
0.1.7-preview 241 12/15/2025
0.1.6-preview 234 12/15/2025
0.1.5-preview 229 12/15/2025
0.1.4-preview 236 12/15/2025
Loading failed