The Greengrass Development Kit - Command Line Interface (GDK CLI) is a tool that helps you create Greengrass V2 components either using templates or community repositories.
The AWS IoT Greengrass Development Kit Command-Line Interface (GDK CLI) provides features that help you develop custom Greengrass components. You can use the GDK CLI to create, build, and publish custom components. When you create a component repository with the GDK CLI, you can start from a template or a community component from the Greengrass Software Catalog.
Please follow the GDK CLI public documentation to learn more about the available commands and configuration that GDK CLI has to offer.
Python3 and pip: As the GDK CLI tool is written in python, you need to have python3 and pip installed. The most recent version of python includes pip.
AWS CLI: As you’d have to configure your AWS credentials using AWS CLI before running certain gdk commands.
To install the latest version of CLI using this git repository and pip, run the following command
pip3 install git+https://github.com/aws-greengrass/[email protected]
Run gdk --help
to check if the cli tool is successfully installed.
Configure AWS CLI with your credentials as shown here - https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html.
Note: Following steps are focused as a quick start guide. For more detailed steps, refer our documentation.
gdk component init --template HelloWorld --language python -n HelloWorld
HelloWorld
.cd HelloWorld
Update configuration in gdk-config.json
gdk-config.json
would have placeholders: {
"component": {
"com.example.PythonHelloWorld": {
"author": "<PLACEHOLDER_AUTHOR>",
"version": "NEXT_PATCH",
"build": {
"build_system": "zip"
},
"publish": {
"bucket": "<PLACEHOLDER_BUCKET>",
"region": "<PLACEHOLDER_REGION>"
}
}
},
"gdk_version": "1.0.0"
}
<PLACEHOLDER_AUTHOR>
with your name, <PLACEHOLDER_BUCKET>
with a prefix for an Amazon S3 bucket name and <PLACEHOLDER_REGION>
with an AWS region. The specified bucket will be created in the specified region if it doesn’t exist (name format: {PLACEHOLDER_BUCKET}-{PLACEHOLDER_REGION}-{account_number}
).gdk-config.json
file should look similar to: {
"component": {
"com.example.PythonHelloWorld": {
"author": "J. Doe",
"version": "NEXT_PATCH",
"build": {
"build_system": "zip"
},
"publish": {
"bucket": "my-s3-bucket",
"region": "us-east-1"
}
}
},
"gdk_version": "1.0.0"
}
Build the artifacts and recipes of the component.
gdk component build
gdk component publish
make tests_unit
make tests_integration