Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (32 sloc) 3.29 KB

Create and Package the Lambda Function

  1. Download the Lambda function code to your computer (not the Greengrass core device), as follows:

    1. In a web browser, open the file on GitHub.

    2. Choose Raw to open the unformatted version of the file.
      [GitHub controls with the Raw button highlighted.]

    3. Use Ctrl + S (or Command + S for the Mac) to save a copy of the file. Save the file to a folder that contains the greengrasssdk folder. Note
      For UNIX-like systems, you can run the following Terminal command to download the file:

    sudo wget
  2. Package the file with the SDK into a .zip file, as described in Module 3 (Part 1). Name the package
    [Screenshot showing zipped contents of]

  3. In the Lambda console, create a Python 2.7 function named Greengrass_HelloWorld_Counter, as described in Module 3 (Part 1). You can use the existing role.

  4. Upload your Lambda function deployment package, as follows:

    1. On the Configuration tab, under Function code, set the following fields:

      • Code entry type - choose Upload a .ZIP file.
      • Runtime - choose Python 2.7.
      • Handler - type greengrassHelloWorldCounter.function_handler.
    2. Choose Upload, and then choose
      [Function code screenshot with Code entry type set to Upload a .ZIP file, Runtime set to Python 2.7, Handler set to greengrassHelloWorldCounter.function_handler, and Function package set to]

    3. At the top of the page, choose Save.

  5. Publish the first version of the function, as follows:

    1. From the Actions menu, choose Publish new version. For Version description, type First version.

    2. Choose Publish.

  6. Create an alias for the function version, as follows:

    1. From the Actions menu, choose Create alias, and set the following values:

      • Name - type GG_HW_Counter.
      • Version - choose 1.
    2. Choose Create.
      [Create a new alias screenshot with the Name field set to GG_HW_Counter, the Version field set to 1, and the Create button highlighted.]

    Recall that aliases create a single entity for your Lambda function that AWS Greengrass devices can subscribe to without having to update subscriptions with Lambda version numbers every time the function is modified.