Last active
May 5, 2020 19:26
-
-
Save sk-t3ch/331aa9a98ef94bf7d85e519a6d9312f6 to your computer and use it in GitHub Desktop.
Hello World API CloudFormation - Python Lambda
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lambda: | |
Type: AWS::Lambda::Function | |
Properties: | |
Code: | |
ZipFile: | | |
def handler(event, context): | |
response = { | |
'isBase64Encoded': False, | |
'statusCode': 200, | |
'body': 'HELLO WORLD!' | |
} | |
return response | |
Handler: lambda_function.handler | |
Role: !GetAtt LambdaRole.Arn | |
Runtime: python3.7 | |
LambdaRole: | |
Type: AWS::IAM::Role | |
Properties: | |
AssumeRolePolicyDocument: | |
Statement: | |
- Action: ['sts:AssumeRole'] | |
Effect: Allow | |
Principal: | |
Service: ['lambda.amazonaws.com'] | |
Path: / | |
ManagedPolicyArns: | |
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole | |
LambdaFunctionPermission: | |
Type: AWS::Lambda::Permission | |
Properties: | |
FunctionName: !GetAtt Lambda.Arn | |
Action: 'lambda:InvokeFunction' | |
Principal: elasticloadbalancing.amazonaws.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment