Code Monkey home page Code Monkey logo

aws-greengrass-core-sdk-python's Introduction

Greengrass SDK

The AWS IoT Greengrass Core SDK is meant to be used by AWS Lambda functions running on an AWS IoT Greengrass Core. It will enable Lambda functions to invoke other Lambda functions deployed to the Greengrass Core, publish messages to the Greengrass Core and work with the local Shadow service. You can find the latest, most up to date, documentation at our doc site.

Using AWS IoT Greengrass Core SDK

To use the AWS IoT Greengrass Core SDK, you must first import the AWS IoT Greengrass Core SDK in your Lambda function as you would with any other external libraries. You then need to create a client for 'iot-data' or 'lambda'. Use 'iot-data' if you wish to publish messages to the local Greengrass Core and interact with the local Shadow service. Use 'lambda' if you wish to invoke other Lambda functions deployed to the same Greengrass Core.

Here is an example for using the 'iot-data' client

import greengrasssdk

# Let's instantiate the iot-data client
client = greengrasssdk.client('iot-data')

Now that you have an iot-data client, you can publish requests.

response = client.publish(
    topic='someTopic',
    payload='some data'.encode()
)

Here is an example for using the 'lambda' client.

import greengrasssdk

client = greengrasssdk.client('lambda')

Now that you have a lambda client, you can publish requests.

# Define the payload to pass to the invoked lambda function
msg = json.dumps({
    'message':"hello"
})

# Invoke the lambda function
response = client.invoke(
    FunctionName='arn:<partition>:lambda:<region>:<account id>:function:<function name>',
    InvocationType='RequestResponse',
    Payload=payload,
    Qualifier='2'
)

Compatibility

As new features are added to AWS IoT Greengrass, previous versions of the AWS IoT Greengrass SDK will be incompatible with newer versions of the AWS IoT Greengrass core. The following table lists the compatible SDKs for all GGC releases.

GGC Version Compatible SDK Versions
1.0.x-1.6.x 1.0.x-1.2.x
1.7.x-1.8.x 1.0.x-1.3.x
1.9.x 1.0.x-1.4.x

aws-greengrass-core-sdk-python's People

Contributors

seanc-amazon avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.