AWS Lambda Essentials

AWS Logo

AWS Lambda Essentials

AWS Logo

Deploy From CLI

lambda_function.py

import json

print('Loading function')

def lambda_handler(event, context):
    print("Hello World!")
zip function.zip python_function.py 
aws lambda create-function --function-name HelloWorldPython --zip-file fileb://function.zip --handler python_function.lambda_handler --runtime python3.7 --role arn:aws:iam::999999999999:role/LambdaRole
{
    "FunctionName": "HelloWorldPython",
    "FunctionArn": "arn:aws:lambda:us-east-1:999999999999:function:HelloWorldPython",
    "Runtime": "python3.7",
    "Role": "arn:aws:iam::999999999999:role/LambdaRole",
    "Handler": "python_function.lambda_handler",
    "CodeSize": 281,
    "Description": "",
    "Timeout": 3,
    "MemorySize": 128,
    "LastModified": "2022-04-05T01:35:36.249+0000",
    "CodeSha256": "h9AEbl2IE9r+D3hcfFhkDFExL8JVFEtV51VOPL5xmXY=",
    "Version": "$LATEST",
    "TracingConfig": {
        "Mode": "PassThrough"
    },
    "RevisionId": "fe568404-6ff8-4195-99ab-d3a23d669134",
    "State": "Pending",
    "StateReason": "The function is being created.",
    "StateReasonCode": "Creating",
    "PackageType": "Zip",
    "Architectures": [
        "x86_64"
    ]
}
  • https://docs.aws.amazon.com/lambda/latest/dg/lambda-services.html
  • https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html