Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Updating multiple Lambda functions using BB pipelines

Sreekanth Raghunath
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 28, 2019

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.

1 answer

1 accepted

3 votes
Answer accepted
Sreekanth Raghunath
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 29, 2019

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)

Matt Webster
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 1, 2023

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events