Complete the code to define a Lambda function handler in Python.
def lambda_handler(event, context): return [1]
The Lambda handler must return a value, here a string message.
Complete the AWS CLI command to invoke a Lambda function named 'MyFunction'.
aws lambda invoke --function-name [1] output.txtThe function name must match the deployed Lambda function's name.
Fix the error in the Lambda function resource definition in AWS CloudFormation.
Resources:
MyLambdaFunction:
Type: AWS::Lambda::Function
Properties:
Handler: [1]
Role: arn:aws:iam::123456789012:role/lambda-role
Runtime: python3.8
Code:
S3Bucket: my-bucket
S3Key: my-function.zipThe handler is specified as 'filename.functionname'. Here, 'index' is the file and 'handler' the function.
Fill both blanks to create an API Gateway event trigger for a Lambda function in AWS SAM template.
Events:
ApiEvent:
Type: [1]
Properties:
Path: /hello
Method: [2]API Gateway event type is 'Api' and common HTTP method is 'get' for retrieval.
Fill all three blanks to define environment variables for a Lambda function in AWS CloudFormation.
Resources:
MyLambdaFunction:
Type: AWS::Lambda::Function
Properties:
Environment:
Variables:
[1]: [2]
[3]: "production"Environment variables are key-value pairs. Here, LOG_LEVEL is set to "DEBUG" and STAGE to "production".