localstack-dotnet-client - LocalStack.Client 1.3.1

This is an easy-to-use .NET client for LocalStack. The client library provides a thin wrapper around aws-sdk-net which automatically configures the target endpoints to use LocalStack for your local cloud application development.

PM> Install-Package LocalStack.Client -Version 1.3.1 -Source https://www.myget.org/F/localstack-dotnet-client/api/v3/index.json

Copy to clipboard

> nuget.exe install LocalStack.Client -Version 1.3.1 -Source https://www.myget.org/F/localstack-dotnet-client/api/v3/index.json

Copy to clipboard

> dotnet add package LocalStack.Client --version 1.3.1 --source https://www.myget.org/F/localstack-dotnet-client/api/v3/index.json

Copy to clipboard
<PackageReference Include="LocalStack.Client" Version="1.3.1" />
Copy to clipboard
source https://www.myget.org/F/localstack-dotnet-client/api/v3/index.json

nuget LocalStack.Client  ~> 1.3.1
Copy to clipboard

> choco install LocalStack.Client --version 1.3.1 --source https://www.myget.org/F/localstack-dotnet-client/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "localstack-dotnet-client" -SourceLocation "https://www.myget.org/F/localstack-dotnet-client/api/v2"
Install-Module -Name "LocalStack.Client" -RequiredVersion "1.3.1" -Repository "localstack-dotnet-client" 
Copy to clipboard

LocalStack .NET Client Nuget NuGet Space Metric

LocalStack

Localstack.NET is an easy-to-use .NET client for LocalStack, a fully functional local AWS cloud stack. The client library provides a thin wrapper around aws-sdk-net which automatically configures the target endpoints to use LocalStack for your local cloud application development.

Package Stable Nightly
LocalStack.Client NuGet MyGet
LocalStack.Client.Extensions NuGet MyGet

Continuous Integration

Build server Platform Build status
Github Actions Ubuntu build-ubuntu
Github Actions Windows build-windows
Github Actions macOS build-macos

Table of Contents

  1. Supported Platforms
  2. Why LocalStack.NET Client?
  3. Prerequisites
  4. Getting Started
  5. Known Issues
  6. Developing
  7. Changelog
  8. License

Supported Platforms

Why LocalStack.NET Client?

  • Consistent Client Configuration: LocalStack.NET eliminates the need for manual endpoint configuration, providing a standardized and familiar approach to initializing clients.

  • Adaptable Environment Transition: Easily switch between LocalStack and actual AWS services with minimal configuration changes.

  • Versatile .NET Compatibility: Supports a broad spectrum of .NET versions, from .NET 7.0 and .NET Standard 2.0 to .NET Framework 4.6.1 and above.

  • Reduced Learning Curve: Offers a familiar interface tailored for LocalStack, ideal for developers acquainted with the AWS SDK for .NET.

  • Enhanced Development Speed: Reduces boilerplate and manual configurations, speeding up the development process.

Prerequisites

To utilize this library, you need to have LocalStack running. While LocalStack can be installed directly on your machine and accessed via the localstack cli, the recommended approach is to run LocalStack using Docker or docker-compose.

For detailed installation and setup instructions, please refer to the official LocalStack installation guide.

Getting Started

LocalStack.NET is installed from NuGet. To work with LocalStack in your .NET applications, you'll need the main library and its extensions. Here's how you can install them:

dotnet add package LocalStack.Client
dotnet add package LocalStack.Client.Extensions

Refer to documentation for more information on how to install LocalStack.NET.

LocalStack.NET is a library that provides a wrapper around the aws-sdk-net. This means you can use it in a similar way to the AWS SDK for .NET and to AWSSDK.Extensions.NETCore.Setup with a few differences. For more on how to use the AWS SDK for .NET, see Getting Started with the AWS SDK for .NET.

Setup

Here's a basic example of how to setup LocalStack.NET:

public void ConfigureServices(IServiceCollection services)
{
    // Add framework services.
    services.AddMvc();

    services.AddLocalStack(Configuration)
    services.AddDefaultAWSOptions(Configuration.GetAWSOptions());
    services.AddAwsService<IAmazonS3>();
    services.AddAwsService<IAmazonDynamoDB>();
}

The AddLocalStack method integrates LocalStack.NET into your application, and the AddAwsService method allows you to specify which AWS services you want to use with LocalStack.

AddLocalStack extension method is responsible for both configurations and adding of LocalStack.Client dependencies to service collection.

Configuration

To configure LocalStack.NET, you can use entries in the appsettings.json files. Here's a basic example for different environments:

appsettings.Development.json

"LocalStack": {
    "UseLocalStack": true,
    "Session": {
        "RegionName": "eu-central-1"
    },
    "Config": {
        "LocalStackHost": "localhost.localstack.cloud", // or "localhost",
        "EdgePort": 4566
    }
}

appsettings.Production.json

"LocalStack": {
    "UseLocalStack": false
},
"AWS": {
    "Profile": "<your aws profile>",
    "Region": "eu-central-1"
}

The RegionName is important as LocalStack creates resources based on the specified region. For more advanced configurations and understanding how LocalStack.NET operates with LocalStack, refer to documentation.

Known Issues

  • LocalStack Versions v2.0.1 - v2.2: In versions v2.0.1 through v2.2 of LocalStack, the URL routing logic was changed, causing issues with SQS and S3 operations. Two issues were opened in LocalStack regarding this: issue #8928 and issue #8924. LocalStack addressed this problem with PR #8962. Therefore, when using LocalStack.NET, either use version v2.0 of LocalStack (there are no issues with the v1 series as well) or the upcoming v2.3 version, or use the latest container from Docker Hub.

  • AWS_SERVICE_URL Environment Variable: Unexpected behaviors might occur in LocalStack.NET when the AWS_SERVICE_URL environment variable is set. This environment variable is typically set by LocalStack in the container when using AWS Lambda, and AWS also uses this environment variable in the live environment. Soon, just like in LocalStack's official Python library, this environment variable will be prioritized by LocalStack.NET when configuring the LocalStack host, and there will be a general simplification in the configuration. You can follow this in the issues issue #27 and issue #32. You set the AWS_SERVICE_URL to empty string until this issue is resolved.

Environment.SetEnvironmentVariable("AWS_SERVICE_URL", string.Empty);
  • IAmazonLambda Operations: There's a general issue with IAmazonLambda operations. This matter is currently under investigation.

Developing

We appreciate contributions in the form of feedback, bug reports, and pull requests.

Building the Project

To build the project, use the following commands based on your operating system:

Windows

build.ps1

Linux

./build.sh

Sandbox Applications

The LocalStack .NET repository includes several sandbox console applications located in tests/sandboxes. These applications serve both as testing tools and as examples. Refer to the documentation for more information

Running Tests

To execute the tests, use the commands below:

Windows

build.ps1 --target=tests

Linux

./build.sh --target=tests

Changelog

Please refer to CHANGELOG.md to see the complete list of changes for each release.

License

Licensed under MIT, see LICENSE for the full text.

  • .NETFramework 4.6.1
    • AWSSDK.Core (>= 3.7.9)
  • .NETFramework 5.0
    • AWSSDK.Core (>= 3.7.9)
  • .NETFramework 6.0
    • AWSSDK.Core (>= 3.7.9)
  • .NETStandard 2.0
    • AWSSDK.Core (>= 3.7.9)
  • .NETFramework 4.6.1: 4.6.1.0
  • .NETFramework 5.0: 5.0.0.0
  • .NETFramework 6.0: 6.0.0.0
  • .NETStandard 2.0: 2.0.0.0

Owners

Deniz İrgin

Authors

LocalStack.NET, Deniz İrgin

Project URL

https://github.com/localstack-dotnet/localstack-dotnet-client

License

Unknown

Tags

aws-sdk, localstack, client-library, dotnet, dotnet-core

Info

24 total downloads
1 downloads for version 1.3.1
Download (118.98 KB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
1.4.1 89.29 KB Sun, 10 Sep 2023 14:20:12 GMT 2
1.4.0 120.87 KB Wed, 01 Feb 2023 08:48:14 GMT 1
1.3.1 118.98 KB Wed, 20 Apr 2022 23:03:58 GMT 1
1.3.0 119.08 KB Sun, 28 Nov 2021 22:34:02 GMT 2
1.2.3.2 78.32 KB Fri, 19 Nov 2021 11:17:23 GMT 0
1.2.3.1 73.16 KB Thu, 18 Nov 2021 15:00:21 GMT 1
1.2.3 74.29 KB Thu, 18 Nov 2021 14:21:18 GMT 1
1.2.2 60.66 KB Sun, 22 Aug 2021 16:13:21 GMT 2
1.2.0.1 59.93 KB Mon, 24 May 2021 12:19:01 GMT 1
1.2.0 59.92 KB Mon, 24 May 2021 12:04:46 GMT 2
1.1.0.2 59.91 KB Mon, 24 May 2021 11:37:11 GMT 0
1.1.0.1 59.21 KB Sun, 07 Mar 2021 19:24:39 GMT 2
1.1.0 59.2 KB Mon, 08 Feb 2021 14:33:08 GMT 1
1.0.0.3 59.21 KB Mon, 08 Feb 2021 13:39:14 GMT 2
1.0.0.2 59.37 KB Mon, 08 Feb 2021 11:45:18 GMT 3
1.0.0.1 42.31 KB Thu, 25 Jun 2020 12:03:44 GMT 0
1.0.0 42.02 KB Fri, 17 Apr 2020 09:08:58 GMT 0
0.8.0.164 17.9 KB Mon, 20 May 2019 18:24:04 GMT 1
0.8.0.163 17.9 KB Mon, 20 May 2019 17:37:24 GMT 1
0.8.0.162 17.89 KB Mon, 20 May 2019 17:28:34 GMT 1