Reputation: 34109
I want to create a jenkins
job that will publish a new AWS lambda version
and update existing alias
to new version just created.
I already have prod
alias created in AWS Lambda.
Now i would i like to publish a new version and the update prod
alias to point to new version.
There is walkthrough shows how to do it using AWS CLI
. So here are the corresponding steps
1>Publish a new version of the Lambda function.
aws lambda publish-version --function-name helloworld
2>Update prod
alias to latest version.
aws lambda update-alias --function-name helloworld function-version 2 --name prod
ISSUE
In Jenkins i will have to execute these commands as windows batch command
But i am not able to understand how do i dynamically pass the version number that was created by publish-version
command in step 1, to update-alias
command in step 2?
Upvotes: 2
Views: 448
Reputation: 11
You can use below aws CLI command in the execute shell.
VERSION=$(aws lambda publish-version --function-name helloworld | jq -r .Version)
aws lambda update-alias --function-name helloworld --name prod --function-version $VERSION
Upvotes: 1