- 最新
- 最多得票
- 最多評論
Hello,
As suggested by the expert can you kindly check the below documenttaion about recipe variables and set the "interpolateComponentConfiguration" configuration option to true:
Also, kindly specify what is the issue you are observing while using "Setenv" as it should be under the lifecycle. Please refer the below documentation:
interpolateComponentConfiguration was already set to true, though I didn't realize it was important for that:
configuration: ... interpolateComponentConfiguration: true
About Setenv; I was just trying everything I thought might work, I realized it probably wouldn't work outside the lifecycle section but tried it anyway since we couldn't get the recipe variables to work.
From the examples you’ve shown, it looks like you’re trying to place environment variables inside of a lambda’s config. This is a config inside of a config, which does not support interpolateComponentConfiguration. What is it exactly that you're trying to change, and how are you deploying this change? You’ll need to use the “merge” option when deploying to set the configuration you need for the component, with the device UUID.
Eg:
"MERGE": { "lambdaExecutionParameters": { "EnvironmentVariables": { "DEVICE_UUID": *the uuid value* } } }
What is it exactly that you're trying to change, and how are you deploying this change? - As I said trying to migrate lambda to component; we have a cloud side lambda (written by someone not working on the project anymore) which is calling GreengrassV2Client({}).send(new CreateComponentVersionCommand({lambdaFunction}) where lambdaFunction contains all the configuration including this; but this DEVICE_UUID can't be included at this time because it is for the component.
We have separate code for deployment wihch is already merging configurations; that is how the effectiveconfig got configuration: ... DEVICE_UUID: "667788aa-bcde-ffee-1122-333344445555" ... and configuration: ... SetEnv: DEVICE_UUID: "667788aa-bcde-ffee-1122-333344445555" ... but we didn't want to have to modify the lambda code to account for the new environmental variable (since the topic is already a variable for the component) or do a find and replace on the configuration at deployment time.
There is different hack we can do running a find and replace on $PREFIX-DEVICE_UUID to change it to the iot thing name, since that is actually what we are using except a few places where we only use the DEVICE_UUID in which case we will need to merge it to the configuration. I was just checking that there wasn't a proper way to add that as a variable that would work in the configuration the same was ${AWS_IOT_THING_NAME} is, but it seems not.
相關內容
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前
Hi, have you checked our documentation about recipe variables? https://docs.aws.amazon.com/greengrass/v2/developerguide/component-recipe-reference.html#recipe-variables And set interpolateComponentConfiguration to true? Also what is your problem with using Setenv? It should be under Lifecycle. See https://docs.aws.amazon.com/greengrass/v2/developerguide/component-recipe-reference.html#recipe-format