|
| 1 | +# AWS Lambda Simple SQS Function Project |
| 2 | + |
| 3 | +This starter project consists of: |
| 4 | +* Function.cs - class file containing a class with a single function handler method |
| 5 | +* aws-lambda-tools-defaults.json - default argument settings for use with Visual Studio and command line deployment tools for AWS |
| 6 | + |
| 7 | +You may also have a test project depending on the options selected. |
| 8 | + |
| 9 | +The generated function handler responds to events on an Amazon SQS queue. The handler receives the bucket and object key details in an SQSEvent instance and returns the content type of the object as the function output. Replace the body of this method, and parameters, to suit your needs. |
| 10 | + |
| 11 | +After deploying your function you must configure an Amazon SQS queue as an event source to trigger your Lambda function. |
| 12 | + |
| 13 | +## Here are some steps to follow from Visual Studio: |
| 14 | + |
| 15 | +To deploy your function to AWS Lambda, right click the project in Solution Explorer and select *Publish to AWS Lambda*. |
| 16 | + |
| 17 | +To view your deployed function open its Function View window by double-clicking the function name shown beneath the AWS Lambda node in the AWS Explorer tree. |
| 18 | + |
| 19 | +To perform testing against your deployed function use the Test Invoke tab in the opened Function View window. |
| 20 | + |
| 21 | +To configure event sources for your deployed function, for example to have your function invoked when an object is created in an Amazon S3 bucket, use the Event Sources tab in the opened Function View window. |
| 22 | + |
| 23 | +To update the runtime configuration of your deployed function use the Configuration tab in the opened Function View window. |
| 24 | + |
| 25 | +To view execution logs of invocations of your function use the Logs tab in the opened Function View window. |
| 26 | + |
| 27 | +## Here are some steps to follow to get started from the command line: |
| 28 | + |
| 29 | +Once you have edited your function you can use the following command lines to build, test and deploy your function to AWS Lambda from the command line (these examples assume the project name is *BlueprintBaseName.1*): |
| 30 | + |
| 31 | +Restore dependencies |
| 32 | +``` |
| 33 | + cd "BlueprintBaseName.1" |
| 34 | + dotnet restore |
| 35 | +``` |
| 36 | + |
| 37 | +Execute unit tests |
| 38 | +``` |
| 39 | + cd "BlueprintBaseName.1/test/BlueprintBaseName.1.Tests" |
| 40 | + dotnet test |
| 41 | +``` |
| 42 | + |
| 43 | +Deploy function to AWS Lambda |
| 44 | +``` |
| 45 | + cd "BlueprintBaseName.1/src/BlueprintBaseName.1" |
| 46 | + dotnet lambda deploy-function |
| 47 | +``` |
0 commit comments