By using AWS re:Post, you agree to the Terms of Use

Easiest way to replicate a lambda?

0

I have two lambdas now in production, and want to set up development copies of them to safely try out new code in. As far as I can tell, Lambda's don't have the built-in prod/dev multicopy capability that Alexa skills do, so it looks like I have to do this manually. Is there a shortcut for doing so? I see that it's possible to export lambda configurations as SAM and/or development package, but the best instructions I've found so far (https://aws.amazon.com/premiumsupport/knowledge-center/lambda-function-migration-aws-sam/) require bouncing the SAM through an S3 instance, and it seems to me that there should be a simpler solution. I can't be the only developer with this need...

2 Answers
1

The best way to do this is to create a CloudFormation template to create the Lambda function. That way you can deploy it as many times as you like in as many accounts as you like. Sure, it's a bit of extra work up front but it saves a bunch of effort later on.

EXPERT
answered 4 months ago
  • Probably good advice. It's another hoop fir a new AWS developer to learn to jump through, though. And it still seems it would have been trivial for AWS to build this into the lambda console... Oh well. So far, it seems like AWS has so many offerings that they can't spend enough time really polishing the UI or docs for any of them.

0

To duplicate a lambda function, select the lambda function you want to duplicate on lambda console, then you can go Actions > Export Function > Download deployment package (at the top right corner)

This downloads a .zip file of the function. Then create a new Lambda, and go "Upload from" (right above the code editor) > ".zip file"

N.B: This duplicates the code and npm modules etc. Not the triggers or permissions of the function. This has to be set manually.

answered 4 months ago
  • I'm already uploading code; what I want to replicate is the configuration. Stack exchange says there's no easy way to do so on AWS. I was hoping a better answer had been created since then, since the use case seems self-evident and implementation would seem trivial.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions