1
votes

I follow the tutorial on http://docs.aws.amazon.com/lambda/latest/dg/automating-deployment.html

The tutorial demonstrate how to automatically deploy a lambda and an API gateway using AWS cloudformation.

After some time I was able to complete the tutorial with success. This means that when I push a commit to the github repository linked to the AWS CodePipeline the changed code is uploaded/packaged to AWS -> build -> and deployed (i.e. i can see the code change)

My problem is that I tried to delete the lambda function and then invoke the Codepipeline by pushing a git commit. This trickered the codepipeline and I could watch source, build and staging steps complete successfully. However, I cannot find the lambda? I thought that cloudformation would recreate the application ? Can you help?

2

2 Answers

4
votes

If you deleted the function manually then you're most likely running into this issue:

Resources that are created as part of an AWS CloudFormation stack must be managed from the same stack. Modifications to a resource must be done by a stack update. If a resource is deleted, a stack update is also necessary to remove the resource from the template. If a resource has been accidentally or purposely manually deleted, you can encounter errors when attempting to perform a stack update.

https://aws.amazon.com/premiumsupport/knowledge-center/failing-stack-updates-deleted/

You can resolve this by manually recreating the resource with the same name, then allowing CloudFormation to manage the resource in future.

1
votes

The reason why I did not see any lambda function was because I only created the change set ("create or update change set") and missed to add the actual deploy stage "execute change set".