Lambda Exporter — AWS Lambda Functions Export Utility
This script exports all AWS Lambda functions (code and configuration) from your account to a local directory, for backup, migration, or auditing.
Requirements
- Python 3.7+
boto3- AWS credentials configured (via CLI, environment variables, or IAM role)
Install:
pip install boto3
Usage
-
Default (uses default AWS profile and region
us-east-1)exporter = LambdaExporter() exporter.export_all_functions() -
Custom profile and region
exporter = LambdaExporter(profile_name='my-profile', region_name='eu-west-1') exporter.export_all_functions(base_dir='backups') -
Run directly
Save aslambda_exporter.pyand run:python lambda_exporter.py
Output Structure
lambda_export/
└── export_YYYYMMDD_HHMMSS/
├── FunctionName1/
│ ├── configuration.json
│ └── [extracted source files...]
├── FunctionName2/
│ ├── configuration.json
│ └── function_code.bin # if not a ZIP
└── export_summary.json
- ZIP-based functions are fully extracted.
configuration.jsoncontains runtime, memory, timeout, env vars, role, etc.export_summary.jsonlogs total functions and success count.
Required IAM Permissions
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"lambda:ListFunctions",
"lambda:GetFunction",
"lambda:GetFunctionConfiguration"
],
"Resource": "*"
}
]
}
Important Notes
- The script is read-only — it does not modify any AWS resources.
- Environment variables (including secrets) are included in
configuration.json. Handle exports securely and avoid committing them to version control. - Pre-signed download URLs are used immediately, so expiration is not an issue for typical function sizes.
وصلى الله على نبينا محمد وعلى آله وصحبه وسلم
الوصف
اللغات
Python
100%