From ab09ad9a748c6c9bbc3438a57567086282e14117 Mon Sep 17 00:00:00 2001 From: David Manouchehri Date: Thu, 23 Nov 2023 01:05:24 -0500 Subject: [PATCH] Make Function URL public. --- template.yaml | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/template.yaml b/template.yaml index baa7c2d17..b90d7ac26 100644 --- a/template.yaml +++ b/template.yaml @@ -10,36 +10,27 @@ Globals: Function: Timeout: 600 MemorySize: 128 + Environment: + Variables: + WORKER_CONFIG: !Ref WorkerConfigParameter Parameters: AliasParameter: Type: String Default: live + WorkerConfigParameter: + Type: String + Description: Sample environment variable + Default: '{"model": null, "alias": null, "api_base": null, "api_version": "2023-07-01-preview", "debug": false, "temperature": null, "max_tokens": null, "request_timeout": 600, "max_budget": null, "telemetry": true, "drop_params": false, "add_function_to_prompt": false, "headers": null, "save": false, "config": null, "use_queue": false}' Resources: - LambdaExecutionRole: - Type: AWS::IAM::Role + MyUrlFunctionPermissions: + Type: AWS::Lambda::Permission Properties: - AssumeRolePolicyDocument: - Version: '2012-10-17' - Statement: - - Effect: Allow - Principal: - Service: - - lambda.amazonaws.com - - edgelambda.amazonaws.com - Action: sts:AssumeRole - Policies: - - PolicyName: LambdaExecutionPolicy - PolicyDocument: - Version: '2012-10-17' - Statement: - - Effect: Allow - Action: - - logs:CreateLogGroup - - logs:CreateLogStream - - logs:PutLogEvents - Resource: 'arn:aws:logs:*:*:*' + FunctionName: !Ref URL + Action: lambda:InvokeFunctionUrl + Principal: "*" + FunctionUrlAuthType: NONE Function: Type: AWS::Serverless::Function @@ -49,7 +40,6 @@ Resources: Handler: proxy/lambda.handler Runtime: python3.11 AutoPublishAlias: !Ref AliasParameter - Role: !GetAtt LambdaExecutionRole.Arn Architectures: - x86_64 DeploymentPreference: @@ -81,7 +71,7 @@ Resources: Type: AWS::Lambda::Url DependsOn: FunctionAliaslive Properties: - AuthType: AWS_IAM + AuthType: NONE Qualifier: live TargetFunctionArn: !GetAtt Function.Arn