- 最新
- 投票最多
- 评论最多
Hello,
Configuration in recipe lifecycle commands is only interpolated during a deployment, changes to configuration outside of a deployment will have no effect until the next deployment happens. In this case, set a static password in a deployment, or else you could execute a command which will read the configuration using IPC (instead of recipe interpolation, IPC will get the up to date value) in order to set the environment variable as you desire.
Cheers,
Michael
If my understanding is correct, you are trying to update the POSTGRES_PASSWORD value through the update_config.py script using the IPC API update_configuration
.
As Micheal says, this will not work since the configuration variables are interpolated at deployment time. The POSTGRES_PASSWORD value is then the default empty string, or whichever value you set in the deployment configuration. As you want to retrieve the value from a secret you should simply set the POSTGRES_PASSWORD environment variable value directly in the Run
script.
You can also refer to this component (https://github.com/awslabs/aws-greengrass-labs-nodered-auth/) that uses https://github.com/awslabs/aws-greengrass-labs-secretsmanagerclient to obtain a secret from the aws.greengrass.SecretsManager
component.
Thanks for your help with this Massimiliano and Michael! I was able to read the secret and set its value in the environment variable.
I would like to know what is the general guidance for where (in the lifecycle) to perform steps to configure the component.
Thank you!
Thank you for the responses pointing me in the right direction. I updated the recipe to use the aws.greengrass.labs.SecrectsManagerClient
component. When I deploy, I get a COMPONENT_VERSION_REQUIREMENTS_NOT_MET
error. Do I need to publish the aws.greengrass.labs.SecrectsManagerClient
component before I can use it in my recipe? Or, is it available in a catalog?
Thanks for your help!
Seems like I do need to build and publish the component - https://github.com/awslabs/aws-greengrass-labs-secretsmanagerclient/issues/1
相关内容
- AWS 官方已更新 1 年前
There is no general guidance as it depends on the type of configuration and how that changes over time. For example, if you only set the configuration directly in the recipe or via the deployment, you can use variable interpolation in the recipe to get the new value. The drawback of this approach is that it forces the restart of the process. If you are not using interpolation, changes to the configuration can be notified to the running component process via the IPC using the SubscribeToConfigurationUpdate method and callback.