关于Greengrass组仅含多Core设备及Lambda订阅配置的技术问询
Hey there! Let's break down your two questions about AWS Greengrass multi-core groups and Lambda subscriptions:
Absolutely! AWS Greengrass fully supports multi-core Greengrass groups where all devices in the group are Greengrass Core devices—you don’t need to include any edge (non-core) devices at all.
Here’s what you need to keep in mind:
- Each core device must first be registered in your AWS account, with the Greengrass Core software installed and properly configured.
- When setting up the group, during the device addition step, just select "Greengrass core" for every device you want to include.
- Multi-core groups are specifically designed for use cases like distributed processing, cross-core device communication, or running redundant workloads across multiple core devices.
Since you need Lambda functions on different cores to send and receive messages, let’s cover both intra-core (same device) and inter-core (different devices) communication scenarios:
Intra-core Lambda communication (same core device)
If you want instances of the same Lambda on the same core to communicate with each other:
- Create a subscription with these settings:
- Source: The ARN (or function name) of your Lambda.
- Target: The exact same Lambda ARN/function name.
- Topic: A custom MQTT topic (e.g.,
local/lambda/intra-core/messages).
- When the Lambda publishes to this topic, any running instance of the same Lambda on that core will receive the message.
Inter-core Lambda communication (across different core devices)
For Lambda functions on different cores to exchange messages, you’ll leverage Greengrass’s cross-core message routing capabilities:
- First, deploy the Lambda to all core devices:
- In your Greengrass group’s Lambda deployment configuration, select all core devices as the target for the Lambda. Use a consistent version or alias to ensure all cores run identical code.
- Configure subscriptions for cross-core messaging:
- Option 1: Point-to-point communication
- Set Source to your Lambda’s ARN/function name.
- Set Target to the same Lambda ARN/function name.
- Use a topic that includes core identifiers (e.g.,
core/{core-device-id}/lambda/messages) if you want to send messages to a specific core’s Lambda instance.
- Option 2: Broadcast to all cores’ Lambda instances
- Use a broad topic like
core/all/lambda/broadcast. - Configure a subscription where Source is your Lambda, Target is your Lambda, and Topic is this broadcast topic. All cores’ Lambda instances that subscribe to this topic will receive the message.
- Use a broad topic like
- Option 1: Point-to-point communication
- Key reminders:
- Ensure your Lambda has the necessary IAM permissions to publish and subscribe to the MQTT topics you define.
- When deploying the group configuration, make sure the subscription changes are included in the deployment to all core devices.
内容的提问来源于stack exchange,提问作者techy

