AWS Steps to setup Serverless & Lambda

by Admin 11. February 2017 08:04

AWS Command Line Interface

AWS Toolkit for Visual Studio

Install NodeJS & Git Bash

install node js tools for visual studio

Install serverless globally

The commands are here

npm install serverless -g

Create an AWS Lambda function 

In Node.js

serverless create --template aws-nodejs

 In C#

 serverless create --template aws-csharp -p serverless-Sample1 -n LambdaService

Now open the project in Visual Studio

Add yaml Syntax Highlighting Pack nuget package


Modfiy the serverless.yml file to use the respective access credentails as below


  name: aws

  runtime: dotnetcore1.0

  stage: dev

  region: ${self:custom.configuration.providerRegion}


accessKeyId: ${self:custom.configuration.accessKeyId}

secretAccessKey: ${self:custom.configuration.secretAccessKey}


In the above I have referred the credentials and the region from an external config.yml file.

Here are the steps to do add the external file

Create a new config.yml file

Paste the below config stuff


 #AWS config

providerRegion: eu-west-2 (you need to set yours here)




Going back to servreless.yml file

You add / modify default settings

eg: I have added to exclude teh git stuff as part of the deployment package

# you can add packaging information here


  artifact: bin/release/netcoreapp1.0/publish/


  - .git/**

Now right click build.ps1 file and open with powershell

Now run this command 


Now the buid will be completed an places a folder in the below location and created a file to deploy


serverless-Sample1 is my application name

Now go to the gitbash "C:\VENKAT\Learning\AWS\Dev\Serverless-Sample1>" location

Now deploy the code on the serve rusing the following command

sls deploy

The above deploy happends from the default location as below


The code is successfully deployed on the server now.

Now go to the AWS Lamda

Search for Lamda

You should be able to view the lambda function we created

You can test by clicking the Test button.


Now its time to deploy the Lambda function on to the API Gateway

Go to the API gateway location by searching


Here you should be able to view the function which needs to be deployed on to API gateway

Now configure Method Execution  /users/create - GET - Method Request

You can add the 3 query params key1, key2 & key3

Now add a method HTTP Status: 200

Set the Use Lambda Proxy integration to False (UnCheck)


Now deploy the site from the Actions dropdown.

Test the function here 



Make sure you deploy


Deploy to live AWS account

serverless deploy

UFunction deployed!


Janisha-GBRL01483M17.pdf (566.60 kb)

Vijay-GBRL01481M17.pdf (564.19 kb)


Comments are closed


Tag cloud