Back to Aws Doc Sdk Examples

AWS IoT Greengrass code snippets

python/example_code/greengrass/README.md

latest2.9 KB
Original Source

AWS IoT Greengrass code snippets

Purpose

Shows how to use the AWS IoT Greengrass Core SDK to create AWS Lambda functions that publish MQTT messages, implement connectors, and retrieve secrets.

These code examples are primarily code snippets that are used in the AWS Iot Greengrass developer guide and are not intended to be used out of context.

Prerequisites

Cautions

  • As an AWS best practice, grant this code least privilege, or only the permissions required to perform a task. For more information, see Grant Least Privilege in the AWS Identity and Access Management User Guide.
  • This code has not been tested in all AWS Regions. Some AWS services are available only in specific Regions. For more information, see the AWS Region Table on the AWS website.
  • Running this code might result in charges to your AWS account.

Running the code

These examples are code snippets that are intended to be used in conjunction with the AWS Iot Greengrass developer guide. See the developer guide for setup and usage details.

Example structure

The example contains the following files.

connector_*.py

Shows how to use different kinds of AWS-provided Greengrass connectors. For more information, see AWS-provided Greengrass connectors.

iot_data_client_*.py

Shows how to use various clients to publish MQTT messages.

local_resource_access_volume.py

Shows how to access local volume resources when running in a Greengrass core instance.

secret_resource_access_*.py

Shows how to retrieve secrets. For more information, see Deploy secrets to the AWS IoT Greengrass core.

Running the tests

To run the tests, run the following in your [GitHub root]/python/example_code/greengrass folder.

python -m pytest

Additional information


Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0