aws lambda update-function-configuration: Add --env-file option
often I have this boilerplate code in a shell script:
source .env
aws lambda update-function-configuration \
--region "$REGION" \
--function-name "$FUNCTION_NAME" \
--environment Variables="{\
VAR1=$VAR1,\
VAR2=$VAR2,\
VAR3=$VAR3,\
VAR4=$VAR4,\
(...)
}" > /dev/null
It would be nice if I could do this instead:
aws lambda update-function-configuration \
--region "$REGION" \
--function-name "$FUNCTION_NAME" \
--env-file .env
I'm not a python dev but if you are open to contributions and consider that this feature request makes sense I can propose a PR.
@franciscocpg - thanks for reaching out. In general, currently the CLI works with JSON formats. As such, there is a blog posting that goes into more detail regarding the feature you trying to work with:
Best Practices for Local File Parameters
Please advise if this works for you.
Hi @justnance Thanks for your response.
It does not work because the idea is to keep .env file (using its format) usable across multiples projects/frameworks.
Eg: The .env file with contents:
VAR1=Value1
VAR2=Value2
would be usable by my nodejs project, by docker-compose (https://docs.docker.com/compose/compose-file/#env_file) and by aws cli.
Since .env files are widely used across different projects/frameworks to define environment variables I thought that aws cli could support it too.
@franciscocpg - Thank you for your feedback. I am labeling this as a feature request pending additional 👍 .
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
+1
Rather than adding a "+1" comment, we recommend adding a 👍 to the original post in order to help the team better track the demand of feature requests such as these.
My first thought was that this feature request should be redirected to the Lambda team, so that they could consider adding this ability to the underlying UpdateFunctionConfiguration API. But to add a --env-file option specifically for the CLI would involve creating a customization for this command, and I wonder if there are use cases involving other services/commands that might benefit from this ability as well.