I am able to update a single Lambda function using the BB pipelines approach. However, when I try to update multiple Lambda functions with the same script, it terminates the deployment giving an error that it is not able to find the second zipped folder! Below is my script.
pipelines:
default:
- step:
caches:
- pip
script: # Modify the commands below to build your repository.
- apt-get update
- apt-get install -y zip
- cd .aws-sam/build/LambdaFunction && zip -r9 lambda2.zip * -x "bin/*" requirements.txt
- cd .aws-sam/build/KinesisLambdaProcess && zip -r9 lambda1.zip * -x "bin/*" requirements.txt
- pipe: atlassian/aws-lambda-deploy:0.3.0
variables:
AWS_ACCESS_KEY_ID: 'MY AWS_ACCESS_KEY_ID'
AWS_SECRET_ACCESS_KEY: 'MY AWS_SECRET_ACCESS_KEY'
AWS_DEFAULT_REGION: 'us-east-1'
FUNCTION_NAME: 'streametricduplicate-subtract-lambda'
COMMAND: 'update' # 'alias' or 'update'
# Update variables
ZIP_FILE: 'lambda2.zip'
FUNCTION_NAME: 'streametricduplicate-batchdbwite-lambda'
COMMAND: 'update' # 'alias' or 'update'
# Update variables
ZIP_FILE: 'lambda1.zip'
The error I am getting is: "Error parsing parameter '--zip-file': Unable to load paramfile fileb://lambda1.zip: [Errno 2] No such file or directory: 'lambda1.zip'"
Should I create a new Step for the second Lambda or is it possible to get this done within a single step, using multiple Pipes? Kindly advise. Thanks!
Cheers,
Sreekanth.
Got this working by creating multiple Steps - one step per lambda function! For the second Step and on wards, the lambda deployment needs write/executable permissions. So, appropriate permissions need to be added. I just forced it by adding rwx permissions for all users as follows:
- chmod 777 $(find /opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/aws-lambda-deploy-env -type f)
Helpful. To clarify, I had to add the script to modify perms in the second step just before the second pipe runs. That way the output file is there but hasn't tried to be written to the second time.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.