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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Use pipline to update layer


I am using bitbucket pipline to deploy my lambdas. For now everything is fine, except for deploying layers. 

in 2018 aws introduced layer for lambdas, mainly used to share a common code (conf, models, ...) between lambdas and also to create runtime environement for not supported langages. 

I have lambdas to manage users (nodejs + mongodb) : create user, login, activate user, update, ...

these lambdas are sharing the same model and configuration. So, I would like to avoid duplicating code, so I thought about creating layer. 

My problem is:

1/ How can I do to update my layer when I deploy my lambda (specify latest layer) ?


I am using (AWS Lambda deploy : v0.3.2maintained by Atlassian)


Thank you in advance for your help. 


Best regards




2 answers

Hi @Alexander Zhukov

I tried the same config but failed. just removed the account number for security.


here is my config file 




        { "Arn": "arn:aws:lambda:eu-west-1:xxxxxxxxxxx:layer:ap-mail-node-pgpool-1:22", "CodeSize": 229879 }




function update part works just file but while updating config it fails

here is the error log

INFO: Updating Lambda function lambda update-function-configuration --function-name ap-mail-ds1-scs-1 --cli-input-json {"Layers": [ { "Arn": "arn:aws:lambda:eu-west-1:xxxxxxxxxxx:layer:ap-mail-node-pgpool-1:22", "CodeSize": 229879 } ]}Parameter validation failed:Invalid type for parameter Layers[0], value: {u'CodeSize': 229879, u'Arn': u'arn:aws:lambda:eu-west-1:xxxxxxxxxxx:layer:ap-mail-node-pgpool-1:22'}, type: <type 'dict'>, valid types: <type 'basestring'>✖ Failed to update Lambda function configuration.

0 votes

Hi @MANI Adel . If you wan't to just add an existing layer to your lambda function, you should create a function configuration json file an reference it in the FUNCTION_CONFIGURATION variable. The pipe will update the function configuration to include the layers.

Example function-configuration.json

{ "Arn": "arn:aws:lambda:us-east-2:123456789012:layer:my-layer:3", "CodeSize": 169 },
{ "Arn": "arn:aws:lambda:us-east-2:210987654321:layer:their-layer:2", "CodeSize": 169 }

 Example pipe configuration:

  - pipe: atlassian/aws-lambda-deploy:0.4.1
      FUNCTION_NAME: 'my-lambda-function'
      COMMAND: 'update'
      ZIP_FILE: ''
FUNCTION_CONFIGURATION: 'function-configuration.json'


Note, that updating or creating a function layer is not supported in the pipe yet. 

Hi @Alexander Zhukov
Thank you for replying my request. 

My question was not clair, I was looking for the way how to deploy an update or publish of layer (publish-layer-version)

I solved this problem by creating aws_nodejs docker image and lauching the the following CLI command : 

aws configure set default.region $AWS_DEFAULT_REGION
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
aws lambda publish-layer-version --layer-name Layer_01 --compatible-runtimes nodejs nodejs10.x nodejs8.10 --zip-file fileb:// --region $AWS_DEFAULT_REGION


Thank you very much for taking in consideration my request. 


Best regards


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Apps & Integrations

🍻🍂Apptoberfest Update: Upcoming Virtual Events 🎉

Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...

148 views 2 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you