Reputation: 32296
I have a python function that I can deploy through S3 bucket. But it is possible to deploy a function "inline"...
But I do not see any clear instructions about how to do this. I do not want to use S3 bucket.
Upvotes: 5
Views: 10567
Reputation: 14029
You can deploy an AWS Lambda function inline within a CloudFormation template through the following YAML syntax.
LambdaFunction:
Type: AWS::Lambda::Function
Properties:
Code:
ZipFile: >
def handler(event, context):
print('hello from lambda')
Handler: index.handler
Role:
Fn::GetAtt: [ LambdaRole , "Arn" ]
Runtime: python3.6
Timeout: 60
Upvotes: 12
Reputation: 446
As soon as function is created you will see edit inline option and a file of your lambda_function_name/lambda_function.py with code
import json.
def lambda_handler(event, context):
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}
you can edit this based upon requirement.This is inline.
Upvotes: -1