1. Packages
  2. AWS
  3. How-to Guides
  4. AWS C# Lambda
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

AWS C# Lambda

aws logo
AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi

    View Code Deploy this example with Pulumi

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

    Deploying the App

    To deploy your infrastructure, follow the steps below.

    Prerequisites

    1. Install Pulumi
    2. Configure AWS Credentials

    Steps

    After cloning this repo, from this working directory, run these commands:

    1. Build and publish the lambda function, making the output available to our Pulumi program.

      dotnet publish ./DotnetLambda/src/DotnetLambda/
      
    2. Execute our Pulumi program to archive our published function output, and create our lambda.

      pulumi up -C ./pulumi
      
    3. Call our 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"
      
    4. From there, feel free to experiment. Simply making edits, rebuilding your handler, and running pulumi up will update your function.

    5. Afterwards, destroy your stack and remove it:

      pulumi destroy --yes
      pulumi stack rm --yes
      
    aws logo
    AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi