Skip to content

Commit

Permalink
Update aws-cs-lambda README (pulumi#837)
Browse files Browse the repository at this point in the history
  • Loading branch information
komalali committed Nov 18, 2020
1 parent 438f0cf commit 6dd5c75
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions aws-cs-lambda/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# AWS C# Lambda
This example creates a lambda that does a simple `.toUpper` on the string input and returns it.
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 below steps.
To deploy your infrastructure, follow the steps below.

### Prerequisites

Expand All @@ -16,23 +16,35 @@ 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.

```bash
dotnet publish ./DotnetLambda/src/DotnetLambda/
```
```bash
dotnet publish ./DotnetLambda/src/DotnetLambda/
```

2. Execute our Pulumi program to archive our published function output, and create our lambda.
```bash
pulumi up -C ./pulumi
```

3. Call our lambda function from the aws cli.
```bash
aws lambda invoke \
--function-name $(pulumi stack output Lambda -C ./pulumi) \
--region $(pulumi config get aws:region -C ./pulumi) \
--payload '"foo"' \
output.json

cat output.json # view the output file with your tool of choice
# "FOO"
```

```bash
pulumi up -C ./pulumi
```

3. Call our Lambda function from the AWS CLI with "foo" as the payload.

```bash
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"
```

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

7. Afterwards, destroy your stack and remove it:

```bash
pulumi destroy --yes
pulumi stack rm --yes
```

0 comments on commit 6dd5c75

Please sign in to comment.