GenTel
GenTel

Reputation: 1558

Updating AWS Lambda with New Zip File?

So I've created an AWS Lambda using a the AWS CLI. I did this by running the command:

aws lambda create-function

with the argument

--zip-file fileb://file-path/zipFile.zip

So then I want to make a change to the source code, so I made a new zip file but the lambda still executes with the old zip file's source code. Thus I tried to run the same command again but got the following error:

Function already exist: FunctionName

So either I just have to abandon that function and create a new one with the new zip file or there's some way for me to update the existing function to use the new zip file's code.

Is there a way for me to do this update, and if so, how?

Upvotes: 1

Views: 3044

Answers (1)

Dark Falcon
Dark Falcon

Reputation: 44191

create-function, as the name implies, creates functions. It does not update them with new code. For that you need update-function-code. This also takes a --zip-file argument.

While this updates the code, you may also need to publish a new version of the function for the changes to take effect. This can be done by adding the --publish argument to update-function-code, or as a separate step with the publish-version command.

Upvotes: 2

Related Questions