Skip to content

Instantly share code, notes, and snippets.

@rbarman
Created April 19, 2024 00:45
Show Gist options
  • Save rbarman/62c64a59041a91b05355373a0365f89e to your computer and use it in GitHub Desktop.
Save rbarman/62c64a59041a91b05355373a0365f89e to your computer and use it in GitHub Desktop.
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: Event handler Lambda Function URL
Globals:
Function:
Timeout: 5
Runtime: python3.12
Tracing: Active
Environment:
Variables:
POWERTOOLS_LOG_LEVEL: INFO
POWERTOOLS_LOGGER_SAMPLE_RATE: 0.1
POWERTOOLS_LOGGER_LOG_EVENT: true
POWERTOOLS_SERVICE_NAME: example
FunctionUrlConfig:
Cors: # see CORS section
# Notice that values here are Lists of Strings, vs comma-separated values on API Gateway
AllowOrigins: ["*"]
AllowHeaders: ["Content-Type", "Authorization", "X-Amz-Date"]
MaxAge: 300
Resources:
ApiFunction:
Type: AWS::Serverless::Function
Properties:
Handler: lambda.lambda_handler
CodeUri: ../src
Description: API handler function
FunctionUrlConfig:
AuthType: NONE # AWS_IAM for added security beyond sample documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment