The Amazon Web Services (AWS) command-line interface — the
awscli — lets you update the code of a Lambda function right from the cli. Here's how.
aws lambda update-function-code \ --function-name my-function-name \ --region us-west-2 \ --zip-file fileb://lambda.zip
Let's understand what you need to run this command.
aws lambda update-function-code- to execute this command you need the
awscliinstalled on your machine and your authentication information has to be configured to your account
--function-name- this is the name of an existing Lambda function in your AWS account
--region- the region in which your Lambda lives (in this case, it's Oregon, whose code is
us-west-2, you can see a list of regions and their codes here)
--zip-file- this is the path to your zipped Lambda code with the
fileb://prefix, in the example, there's a
lambda.zipfile in the current directory, alternatively you can use the
--s3-keyto use a zip file from an S3 bucket)