Tuesday, August 30, 2016

Lambdas they are everywhere now

What is a Lambda?

The quickest ad fastest response would be:

A Lambda is an entity that is key for "anonymous functions / run code on events" aka...  It does stuff in response to conditions.

"Otherwise think of it as a huge super computer turned off and only runs your functions with conditions happen to keep your cost (maintenance/power/usage) low!

AWS Lambda (Node.js, Java, and Python) - is the service code on behalf of your infrastructure.

Azure uses Functions called (Logic Apps) - 

Google's Cloud Functions -

All of them can do what AWS is doing!

Now let me teach you some quick functions(Lambdas) so you can get started!


Teaching lesson 1 "hello-world"

Step 1:

Pick the wizard that says "Hello World"




Step 2: Put in your names and select 






Step 3: Now its time to learn configure the trigger (The event that makes it happen) :

We will use a Cron (Cloudwatch event schedule):



Step 4 Now just name some random variables, then click enable: 

* Note: If you need help with crons go here: http://www.cronmaker.com/
* I will be using: every day at 2:25pm 

  |25 14 30 * * ? |
--- use * for wild cards meaning every
  | | -| -| -| -|  = min (0 - 60)
    | -| -| -| -|  = hour (0-23)
       | -| -| -|  = day of the month (1-31)
         -| -| -|  = month (1-12)
             | -|  = day of the week
                |  = year








Step 5 now you need to name your function: 



Step 6 scroll down and name the role: 




Step 7 now click next and select create function





Step 8: You are now done, now your trigger is set on a timer to happen!





Running a website in S3 as static, but when a logic page is accessed I want to turn on a system and serve it from there (Elastic Load balance (ELB) with response to code would be the cheapest way unless it was clicked all the time) so a bad choice would be something that is clicked a million times per second.  Because you are charged pennies when you click and for the lambdas.

*So be careful as they can add up if you have 20 lambdas running per trigger.  As it may be smarter to run a small ec2, google vm, Azure vms.  To minimize an ongoing trigger.










No comments:

Post a Comment