Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Deploy this example with Pulumi Deploy this example with Pulumi

AWS C# Lambda

This example creates an AWS Lambda function that does a simple .ToUpper on the string input and returns it.

Prerequisites

  1. Install Pulumi
  2. Configure AWS credentials
  3. Install .NET

Deploying the example

  1. Build and publish the Lambda function, making the output available to the Pulumi program:

    dotnet publish ./DotnetLambda/src/DotnetLambda/ -c Release
  2. Create a new stack and set the AWS region to deploy into:

    pulumi stack init dev -C ./pulumi
    pulumi config set aws:region us-east-1 -C ./pulumi
  3. Deploy the stack to archive the published function output and create the Lambda:

    pulumi up -C ./pulumi
  4. Call the Lambda function from the AWS CLI with "foo" as the payload:

    aws lambda invoke \
    --function-name $(pulumi stack output Lambda -C ./pulumi) \
    --region $(pulumi config get aws:region -C ./pulumi) \
    --cli-binary-format raw-in-base64-out \
    --payload '"foo"' \
    output.json
    
    cat output.json # view the output file with your tool of choice
    # "FOO"

From there, feel free to experiment. Simply making edits, rebuilding your handler, and running pulumi up will update your function.

Cleaning up

Once you're finished experimenting, you can destroy your stack and remove it to avoid incurring any additional cost:

pulumi destroy -C ./pulumi
pulumi stack rm -C ./pulumi