Skip to content
This repository hosts various libraries that help developers configure .NET applications using AWS services.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
samples Rename files/folders with AWSSDK prefix with Amazon Dec 10, 2018
src Replace PackageLicenseUrl with PackageLicenseFile Mar 4, 2019
test Add extension method to IConfiguration that can be used to force Lamb… Dec 13, 2018
.gitignore
Amazon.Extensions.Configuration.sln
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE Creating initial file from template Sep 24, 2018
NOTICE
README.md Updated README.md with links to nuget package (#24) Dec 17, 2018
logo.png
public.snk Add strong-name signing Dec 10, 2018

README.md

.NET on AWS Banner

AWS .NET Configuration Extension for Systems Manager

nuget

Amazon.Extensions.Configuration.SystemsManager simplifies using AWS SSM's Parameter Store as a source for configuration information for .NET Core applications. This project was contributed by @KenHundley.

The library introduces the following dependencies:

Getting Started

Follow the examples below to see how the library can be integrated into your application. This extension adheres to the same practices and conventions of Configuration in ASP.NET Core.

ASP.NET Core Example

The most common use case for this library is to pull configuration from Parameter Store. You can easily add this functionality by adding 1 line of code:

public class Program
{
    public static void Main(string[] args)
    {
        CreateWebHostBuilder(args).Build().Run();
    }

    public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
        WebHost.CreateDefaultBuilder(args)
            .ConfigureAppConfiguration(builder =>
            {
                builder.AddSystemsManager("/my-application/");
            })
            .UseStartup<Startup>();
}

HostBuilder Example

Microsoft introduced .NET Generic Host to de-couple HTTP pipeline from the Web Host API. The Generic Host library allows you to write non-HTTP services using configuration, dependency injection, and logging features. The sample code below shows you how to use the the AWS .NET Configuration Extension library:

namespace HostBuilderExample
{
    public static async Task Main(string[] args)
    {
        var host = new HostBuilder()
            .ConfigureAppConfiguration((hostingContext, config) =>
            {
                config.AddSystemsManager("/my-application/");
            })
            .ConfigureServices((sc) => { ... })
            .Build();

        await host.RunAsync();
    }
}

Samples

For more complete examples, take a look at sample projects available in samples directory.

Reloading in AWS Lambda

The reloadAfter parameter on AddSystemsManager() enables automatic reloading of configuration data from Parameter Store as a background task.

In AWS Lambda, background tasks are paused after processing a Lambda event. This could disrupt the provider from retrieving the latest configuration data from Parameter Store. To ensure the reload is performed within a Lambda event, we recommend calling the extension method WaitForSystemsManagerReloadToComplete from the IConfiguration object in your Lambda function. This method will immediately return unless a reload is currently being performed. The WaitForSystemsManagerReloadToComplete extension method to IConfiguration is available when you add the a using Amazon.Extensions.Configuration.SystemsManager statement. See the example below:

using Amazon.Extensions.Configuration.SystemsManager

...

var configurationBuilder = new ConfigurationBuilder();
configurationBuilder.AddSystemsManager(IntegTestFixture.ParameterPrefix, fixture.AWSOptions);
var configurations = configurationBuilder.Build();

...

configurations.WaitForSystemsManagerReloadToComplete(TimeSpan.FromSeconds(5));

Getting Help

We use the GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them.

If you think you may have found a bug, please open an issue

Contributing

We welcome community contributions and pull requests. See CONTRIBUTING.md for information on how to set up a development environment and submit code.

Additional Resources

AWS .NET GitHub Home Page
GitHub home for .NET development on AWS. You'll find libraries, tools, and resources to help you build .NET applications and services on AWS.

AWS Developer Center - Explore .NET on AWS
Find all the .NET code samples, step-by-step guides, videos, blog content, tools, and information about live events that you need in one place.

AWS Developer Blog - .NET
Come see what .NET developers at AWS are up to! Learn about new .NET software announcements, guides, and how-to's.

@awsfornet
Follow us on twitter!

License

Libraries in this repository are licensed under the Apache 2.0 License.

See LICENSE and NOTICE for more information.

You can’t perform that action at this time.