Skip to content

Instantly share code, notes, and snippets.

@andywirv
Created November 22, 2016 19:58
Show Gist options
  • Save andywirv/f312d561c9702522f6d4ede1fe2750bd to your computer and use it in GitHub Desktop.
Save andywirv/f312d561c9702522f6d4ede1fe2750bd to your computer and use it in GitHub Desktop.
Update Lambda function configuration, specifically the environment variables. AWS Cli version aws-cli/1.11.20
#quotes on json, single around entire object and double on each property
aws lambda update-function-configuration --function-name=[lambda function name] --environment '{"Variables":{"abc":"124"}}'
@cameck
Copy link

cameck commented Mar 23, 2017

Thanks! I was going nuts with their documentation!
This doesn't work:

Variables={KeyName1=string,KeyName2=string}

And this is missing a key little part which you noted:

{
  "Variables": {"string": "string"
    ...}
}

@tleyden
Copy link

tleyden commented Jun 5, 2017

I ran into this too! Thanks for posting this workaround.

I filed an issue here: aws/aws-cli#2638

@rushkeldon
Copy link

rushkeldon commented Oct 12, 2017

We are calling update-function-configuration from an npm script and ran into issues around quotes.
I thought I would share the eventual thing that worked.
Note the single quotes around the $npm_config vars.

    "postsync": "aws lambda update-function-configuration --function-name $npm_config_lambda --environment '{\"Variables\":{\"envtype\":\"'$npm_config_envtype'\",\"domain\":\"'$npm_config_domain'\"}}'"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment