Skip to content

Instantly share code, notes, and snippets.

@sk-t3ch
Last active May 5, 2020 19:25
Show Gist options
  • Save sk-t3ch/28b0e25d8a17b7a1e8079779ba763728 to your computer and use it in GitHub Desktop.
Save sk-t3ch/28b0e25d8a17b7a1e8079779ba763728 to your computer and use it in GitHub Desktop.
Hello World API CloudFormation - Python Lambda with CORS enabled
Lambda:
Type: AWS::Lambda::Function
Properties:
Code:
ZipFile: |
def handler(event, context):
response = {
'isBase64Encoded': False,
'statusCode': 200,
'body': 'HELLO WORLD!',
'headers': {
'access-control-allow-methods': 'GET',
'access-control-allow-origin': '*',
'access-control-allow-headers': 'Content-Type, Access-Control-Allow-Headers'
}
}
return response
Handler: lambda_function.handler
Role: !GetAtt LambdaRole.Arn
Runtime: python3.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment