0

I've launched this stack and needed to update it's Lamdba function, I've made some amendments and hit deploy, a new version of function was saved, however Lambda application still refers to the first version of function, I've tried to update stack, deploy from local environment and nothing worked, the only way was to re-create the whole stack with a link to modified functions in yml template.

6
  • You can put lambda version number in the file name then pass it as parameter to CF template. CF will not update function unless it knows something is different there, so just update zip isn't enough, you need to change its name. This way you'll re-create lambda only, not the whole stack.
    – Putnik
    Commented Jan 30, 2021 at 17:38
  • I've tried something like that - I've put a renamed zip to S3 and updated it's name in CF template and updated the stack with it, still no luck, it still used an old version (it created a 1 version and $LATEST, the stack was still using the 1st).
    – Mike
    Commented Jan 30, 2021 at 18:50
  • it would be helpful if you paste lambda-related code here or at pastebin.
    – Putnik
    Commented Jan 31, 2021 at 10:07
  • Here is the CF template pastebin.pl/view/f69f7e81. Thanks!
    – Mike
    Commented Jan 31, 2021 at 18:35
  • CodeUri: s3://vod-template-qw1456/vod-TranscodingFunction.zip: you did NOT use the code version there.
    – Putnik
    Commented Feb 1, 2021 at 11:07

2 Answers 2

1

I haven't tested it yet, but it seems that the source of the problem was in S3 event notification settings, the 'Destination' section contains an ARN link which points to the 1st version of the Lambda function. So navigate to S3 bucket name - Properties tab - Event notifications section - Edit notification - Destination section - Lambda function. Hope this helps.

0

My solution might be old, but still working. You can put code version number in the file name then pass it as parameter to CF template. CF will not update function unless it knows something is different there, so just update zip isn't enough, you need to change its name. This way you'll re-create lambda only, not the whole stack.

For example, instead of

CodeUri: s3://bucket/myfunc.zip

use

CodeUri: s3://bucket/myfunc-v0.1.2.zip

and of course update values EVERY time the code changes.

2
  • As I've posted in comment above, this solution's not working, it updates the function, creates a new version but the stack still refers to the 1st version.
    – Mike
    Commented Feb 3, 2021 at 16:14
  • Stack cannot refer to the old function unless it was updated outside of the stack. Something else (NOT the sack) - definitely can. Cannot say more without necessary details.
    – Putnik
    Commented Feb 5, 2021 at 14:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .