2025-11-18 12:07:11 +00:00
2025-11-18 12:03:36 +00:00
2025-11-18 12:07:11 +00:00

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

  1. Default (uses default AWS profile and region us-east-1)

    exporter = LambdaExporter()
    exporter.export_all_functions()
    
  2. Custom profile and region

    exporter = LambdaExporter(profile_name='my-profile', region_name='eu-west-1')
    exporter.export_all_functions(base_dir='backups')
    
  3. Run directly
    Save as lambda_exporter.py and 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.json contains runtime, memory, timeout, env vars, role, etc.
  • export_summary.json logs 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.

وصلى الله على نبينا محمد وعلى آله وصحبه وسلم

الوصف
export all your lambda functions
اقرأني 26 KiB
اللغات
Python 100%