“Units” in Cloud Platforms and Services

When it comes to costing/pricing on cloud based platforms such as Azure or AWS, it is always a confusion especially for beginners what various units mean. Let us have a look at some such common unit terminologies.

  1. SKU – Stock Keeping Unit – A purchasable units in a platform. Ref – https://en.wikipedia.org/wiki/Stock_keeping_unit

  2. ACU – Azure Compute Unit – A unit used to compare compute performance across Azure SKUs. Ref – https://docs.microsoft.com/en-us/azure/virtual-machines/acu
  3. TU – Transaction Unit – Usually 10K transactions = 1 Transaction Unit
  4. DTU – Database Transaction Unit – Ref – https://docs.microsoft.com/en-us/azure/azure-sql/database/purchasing-models#understanding-dtus
  5. eDTU – elastic DTU – Ref – https://docs.microsoft.com/en-us/azure/azure-sql/database/purchasing-models#dtu-based-purchasing-model
  6. RU – Request Unit – Ref – https://docs.microsoft.com/en-us/azure/cosmos-db/request-units
  7. DBCU – Databricks Commit Unit – Ref – https://azure.microsoft.com/en-in/pricing/details/databricks/
  8. DBU – Databricks Unit – Ref – https://docs.databricks.com/administration-guide/capacity-planning/cmbp.html
  9. DPU – Database Processing Unit – Ref – https://aws.amazon.com/glue/pricing/

This list will be updated regularly.

Whitepaper on Designing an efficient Virtual Queue Management System

Recently I wrote a research paper on the said topic, and here are the links I published:

  1. Original, updated version @ GitHub – https://github.com/ninethsense/VirtualQueue/blob/master/README.md
  2. Medium – https://medium.com/@ninethsense_8477/yet-another-virtual-queue-management-system-design-44cdee123a0b

Additionally, a small excerpt in a Malayalam online news paper – https://www.janmabhumi.in/read/bevq-failure-is-a-lesson-how-to-build-the-best-virtual-queue-app/

How to setup AWS SES / Simple Email Service

This is a tutorial on how to setup AWS SES / Simple Email Service.

Step 1 – Login to your AWS Console, then choose Services –> Customer Engagement –> Simple Email Service

image

Step 2 – Verify a New Domain

Choose “Domains” from left navigation panel, then click –> Verify a New Domain button

image

Step 2.2 – Enter Domain name

image

Also click checkbox Generate DKIM settings, though optional, I will be using this.

You will be displayed with a list of DNS settings in the next screen.

image

Once you completed the Step 3, click close.

Step 3 – Edit DNS records

You will have to login to your domain control panel and add these.

I will be using cPanel for this exercise. Steps are almost same with any domain/hosting control panel.

image

Step 4 – Wait for the domain to get verified. Click refresh icon on the right-top whenever you are impatient.

image

You have nothing to do here. Just wait for some 2-5-10 minutes.

image

Step 4.1 – Verify Email Address

You cannot even send a test mail, unless you have a email id verified.

Choose ‘Email Addresses’ from the left-navigation panel and click “Verify a New Email Address” button.

image

Make sure you enter an already existing email id.

image

A verification mail will be sent to your inbox.

There will be a URL you are expected to click, and you are verified.

image

Once verified, you should be able to see the verification status updated in AWS console too.

image

Step 5 – Send test mail.

Go back to Domains –> “Send a Test Mail” button.

image

Create AWS Lambda function with .NET Core / C# and create a HTTP API Gateway trigger | Part #2

In this Part #2 of blog I will be creating a new .NET Core function in local machine and will upload to AWS using console interface. There are different ways you can develop and deploy but I will be talking in this blog only about the CLI way.

I am assuming you know how to create a Lambda function in AWS console already and if not, please read the Part #1 first.

Open the Command prompt and follow below steps:

Step 1: Install Lambda Templates for .NET Core

dotnet new -i Amazon.Lambda.Templates

Step 2: Create an empty function

dotnet new lambda.EmptyFunction –name MyTestLambdaFun


You should be able to see a folder structure like this is created.

image

under src\projectname you can see a Function.cs file which is our starting point.

Code will look like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

using Amazon.Lambda.Core;

// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]

namespace MyTestLambdaFun
{
     public class Function
     {
        
         /// <summary>
         /// A simple function that takes a string and does a ToUpper
         /// </summary>
         /// <param name="input"></param>
         /// <param name="context"></param>
         /// <returns></returns>
         public string FunctionHandler(string input, ILambdaContext context)
         {
             return input?.ToUpper();
         }
     }
}

Step 3 – Modify the code to return HTTP 200 status code.

It is necessary for lambda functions to return 200 status code, or else the function will work in AWS console when you “Test”, but the API Gateway endpoint will not.

After adding the StatusCode property, the function will look like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

using Amazon.Lambda.Core;

using Amazon.Lambda.APIGatewayEvents;

// Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class.
[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))]

namespace MyTestLambdaFun
{
     public class Function
     {
        
         /// <summary>
         /// A simple function that takes a string and does a ToUpper
         /// </summary>
         /// <param name="input"></param>
         /// <param name="context"></param>
         /// <returns></returns>
         public APIGatewayProxyResponse FunctionHandler(ILambdaContext context)
         {
             return new APIGatewayProxyResponse
             {
                 Body = "Hello Lambda, from Praveen",
                 StatusCode = 200
             };

            
         }
     }
}

Do:

dotnet build


Now, if you are getting an error on APIGatewayProxyResponse, then you will have to install the dependency. Below command will help you:


dotnet add package Amazon.Lambda.APIGatewayEvents 

(Refer to nuget page)

Try again dotnet build, and I am expecting to have the build succeeded.

image

Step 4 – Package the function

If you have not installed Lambda tools, then install it first:

dotnet tool install -g Amazon.Lambda.Tools

Then use the command:

dotnet lambda package

image

Notice the last line, you will get path to a zip file which you have to upload to AWS Lambda.

Step 5 – Upload the package to AWS console

Login to AWS Console and navigate to your lambda function. In this example I am going to use the same function we created in Part #1.

Scroll up and you should see a “Function Code” section like this:

image

Upload your ZIP file by clicking the upload button.

Next, you have to do one important task. Go to the source code folder again and open a file named “aws-lambda-tools-defaults.json”.  You will have to copy the function-handler property value to the “Handler” textbox in “Function code” section.

image

image

image

Then click “Save” button.

Step 6 – Test the function

Click “Test”. You should see the test result like this: (Our function is not expecting an input parameter so you can create a dummy test event)

image

As a bonus, let us see how we can create a HTTP endpoint to this function.

Step 7 – Create API Gateway

Click “Trigger” button:

image

In the next screen, make these selections and click “Add”:

image

You will be redirected back to the dashboard. Scroll up and you will see a new section “API Gateway” with a new API endpoint URL. Use the link in browser to test.

image

image

Happy Lambda development!

You have noticed that I was rushing to finish the blog by not explaining in detail each step. I am leaving the rest to you as home work intentionally.

Refer to official .NET Core CLI documentation here.

Create AWS Lambda function with .NET Core / C# | Part #1

This blog explains how you can create an AWS Lambda function with .NET Core / C# as runtime.

Step 1 – Create function

Step 1.1 – Login to your AWS account, and select “Lambda from the services”

image

Step 1.2 – Click “Create Function”

image

Step 1.3 – Choose “Author From scratch”

image

There are advanced templates available, but I am keeping those out of the scope of this article.

Now fill,

  • Function name
  • Runtime, our case .NET Core (I am choosing the version .NET Core 3.1, which is the latest version when writing this article)

Click “Create function”

image

Usually it will take 10 to 15 seconds to get the function created. Once finished, you will be redirected to the Designer page.

Step 2 – Test the function

Step 2.1 – Configure test events – Select the test events drop down item

image

Step 2.2 – Fill in Event Name and enter some test input value (the built in template function is not expecting any input but we will require this when trying API Gateway in Part #2 blog) and click “Create”

image

Step 2.3 – Click “Test” button to test the function

Test result should show like this:

image

In Part #2 we will see how you can create a custom .NET Core function and deploy to AWS Lambda.