'Backup AWS lambda's functions
I want to backup my configured lambdas in AWS. I already searched online but not mention of how to do this Any idea how to implement this?
Thanks
Solution 1:[1]
(a bit late)
Go to drop down menu "actions", select "export function", then choose "download aws sam file", this will give you a YAML file to use in AWS CloudFormation, then choose the other option "download deployment package".
Now that you have these 2 files you can recreate the Lambda Function as follows:, 1) use the YAML file in CloudFormation, 2) Once you have the function re-created upload the zip package.
Bear in mind that if you have triggers, i.e: Api Gateway, you have to add them manually. Perhaps there is a better way to do this but so far this has worked for me.
Solution 2:[2]
- Open up your function from the 'Lambda Management Console'.
- Navigate to 'Actions>Publish New Version'.
- This will create a read-only copy of your latest version.
Solution 3:[3]
First of all you need to add your lambda code to a version control system. Then you must create a script that automates the deployment of your lambda. You can check the cli documentation for this:
https://docs.aws.amazon.com/cli/latest/reference/lambda/index.html
Another option would be cloud formation.
https://aws.amazon.com/cloudformation/
So you need to add to a VCS yr lambda code and the code that configures/deploys it.
Solution 4:[4]
From what I can see, you need to backup 4 things (at least):
- Functions (aka. Code)
- Triggers
- Destinations
- Permissions (Execution role, including IAM policy)
Possibly these as well depending on your config:
5. Timeout
6. Environment Variables
7. VPC
8. Tags
9. Description
10. Concurrency
11. Memory
12. Other advanced options if you use them
There is probably some way to do this using the AWS CLI, or perhaps Python using boto3.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dharman |
Solution 2 | Gary Vernon Grubb |
Solution 3 | |
Solution 4 | J Roysdon |