aws-lambda

Topics related to aws-lambda:

Getting started with aws-lambda

AWS Lambda is a serverless setup for executing functions in the cloud. It leverages existing Amazon Web Services technologies to infinitely scale and run only when necessary in it's own isolated environment. Using Lambda, you can upload your code, configure it to run based on a variety of triggers, and then automatically decommission the process when complete. It operates on a pay-per-use model and is extremely cost effective and easy to scale.


AWS Lambda supports code written in Node.js (JavaScript), Python, Java (Java 8 compatible) and C# (.NET Core). Your code can include existing libraries, even native ones.

Triggers can include:

HTTP Endpoints

  • Mobile Apps
  • Other AWS Services (Including REST implementation with Amazon API Gateway)

Lambda is best designed for real-time serverless data processing such as:

  • File processing of uploads
    • Transcoding
    • Indexing
    • Validation
    • Resizing & Filtering
  • Streaming data analysis
  • Telemetry
  • Run as a method-based mobile and web backend
  • Extending and linking other AWS products

AWS Lambda triggered by S3

aws-lambda triggered by S3

File names

Unlike most file paths, the S3 key name (JSON Schema: $.Records[0].s3.object.key) does not include a leading slash. So, if you have a file in the path s3://mybucket/path/file.txt, the key will be path/file.txt

In Python at least, the key field value is UTF-8 URL encoded. This is noticeable when the filename contains spaces or non-ascii characters. The field needs to be URL decoded, then UTF-8 decoded - See Get non-ASCII filename from S3 notification event in Lambda

Records key

It is possible to have multiple of the same (or different) actions inside of the "Records" key of the event; however, in practice, you will usually see one event per invocation of your Lambda function.

More Examples & Testing

There are actually sample events in the Lambda console, if you choose Actions -> Configure Test Event. However, You can see the PUT operation in the examples above.

You can modify and submit test events from the AWS Lambda console to see how your function responds.

AWS Lambda using Python

Serverless Framework

alexa-skills-kit

How to develop aws-lambda(C#) on a local machine

Install Required Components

At the time of this writing (Jan 2017), the following components will need to be installed on your machine in this order. The machine I used had Windows 10 Home installed.

  1. Visual Studio 2015 update 3
  2. AWS Toolkit for Visual Studio 2015 - version 1.11.2.0
  3. Microsoft .NET Core Tools (Preview 2) - version 14.1.21111.0

Each of these components are actively developed and released, so double check the links and versions and update this document when needed.

Each of these can take some time to install, so be patient, do one at a time to minimize mistakes.

Lastly, rebooting Windows before starting development is sad, but always a good idea after doing major development tool installations on a Windows box.

AWS Lambda with S3