Creating a Serverless AWS Lambda Webapi with AWS Toolkit – Part 1

In this tutorial I’ll create a Serverless AWS lambda webapi using, AWS Toolkit along with Visual Studio 2017, which will help to write and deploy the API all from inside the Visual Studio interface.

Why the focus on AWS Toolkit?

I’ve been interested in AWS for a while and I’ve noticed they have recently promoted their .NET core services by providing .NET tools, webinars and tutorials. In the recent 2018 AWS summit in Chicago, they dedicated multiple topics to using their cloud for the development and the deployment of .NET applications. They toted “AWS loves .NET”, in a way to attract more .NET workshops to shift to AWS instead of using cloud services from their biggest competitor — Azure.

 

 

 

What is the AWS toolkit?

The AWS toolkit is a Visual Studio extension that supports 2013, 2015, and 2017 (only the Windows version, Mac version is not supported yet). This tool helps developers to create, debug, and publish applications to AWS all from Visual Studio. Such tasks can also be done using AWS console  and they also have a similar AWS tool for Eclipse for other languages.

Let’s create a simple serverless .NET core webapi with lambda to demonstrate using this tool in Visual Studio and will be using some other services such as S3 and IAM but won’t discuss their definition in this tutorial.

Creating a user

In order to set up and use the AWS Toolkit, create a user with administrator policy, then use this user’s access and secret keys to complete the setup.

Creating a user should be easy. After logging into AWS console, go to IAM then Users then click the “Add user” blue button. Then add the user information in 5 steps as below.

 

 

 

Step 3 is all about adding tags and more information to the account, and step 4 is a review page. Then you should be able to see the step 5 page, which has the access key as well as the secret key. Instead of copying these key, click the “download csv” button to get a csv file with the keys. Import the given csv file into the AWS toolkit later inside Visual Studio.

 

 

Installing AWS toolkit

The tool is available on AWS website, but its also available among other VS 2017 extensions. You’ll be installing it that way. Under “Tools” -> “Extensions and updates” and then search for “AWS Toolkit” in the online extensions list, it should be right in the top. Click download. This might request you to restart Visual Studio to finish the installation.

 

 

After restarting Visual Studio, you’ll be greeted by the AWS Toolkit welcome screen where the user’s access and secret keys should be added. In this case, click “Import from csv file” and that will take care of adding both of the keys. Finally, click the “Save and Close” yellow button.

 

 

In the next tutorial, we’ll Create AWS Lambda Project.