Create AWS Lambda project

Create new project using AWS Lambda Project (.NET Core - C#) template.

Create project

Create project

On the Select Blueprint window, select Empty Function blueprint and click on the Finish button.

Create project

Once project is created, add the following NuGet Package to the project: AWSSDK.SimpleSystemsManagement.

Create project

Open the Function.cs file and add the following using statements.

using Amazon.SimpleSystemsManagement;
using Amazon.SimpleSystemsManagement.Model;

In Function.cs file, replace the existing FunctionHandler with the following:

public async Task<string> FunctionHandler(string input, ILambdaContext context)
{
    var client = new AmazonSimpleSystemsManagementClient();

    var request = new GetParameterRequest
    {
        Name = "/SampleApp/ConnectionStrings/DBConnection",
        WithDecryption = true
    };

    GetParameterResponse response = await client.GetParameterAsync(request);

    return string.Format("Decrypted Value: {0}", response.Parameter.Value);
}

The code is ready. Build the Lambda project.