AWS Dev Lambda

Lambda is a Serverless managed compute service from AWS.

AWS Console

Create a Lambda Function

  1. Open AWS Console
  2. Open Lambda service
  3. Create function
    1. Browse serverless app repository
    2. Select hello-world
    3. Enter a valid identityNameParameter
    4. Deploy

Test a Lambda Function

  1. Open your Lambda function
  2. Click on Test App
  3. At the bottom, click on the function name
  4. Click on Test
    1. Create a new event for testing
    2. Validate
  5. Select event in drop down
  6. Click on test
  7. The function is executed and you can see traces and output.
  8. You can edit the function with the built-in editor on the same screen
  9. You can monitor your function using monitor tab

SAM

  1. Install the AWS SAM CLI
  2. run the init command
    sam init
    
    1. Choose 1 for the quickstart template
    2. Choose your prefered language
    3. Select the default name
    4. Select Hello World Example
  3. If you have docker installed, you can test the function locally
     sam local invoke "HelloWorldFunction" -e events/event.json
    
  4. You can now deploy your function to AWS
     sam deploy -g
    
  5. You can delete your stack using aws cli
     aws cloudformation delete-stack --stack-name ${stackname} --region ${region}
    

Comments