Reputation: 381
Have recently setup a basic CodePipeline on AWS (following this guide: https://docs.aws.amazon.com/lambda/latest/dg/build-pipeline.html) which is triggered when there is a new commit on the CodeCommit repository.
But even though after successful execution of the pipeline the lambda function is not updated.
My buildspec.yml:
version: 0.2
phases:
install:
runtime-versions:
nodejs: 12
build:
commands:
- npm install
- export BUCKET=xx-test
- aws cloudformation package --template-file template.yaml --s3-bucket $BUCKET --output-template-file outputtemplate.yml
artifacts:
type: zip
files:
- template.yml
- outputtemplate.yml
My template.yaml:
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
helloWorld
API Gateway connectivity helloWorld
Globals:
Function:
Timeout: 3
Resources:
HelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: ./
Handler: app.lambdaHandler
Runtime: nodejs12.x
Events:
HelloWorld:
Type: Api
Properties:
Path: /hello
Method: get
Is there any additional configuration that need to be done?
Upvotes: 1
Views: 2177
Reputation: 238051
From what you've posted, it seems that your last action is CHANGE_SET_REPLACE
? If so this would explain why there are no updates to your lambda function. Namely, this only creates a changeset, but doesn't not execute it. It other words, it does not apply it.
You need to add new action after CHANGE_SET_REPLACE
action, which is called CHANGE_SET_EXECUTE
. This action will take the changes created by the CHANGE_SET_REPLACE
, and actually apply it to your stack.
How to add such an action is described in Complete the deployment stage of the tutorial you've provided:
Change sets let you preview the changes that are made before making them, and add approval stages. Add a second action that executes the change set to complete the deployment.
Upvotes: 3