Aws lambda AWS SAM在serverless.template中设置基于lambda资源的策略
我使用此模板将.net核心web api部署到aws serverless。我想设置lambda函数的基于资源的策略(而不是api网关)。目前,它是自动生成的,条件如下Aws lambda AWS SAM在serverless.template中设置基于lambda资源的策略,aws-lambda,asp.net-core-webapi,aws-serverless,aws-sam,Aws Lambda,Asp.net Core Webapi,Aws Serverless,Aws Sam,我使用此模板将.net核心web api部署到aws serverless。我想设置lambda函数的基于资源的策略(而不是api网关)。目前,它是自动生成的,条件如下 "Condition": { "ArnLike": { "AWS:SourceArn": "arn:aws:execute-api:region:accountid:id/*/*/*" } } 我只是不想让这一切发生 /*/*/* 想根据我的需要定制 serve
"Condition": {
"ArnLike": {
"AWS:SourceArn": "arn:aws:execute-api:region:accountid:id/*/*/*"
}
}
我只是不想让这一切发生
/*/*/*
想根据我的需要定制
serverless.template文件
{
"AWSTemplateFormatVersion": "2010-09-09",
"Transform": "AWS::Serverless-2016-10-31",
"Description": "",
"Parameters": {
"LambdaExecutionRole": {
"Type": "String",
"Description": ""
},
"EnvironmentName": {
"Type": "String",
"Description": ""
}
},
"Globals":{
"Api": {
"BinaryMediaTypes": ["multipart/form-data"],
"Cors": {
"AllowMethods": "'GET,POST,PUT,DELETE,OPTIONS'",
"AllowHeaders": "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,entity-context,user-context'",
"AllowOrigin": "'*'",
"AllowCredentials": "'true'"
}
}
},
"Resources": {
"ACEApi": {
"Type": "AWS::Serverless::Function",
"Properties": {
"FunctionName": "Api",
"Handler": "ACE.Api.Aws.Serverless::Api.Aws.Serverless.LambdaEntryPoint::FunctionHandlerAsync",
"Runtime": "dotnetcore2.1",
"CodeUri": "",
"MemorySize": 512,
"Timeout": 60,
"Environment" : {
"Variables" : {
"ASPNETCORE_ENVIRONMENT": { "Ref" : "EnvironmentName" }
}
},
"Role": {
"Ref": "LambdaExecutionRole"
},
"Events": {
"proxy": {
"Type": "Api",
"Properties": {
"Path": "/{proxy+}",
"Method": "any"
}
}
}
}
}
},
"Outputs": {
"ApiURL": {
"Description": "API endpoint URL for Prod environment",
"Value": {
"Fn::Sub": "https://${ServerlessRestApi}.execute-api.${AWS::Region}.amazonaws.com/Prod/"
}
}
}
}